From 588f8ac39d573d56aa3440b1dc21da641d2b34ec Mon Sep 17 00:00:00 2001 From: Puneeth Chaganti Date: Mon, 31 Jan 2011 17:12:36 +0530 Subject: 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). --- versionControl/handOut.rst | 54 +++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 29 deletions(-) (limited to 'versionControl') diff --git a/versionControl/handOut.rst b/versionControl/handOut.rst index 58c191c..01d7fa8 100644 --- a/versionControl/handOut.rst +++ b/versionControl/handOut.rst @@ -227,17 +227,12 @@ in time. We do this by using the ``commit`` command. :: - $ 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 @@ description of the changeset. 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 @@ used the ``hg commit`` command to commit the changes that we have made. $ 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 @@ commit your changes, just like the simple merge that we performed. $ 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. -- cgit