Mercurial > hgbook
comparison en/tour-basic.tex @ 174:ef6a1427d0af
Update tour info more usefully.
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Tue, 27 Mar 2007 15:46:32 -0700 |
parents | d3f8aec5beff |
children | 6a847f7902a7 |
comparison
equal
deleted
inserted
replaced
173:754312dc23d5 | 174:ef6a1427d0af |
---|---|
356 The \hgcmd{commit} command lets us create a new changeset; we'll | 356 The \hgcmd{commit} command lets us create a new changeset; we'll |
357 usually refer to this as ``making a commit'' or ``committing''. | 357 usually refer to this as ``making a commit'' or ``committing''. |
358 | 358 |
359 \subsection{Setting up a username} | 359 \subsection{Setting up a username} |
360 | 360 |
361 When you try to run \hgcmd{commit} for the first time, it may succeed | 361 When you try to run \hgcmd{commit} for the first time, it is not |
362 immediately, or it may fail with an error message that looks like | 362 guaranteed to succeed. Mercurial records your name and address with |
363 this. | 363 each change that you commit, so that you and others will later be able |
364 \interaction{tour.commit-no-user} | 364 to tell who made each change. Mercurial tries to automatically figure |
365 If it succeeds for you, the chances are that either you already have a | 365 out a sensible username to commit the change with. It will attempt |
366 file called \sfilename{.hgrc} in your home directory, or an | 366 each of the following methods, in order: |
367 environment variable set named \envar{EMAIL}. | 367 \begin{enumerate} |
368 | 368 \item If you specify a \hgopt{commit}{-u} option to the \hgcmd{commit} |
369 When you commit, Mercurial wants to know what your name is, so that it | 369 command on the command line, followed by a username, this is always |
370 can record it. If you have created a \sfilename{.hgrc} file, it will | 370 given the highest precedence. |
371 look in there. If it doesn't find something suitable, it will see if | 371 \item If you have set the \envar{HGUSER} environment variable, this is |
372 your \envar{EMAIL} address is set. If neither of these is present, it | 372 checked next. |
373 will produce the error message you can see above. | 373 \item If you create a file in your home directory called |
374 \sfilename{.hgrc}, with a \rcitem{ui}{username} entry, that will be | |
375 used next. To see what the contents of this file should look like, | |
376 refer to section~\ref{sec:tour-basic:username} below. | |
377 \item If you have set the \envar{EMAIL} environment variable, this | |
378 will be used next. | |
379 \item Mercurial will query your system to find out your local user | |
380 name and host name, and construct a username from these components. | |
381 Since this often results in a username that is not very useful, it | |
382 will print a warning if it has to do this. | |
383 \end{enumerate} | |
384 If all of these mechanisms fail, Mercurial will fail, printing an | |
385 error message. In this case, it will not let you commit until you set | |
386 up a username. | |
387 | |
388 You should think of the \envar{HGUSER} environment variable and the | |
389 \hgopt{commit}{-u} option to the \hgcmd{commit} command as ways to | |
390 \emph{override} Mercurial's default selection of username. For normal | |
391 use, the simplest and most robust way to set a username for yourself | |
392 is by creating a \sfilename{.hgrc} file; see below for details. | |
374 | 393 |
375 \subsubsection{Creating a Mercurial configuration file} | 394 \subsubsection{Creating a Mercurial configuration file} |
395 \label{sec:tour-basic:username} | |
376 | 396 |
377 To set a user name, use your favourite editor to create a file called | 397 To set a user name, use your favourite editor to create a file called |
378 \sfilename{.hgrc} in your home directory. Mercurial will use this | 398 \sfilename{.hgrc} in your home directory. Mercurial will use this |
379 file to look up your personalised configuration settings. The initial | 399 file to look up your personalised configuration settings. The initial |
380 contents of your \sfilename{.hgrc} should look like this. | 400 contents of your \sfilename{.hgrc} should look like this. |