# HG changeset patch # User Puneeth Chaganti # Date 1296474156 -19800 # Node ID ac12270f8fdf933b9f2a1f71f5ee0710de436ae7 # Parent 44838801f255724ec12db637c6160145a4e629af vcs: Introduce commit with -u and -m parameters commit is now introduced with -u and -m parameters. This fixes a couple of problems -- 1) hg sometimes doesn't allow commits without username 2) vi(m) is the default editor -- most people can't use it (yet). diff -r 44838801f255 -r ac12270f8fdf versionControl/handOut.rst --- a/versionControl/handOut.rst Mon Jan 31 14:17:11 2011 +0530 +++ b/versionControl/handOut.rst Mon Jan 31 17:12:36 2011 +0530 @@ -227,17 +227,12 @@ :: - $ hg commit - -We are now prompted with a new editor window. We type out our message here -describing the changes that we have made. + $ hg commit -u "Puneeth Chaganti date: Fri Jan 28 14:04:07 2011 +0530 summary: Initial Commit @@ -278,21 +273,24 @@ User information ---------------- -But there is a slight problem with the user details that mercurial is saving. -It saves my username with my machine name. It is a general good practice to -use your full name with your email id. We set our username in the ``.hgrc`` -file in our Home folder. (``$HOME/.hgrc`` on Unix like systems and -``%HOME%\.hgrc`` on Windows systems) This is a global setting for all the -projects that we are working on. We could also set the details, at a -repository level. We shall look at this in due course. +But there are two things, that can be changed. Firstly, it is unnecessary to +keep typing the user information each and every time we make a commit. +Secondly, it is not very convenient to enter a multi-line commit message from +the terminal. To solve these problems, we set our user details and editor +preferences in the ``.hgrc`` file in our home folder. (``$HOME/.hgrc`` on +Unix like systems and ``%USERPROFILE%\.hgrc`` on Windows systems) This is a +global setting for all the projects that we are working on. We could also set +the details, at a repository level. We shall look at this in due course. -We open the file in our favorite editor and add the username details. +We open the file in our favorite editor and add the username details and our +editor preferences. :: $ emacs ~/.hgrc [ui] username = Puneeth Chaganti + editor = emacs We have now set the username details for mercurial to use, in all our future commits. (Note: You can also set user preferences at the repository level. @@ -313,13 +311,14 @@ $ hg commit -We are again prompted with the editor window to enter our commit message and -we type out our commit message. There are some good practices when typing out -a commit message too. It is a general practice to have a summary line in the -commit message which is no longer than 60 to 65 characters giving a summary -of the change we have made. This is followed up with an explanation of why -this was changed, what is the effect of this change, known bugs/issues -remaining, if any, etc. +We are now prompted with a window of our favorite editor. We can now type out +our commit message in the editor window. + +There are some recommended practices for commit messages, too. It is a +general practice to have a summary line in the commit message which is no +longer than 60 to 65 characters giving a summary of the change committed. +This is followed up with an explanation of why this was changed, what is the +effect of this change, known bugs/issues remaining, if any, etc. :: @@ -1021,9 +1020,6 @@ $ hg commit -m "Merge heads." $ hg push -*Note*, we have used a different way to commit. We have used the ``-m`` -argument with the commit message. - We could look at the graph of the changes, in our web interface, being served by the ``hg serve`` command. From the graph it is clear, how the merging has occurred.