Mercurial > hgbook
comparison en/tour-basic.tex @ 102:ff9dc8bc2a8b
More. Merge. Stuff.
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Wed, 18 Oct 2006 15:47:04 -0700 |
parents | 321732566ac1 |
children | d3f8aec5beff |
comparison
equal
deleted
inserted
replaced
101:321732566ac1 | 102:ff9dc8bc2a8b |
---|---|
354 where we want to record our work in a new changeset. | 354 where we want to record our work in a new changeset. |
355 | 355 |
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} | |
360 | |
361 When you try to run \hgcmd{commit} for the first time, it may succeed | |
362 immediately, or it may fail with an error message that looks like | |
363 this. | |
364 \interaction{tour.commit-no-user} | |
365 If it succeeds for you, the chances are that either you already have a | |
366 file called \sfilename{.hgrc} in your home directory, or an | |
367 environment variable set named \envar{EMAIL}. | |
368 | |
369 When you commit, Mercurial wants to know what your name is, so that it | |
370 can record it. If you have created a \sfilename{.hgrc} file, it will | |
371 look in there. If it doesn't find something suitable, it will see if | |
372 your \envar{EMAIL} address is set. If neither of these is present, it | |
373 will produce the error message you can see above. | |
374 | |
375 \subsubsection{Creating a Mercurial configuration file} | |
376 | |
377 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 | |
379 file to look up your personalised configuration settings. The initial | |
380 contents of your \sfilename{.hgrc} should look like this. | |
381 \begin{codesample2} | |
382 # This is a Mercurial configuration file. | |
383 [ui] | |
384 username = Firstname Lastname <email.address@domain.net> | |
385 \end{codesample2} | |
386 The ``\texttt{[ui]}'' line begins a \emph{section} of the config file, | |
387 so you can read the ``\texttt{username = ...}'' line as meaning ``set | |
388 the value of the \texttt{username} item in the \texttt{ui} section''. | |
389 A section continues until a new section begins, or the end of the | |
390 file. Mercurial ignores empty lines and treats any text from | |
391 ``\texttt{\#}'' to the end of a line as a comment. | |
392 | |
393 \subsubsection{Choosing a user name} | |
394 | |
395 You can use any text you like as the value of the \texttt{username} | |
396 config item, since this information is for reading by other people, | |
397 but for interpreting by Mercurial. The convention that most people | |
398 follow is to use their name and email address, as in the example | |
399 above. | |
400 | |
401 \begin{note} | |
402 Mercurial's built-in web server obfuscates email addresses, to make | |
403 it more difficult for the email harvesting tools that spammers use. | |
404 This reduces the likelihood that you'll start receiving more junk | |
405 email if you publish a Mercurial repository on the web. | |
406 \end{note} | |
407 | |
359 \subsection{Writing a commit message} | 408 \subsection{Writing a commit message} |
360 | 409 |
361 When we commit a change, Mercurial drops us into a text editor, to | 410 When we commit a change, Mercurial drops us into a text editor, to |
362 enter a message that will describe the modifications we've made in | 411 enter a message that will describe the modifications we've made in |
363 this changeset. This is called the \emph{commit message}. It will be | 412 this changeset. This is called the \emph{commit message}. It will be |
408 | 457 |
409 If we run the \hgcmd{commit} command without any arguments, it records | 458 If we run the \hgcmd{commit} command without any arguments, it records |
410 all of the changes we've made, as reported by \hgcmd{status} and | 459 all of the changes we've made, as reported by \hgcmd{status} and |
411 \hgcmd{diff}. | 460 \hgcmd{diff}. |
412 | 461 |
413 \subsection{Admiring our new handywork} | 462 \subsection{Admiring our new handiwork} |
414 | 463 |
415 Once we've finished the commit, we can use the \hgcmd{tip} command to | 464 Once we've finished the commit, we can use the \hgcmd{tip} command to |
416 display the changeset we just created. This command produces output | 465 display the changeset we just created. This command produces output |
417 that is identical to \hgcmd{log}, but it only displays the newest | 466 that is identical to \hgcmd{log}, but it only displays the newest |
418 revision in the repository. | 467 revision in the repository. |