hgbook

changeset 174:ef6a1427d0af

Update tour info more usefully.
author Bryan O'Sullivan <bos@serpentine.com>
date Tue Mar 27 15:46:32 2007 -0700 (2007-03-27)
parents 754312dc23d5
children 626db338bc0b
files en/examples/tour en/examples/tour.commit.out en/tour-basic.tex
line diff
     1.1 --- a/en/examples/tour	Tue Mar 27 15:45:12 2007 -0700
     1.2 +++ b/en/examples/tour	Tue Mar 27 15:46:32 2007 -0700
     1.3 @@ -14,6 +14,7 @@
     1.4  
     1.5  #$ name: ls
     1.6  #$ ignore: ^drwx.*
     1.7 +#$ ignore: ^total \d+
     1.8  
     1.9  ls -l
    1.10  ls hello
    1.11 @@ -67,16 +68,6 @@
    1.12  #$ name:
    1.13  
    1.14  export HGEDITOR='echo Added an extra line of output >'
    1.15 -HGRCPATH_ORIG=$HGRCPATH
    1.16 -export HGRCPATH=
    1.17 -
    1.18 -#$ name: commit-no-user
    1.19 -
    1.20 -hg commit
    1.21 -
    1.22 -#$ name:
    1.23 -
    1.24 -export HGRCPATH=$HGRCPATH_ORIG
    1.25  
    1.26  #$ name: commit
    1.27  
     2.1 --- a/en/examples/tour.commit.out	Tue Mar 27 15:45:12 2007 -0700
     2.2 +++ b/en/examples/tour.commit.out	Tue Mar 27 15:46:32 2007 -0700
     2.3 @@ -1,2 +1,1 @@
     2.4  $ \textbf{hg commit}
     2.5 -nothing changed
     3.1 --- a/en/tour-basic.tex	Tue Mar 27 15:45:12 2007 -0700
     3.2 +++ b/en/tour-basic.tex	Tue Mar 27 15:46:32 2007 -0700
     3.3 @@ -358,21 +358,41 @@
     3.4  
     3.5  \subsection{Setting up a username}
     3.6  
     3.7 -When you try to run \hgcmd{commit} for the first time, it may succeed
     3.8 -immediately, or it may fail with an error message that looks like
     3.9 -this.
    3.10 -\interaction{tour.commit-no-user}
    3.11 -If it succeeds for you, the chances are that either you already have a
    3.12 -file called \sfilename{.hgrc} in your home directory, or an
    3.13 -environment variable set named \envar{EMAIL}.
    3.14 -
    3.15 -When you commit, Mercurial wants to know what your name is, so that it
    3.16 -can record it.  If you have created a \sfilename{.hgrc} file, it will
    3.17 -look in there.  If it doesn't find something suitable, it will see if
    3.18 -your \envar{EMAIL} address is set.  If neither of these is present, it
    3.19 -will produce the error message you can see above.
    3.20 +When you try to run \hgcmd{commit} for the first time, it is not
    3.21 +guaranteed to succeed.  Mercurial records your name and address with
    3.22 +each change that you commit, so that you and others will later be able
    3.23 +to tell who made each change.  Mercurial tries to automatically figure
    3.24 +out a sensible username to commit the change with.  It will attempt
    3.25 +each of the following methods, in order:
    3.26 +\begin{enumerate}
    3.27 +\item If you specify a \hgopt{commit}{-u} option to the \hgcmd{commit}
    3.28 +  command on the command line, followed by a username, this is always
    3.29 +  given the highest precedence.
    3.30 +\item If you have set the \envar{HGUSER} environment variable, this is
    3.31 +  checked next.
    3.32 +\item If you create a file in your home directory called
    3.33 +  \sfilename{.hgrc}, with a \rcitem{ui}{username} entry, that will be
    3.34 +  used next.  To see what the contents of this file should look like,
    3.35 +  refer to section~\ref{sec:tour-basic:username} below.
    3.36 +\item If you have set the \envar{EMAIL} environment variable, this
    3.37 +  will be used next.
    3.38 +\item Mercurial will query your system to find out your local user
    3.39 +  name and host name, and construct a username from these components.
    3.40 +  Since this often results in a username that is not very useful, it
    3.41 +  will print a warning if it has to do this.
    3.42 +\end{enumerate}
    3.43 +If all of these mechanisms fail, Mercurial will fail, printing an
    3.44 +error message.  In this case, it will not let you commit until you set
    3.45 +up a username.
    3.46 +
    3.47 +You should think of the \envar{HGUSER} environment variable and the
    3.48 +\hgopt{commit}{-u} option to the \hgcmd{commit} command as ways to
    3.49 +\emph{override} Mercurial's default selection of username.  For normal
    3.50 +use, the simplest and most robust way to set a username for yourself
    3.51 +is by creating a \sfilename{.hgrc} file; see below for details.
    3.52  
    3.53  \subsubsection{Creating a Mercurial configuration file}
    3.54 +\label{sec:tour-basic:username}
    3.55  
    3.56  To set a user name, use your favourite editor to create a file called
    3.57  \sfilename{.hgrc} in your home directory.  Mercurial will use this