pages tagged revision_control http://meng6net.localhost/tag/revision_control/ <p><small>Copyright © 2005-2020 by <code>Meng Lu &lt;lumeng3@gmail.com&gt;</code></small></p> Meng Lu's home page ikiwiki Tue, 16 May 2017 23:59:39 +0000 Log statistics for revision control systems http://meng6net.localhost/blog/Log_statistics_for_revision_control_systems/ http://meng6net.localhost/blog/Log_statistics_for_revision_control_systems/ command-line interface computing cvs git mercurial revision control tip unix Tue, 16 May 2017 23:59:39 +0000 2017-05-16T23:59:39Z <h2>Find the top committers to a file</h2> <h3>Mercurial:</h3> <pre> <code>$ hg log ./.hgignore | grep user: | sort | uniq -c | sort -r | head -3 5 user: Michael &lt;michael@foomail.com&gt; 3 user: Mary &lt;mary@barmail.com&gt; </code></pre> <h3>Git:</h3> <pre> <code>$ git log ./.gitignore | grep ^Author: | sort | uniq -c | sort -r | head -3 6 Author: Michael &lt;michael@foomail.com&gt; 2 Author: Mary &lt;mary@foomail.com&gt; </code></pre> <h3>CVS:</h3> <pre> <code>$ cvs log ./foo/bar.cpp | grep author | awk '{print $5}' | sort | uniq -c | sort -r | head -3 92 Michael; 72 Mary; </code></pre> /blog/Log_statistics_for_revision_control_systems/#comments Style Guide for Revision Control System Commit Messages http://meng6net.localhost/blog/Style_Guide_for_Revision_Control_System_Commit_Messages/ http://meng6net.localhost/blog/Style_Guide_for_Revision_Control_System_Commit_Messages/ computing git mercurial revision control style subversion tip Tue, 16 May 2017 23:59:39 +0000 2017-05-16T23:59:39Z <p>Was trying to come up with some style guide for commit messages in revision control systems (Subversion, Git, Mercurial, etc.) as very commonly it is a place where people tend to use poor or poorly-managed writing styles when they are in a hurry, or not. The contrast between the sophistication of engineering of automatic revision control systems and the lousiness of majority of commit messages I've seen is ironic, at least to me. Imagine a situation where one wants to data mine the commit message history in a revision control repository and do text analytics with it to find out some interesting thing about the project, it can be very useful for the commit messages to have a uniform format and hence more machine processable.</p> <h2>Some general rule for revisions and commits</h2> <ul> <li>try to make a commit self-contained, i.e. logically-closely-related revisions should be committed together in one commit rather than in multiple separate commits</li> <li>try to make logically-unrelated revisions in their own separate commits rather than make a big revision including many changes that are logically independent to each other</li> </ul> <h2>Some general rules for having uniform format of the commit messages</h2> <ul> <li> <p>Use a short <em>summary sentence</em> at the top to summarize the main purpose/content of the revision. As both Git and Mercurial use the first sentence ending with <em>period</em> (<code>.</code>) for various purposes. If there are itemized details in the following, use <em>ellipsis</em> (<code>...</code>) instead.</p> </li> <li> <p>Leave a blank line below the <em>summary sentence</em>.</p> </li> <li> <p>Keep the lines shorter than 72 characters as that produces better line wrapping behavior for <code>hg log</code> and <code>git log</code>.</p> </li> <li> <p>If necessary, use bullet items below the blank line to describe details. Use different bullet for different types of revisions</p> <ul> <li> <p><code>+</code> added new content</p> </li> <li> <p><code>-</code> removed existing content</p> </li> <li> <p><code>%</code> modified existing content and/or behavior</p> </li> <li> <p><code>!</code> fixed bugs and errors</p> </li> <li> <p><code>~</code> tweaked content by making small and/or insubstantial changes</p> </li> <li> <p><code>*</code> misc and/or other unclassified changes</p> </li> <li> <p><code>&gt;</code> to-do for future</p> </li> </ul> </li> <li> <p>Try to use expressions with simple past tense or noun phrases.</p> </li> </ul> <p>Example commit message to a revision control repository:</p> <pre><code>Changed the logic dealing with magic input. + added an awesome new functionality - removed obsolete content % modified some existing code ! fixed a bad bug ~ tweaked some content * some misc unclassified changes &gt; make the logic more robust </code></pre> /blog/Style_Guide_for_Revision_Control_System_Commit_Messages/#comments