comparison ja/tour-basic.tex @ 786:11bc9d788428

finished tour-basic.tex
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Sun, 07 Jun 2009 20:25:51 +0900
parents 7dd855842de4
children 72eab2497e12
comparison
equal deleted inserted replaced
785:7dd855842de4 786:11bc9d788428
346 %refer to ``a~\emph{specific} changeset'' is of great importance. 346 %refer to ``a~\emph{specific} changeset'' is of great importance.
347 %Recall that the \texttt{changeset} field in the output from 347 %Recall that the \texttt{changeset} field in the output from
348 %\hgcmd{log} identifies a changeset using both a number and a 348 %\hgcmd{log} identifies a changeset using both a number and a
349 %hexadecimal string. 349 %hexadecimal string.
350 350
351 \emph{$BMQ8l(B} 351 ``a~changeset''$B$H$$$&%A%'%s%8%;%C%H$N(B\emph{$B8F$SL>(B}$B$O<+M3$@$,!$(B
352 ``a~\emph{specific} changeset''$B$r;2>H$9$k(B\emph{$B<1JL;R(B}$B$OHs>o$K=EMW$G$"$k!%(B
353 \hgcmd{log}$B%3%^%s%I$N=PNO$K4^$^$l$k(B\texttt{changeset}$B%U%#!<%k%I$O!$$"$k%A%'(B
354 $B%s%8%;%C%H$rHV9f$H(B16$B?JJ8;zNs$GI=$7$F$$$?$3$H$r;W$$=P$7$FM_$7$$!%(B
352 355
353 %\begin{itemize} 356 %\begin{itemize}
354 %\item The revision number is \emph{only valid in that repository}, 357 %\item The revision number is \emph{only valid in that repository},
355 %\item while the hex string is the \emph{permanent, unchanging 358 %\item while the hex string is the \emph{permanent, unchanging
356 % identifier} that will always identify that exact changeset in 359 % identifier} that will always identify that exact changeset in
369 %arrived in a repository, and there is no guarantee that the same 372 %arrived in a repository, and there is no guarantee that the same
370 %changes will happen in the same order in different repositories. 373 %changes will happen in the same order in different repositories.
371 %Three changes $a,b,c$ can easily appear in one repository as $0,1,2$, 374 %Three changes $a,b,c$ can easily appear in one repository as $0,1,2$,
372 %while in another as $1,0,2$. 375 %while in another as $1,0,2$.
373 376
374 $B$3$N6hJL$O=EMW$G$"$k!%(B``revision~33'' 377 $B$3$N6hJL$O=EMW$G$"$k!%C/$+$K(B``revision~33''$B$H8@$C$?;~!$$=$N%j%S%8%g%s(B33$B$,(B
375 378 $B<+J,$N%j%]%8%H%j$N%j%]%8%H%j$N$b$N$H$O(B\emph{$B0c$&$b$N$G$"$k(B}$B2DG=@-$O9b$$!%(B
379 $B$=$NM}M3$O!$%j%S%8%g%sHV9f$O%j%]%8%H%j$KJQ99$,8=$l$?=g=x$K$h$C$F7h$^(B
380 $B$j!$(BMercurial$B$G$OJL$N%j%]%8%H%j$GF1$8JQ99$,F1$8=g=x$G5/$3$kJ]>Z$O$J$$$?$a(B
381 $B$G$"$k!%(B 3$B$D$NJQ99(B$a,b,c$$B$O!$$"$k%j%]%8%H%j$G(B$0,1,2$$B$N=g$G5/$3$j!$JL$N%j(B
382 $B%]%8%H%j$G$O(B$1,0,2$$B$N=g=x$G5/$3$jF@$k!%(B
376 383
377 %Mercurial uses revision numbers purely as a convenient shorthand. If 384 %Mercurial uses revision numbers purely as a convenient shorthand. If
378 %you need to discuss a changeset with someone, or make a record of a 385 %you need to discuss a changeset with someone, or make a record of a
379 %changeset for some other reason (for example, in a bug report), use 386 %changeset for some other reason (for example, in a bug report), use
380 %the hexadecimal identifier. 387 %the hexadecimal identifier.
381 388
382 Mercurial$B$O%j%S%8%g%sHV9f$rC1$KJXMx$N$?$a$NN,5-J}$H$7$FMQ$$$k!%C/$+$H%A%'(B 389 Mercurial$B$O%j%S%8%g%sHV9f$rC1$KJXMx$N$?$a$NN,5-K!$H$7$FMQ$$$k!%C/$+$H%A%'(B
383 $B%s%8%;%C%H$K$D$$$F5DO@$7$?$j!$!J%P%0Js9p$J$I$N$?$a$K!K%A%'%s%8%;%C%H$r5-(B 390 $B%s%8%;%C%H$K$D$$$F5DO@$7$?$j!$!J%P%0Js9p$J$I$N$?$a$K!K%A%'%s%8%;%C%H$r5-(B
384 $BO?$7$?$$>l9g$O(B16$B?J$N<1JL;R$rMxMQ$9$Y$-$G$"$k!%(B 391 $BO?$7$?$$>l9g$O(B16$B?J$N<1JL;R$rMxMQ$9$Y$-$G$"$k!%(B
385
386
387
388 392
389 %\subsection{Viewing specific revisions} 393 %\subsection{Viewing specific revisions}
390 \subsection{$BFCDj$N%j%S%8%g%s$r8+$k(B} 394 \subsection{$BFCDj$N%j%S%8%g%s$r8+$k(B}
391 395
392 %To narrow the output of \hgcmd{log} down to a single revision, use the 396 %To narrow the output of \hgcmd{log} down to a single revision, use the
393 %\hgopt{log}{-r} (or \hgopt{log}{--rev}) option. You can use either a 397 %\hgopt{log}{-r} (or \hgopt{log}{--rev}) option. You can use either a
394 %revision number or a long-form changeset identifier, and you can 398 %revision number or a long-form changeset identifier, and you can
395 %provide as many revisions as you want. \interaction{tour.log-r} 399 %provide as many revisions as you want. \interaction{tour.log-r}
400
401 \hgcmd{log}$B$N=PNO$r$"$k(B1$B$D$N%j%S%8%g%s$K@)8B$9$k$?$a$K$O!$(B
402 \hgopt{log}{-r}$B!J$^$?$O(B \hgopt{log}{--rev}$B!K%*%W%7%g%s$rMQ$$$k!%%j%S%8%g(B
403 $B%sHV9f$bD97A<0$N%A%'%s%8%;%C%H<1JL;R$bMxMQ2DG=$G$"$j!$;XDj$G$-$k%j%S%8%g(B
404 $B%s$N?t$K@)8B$O$J$$!%(B
405 \interaction{tour.log-r}
396 406
397 %If you want to see the history of several revisions without having to 407 %If you want to see the history of several revisions without having to
398 %list each one, you can use \emph{range notation}; this lets you 408 %list each one, you can use \emph{range notation}; this lets you
399 %express the idea ``I want all revisions between $a$ and $b$, 409 %express the idea ``I want all revisions between $a$ and $b$,
400 %inclusive''. 410 %inclusive''.
401 %\interaction{tour.log.range} 411 %\interaction{tour.log.range}
402 %Mercurial also honours the order in which you specify revisions, so 412 %Mercurial also honours the order in which you specify revisions, so
403 %\hgcmdargs{log}{-r 2:4} prints $2,3,4$ while \hgcmdargs{log}{-r 4:2} 413 %\hgcmdargs{log}{-r 2:4} prints $2,3,4$ while \hgcmdargs{log}{-r 4:2}
404 %prints $4,3,2$. 414 %prints $4,3,2$.
405 415
416 $B$$$/$D$+$N%j%S%8%g%s$NMzNr$r!$$$$A$$$A%j%S%8%g%s$r;XDj$9$k$3$H$J$/8+$?$$(B
417 $B;~$O!$(B\emph{$BHO0O5-K!(B}$B$,;H$($k!%$3$l$K$h$j(B``$a$$B$+$i(B$b$$B$^$G$K4^$^$l$kA4$F$N(B
418 $B%j%S%8%g%s(B''$B$r;XDj$9$k$3$H$,$G$-$k!%(B
419 \interaction{tour.log.range}
420 Mercurial$B$O%j%S%8%g%s$,;XDj$5$l$?=g=x$r9MN8$9$k!%(B\hgcmdargs{log}{-r 2:4}
421 $B$O(B$2,3,4$$B$N=g$KI=<($7!$(B\hgcmdargs{log}{-r 4:2}$B$O(B$4,3,2$$B$N=g$KI=<($r9T$&!%(B
422
406 %\subsection{More detailed information} 423 %\subsection{More detailed information}
407 \subsection{$B$h$j>\:Y$J>pJs(B} 424 \subsection{$B$h$j>\:Y$J>pJs(B}
408 425
409 %While the summary information printed by \hgcmd{log} is useful if you 426 %While the summary information printed by \hgcmd{log} is useful if you
410 %already know what you're looking for, you may need to see a complete 427 %already know what you're looking for, you may need to see a complete
412 %trying to decide whether a changeset is the one you're looking for. 429 %trying to decide whether a changeset is the one you're looking for.
413 %The \hgcmd{log} command's \hggopt{-v} (or \hggopt{--verbose}) 430 %The \hgcmd{log} command's \hggopt{-v} (or \hggopt{--verbose})
414 %option gives you this extra detail. 431 %option gives you this extra detail.
415 %\interaction{tour.log-v} 432 %\interaction{tour.log-v}
416 433
434 $BC5$7$F$$$k$b$N$,$O$C$-$j$7$F$$$k>l9g$O(B\hgcmd{log}$B%3%^%s%I$K$h$k%5%^%j!<>p(B
435 $BJs$OM-MQ$@$,!$$I$N%A%'%s%8%;%C%H$,8+$D$1$h$&$H$9$k%A%'%s%8%;%C%H$J$N$+7h(B
436 $B$a$k;~$K$OJQ99$N40A4$J5-=R$dJQ99$5$l$?%U%!%$%k$N%j%9%H$,I,MW$K$J$k$+$b$7(B
437 $B$l$J$$!%(B\hgcmd{log}$B%3%^%s%I$N(B\hggopt{-v}$B!J$^$?$O(B\hggopt{--verbose}$B!K%*%W(B
438 $B%7%g%s$G$h$j>\:Y$J>pJs$r8+$k$3$H$,$G$-$k!%(B
439 \interaction{tour.log-v}
440
417 %If you want to see both the description and content of a change, add 441 %If you want to see both the description and content of a change, add
418 %the \hgopt{log}{-p} (or \hgopt{log}{--patch}) option. This displays 442 %the \hgopt{log}{-p} (or \hgopt{log}{--patch}) option. This displays
419 %the content of a change as a \emph{unified diff} (if you've never seen 443 %the content of a change as a \emph{unified diff} (if you've never seen
420 %a unified diff before, see section~\ref{sec:mq:patch} for an overview). 444 %a unified diff before, see section~\ref{sec:mq:patch} for an overview).
421 %\interaction{tour.log-vp} 445 %\interaction{tour.log-vp}
422 446
447 $B@bL@$HJQ99$NFbMF$NN>J}$r8+$?$$>l9g$O(B\hgopt{log}{-p}$B!J$^$?$O(B
448 \hgopt{log}{--patch}$B!K%*%W%7%g%s$rDI2C$9$k!%$3$N%*%W%7%g%s$OJQ99$NFbMF$r(B
449 \emph{unified diff}$B7A<0$GI=<($9$k!%!J(Bunified diff$B7A<0$r8+$?$3$H$,$J$1$l(B
450 $B$P35N,$r(B\ref{sec:mq:patch}$B@a$G8+$k$3$H$,$G$-$k!%!K(B
451 \interaction{tour.log-vp}
452
423 %\section{All about command options} 453 %\section{All about command options}
424 \section{$B%3%^%s%I%*%W%7%g%s$N$9$Y$F(B} 454 \section{$B%3%^%s%I%*%W%7%g%s$N$9$Y$F(B}
425 455
426 %Let's take a brief break from exploring Mercurial commands to discuss 456 %Let's take a brief break from exploring Mercurial commands to discuss
427 %a pattern in the way that they work; you may find this useful to keep 457 %a pattern in the way that they work; you may find this useful to keep
428 %in mind as we continue our tour. 458 %in mind as we continue our tour.
459
460 Mercurial$B%3%^%s%I$r;n$9$N$r0l5Y$_$7$F!$%3%^%s%I$NF0:n%Q%?!<%s$K$D$$$F5D(B
461 $BO@$7$F$_$h$&!%$3$l$O$3$N%D%"!<$rB3$1$k>e$GLr$KN)$D$@$m$&!%(B
429 462
430 %Mercurial has a consistent and straightforward approach to dealing 463 %Mercurial has a consistent and straightforward approach to dealing
431 %with the options that you can pass to commands. It follows the 464 %with the options that you can pass to commands. It follows the
432 %conventions for options that are common to modern Linux and Unix 465 %conventions for options that are common to modern Linux and Unix
433 %systems. 466 %systems.
434 %\begin{itemize} 467 Mercurial$B$O%3%^%s%I$K%*%W%7%g%s$rEO$9:]$K0l4S@-$N$"$kD>@\E*$J%"%W%m!<%A$r(B
468 $B<h$C$F$$$k!%$3$l$O8=Be$N(BLinux$B$*$h$S(BUnix$B$K6&DL$N%*%W%7%g%s$K4X$9$k=,47$K4p(B
469 $B$E$$$F$$$k!%(B
470 \begin{itemize}
435 %\item Every option has a long name. For example, as we've already 471 %\item Every option has a long name. For example, as we've already
436 % seen, the \hgcmd{log} command accepts a \hgopt{log}{--rev} option. 472 % seen, the \hgcmd{log} command accepts a \hgopt{log}{--rev} option.
473 \item $BA4$F$N%*%W%7%g%s$OD97A<0$N%*%W%7%g%s$r;}$D!%Nc$($P!$$9$G$K8+$F$$$k(B
474 $B$h$&$K(B\hgcmd{log}$B%3%^%s%I$O(B\hgopt{log}{--rev}$B%*%W%7%g%s$r<u$1IU$1(B
475 $B$k!%(B
437 %\item Most options have short names, too. Instead of 476 %\item Most options have short names, too. Instead of
438 % \hgopt{log}{--rev}, we can use \hgopt{log}{-r}. (The reason that 477 % \hgopt{log}{--rev}, we can use \hgopt{log}{-r}. (The reason that
439 % some options don't have short names is that the options in question 478 % some options don't have short names is that the options in question
440 % are rarely used.) 479 % are rarely used.)
480 \item $B$[$H$s$I$N%*%W%7%g%s$OC;=LL>$r;}$D!%(B\hgopt{log}{--rev}$B%*%W%7%g%s$N(B
481 $BBe$o$j$K(B\hgopt{log}{-r}$B$,;H$($k!%!J$$$/$D$+$N%*%W%7%g%s$GC;=LL>$,(B
482 $B;H$($J$$M}M3$O!$$=$N%*%W%7%g%s$,$[$H$s$I;HMQ$5$l$J$$$?$a$G$"$k!%!K(B
441 %\item Long options start with two dashes (e.g.~\hgopt{log}{--rev}), 483 %\item Long options start with two dashes (e.g.~\hgopt{log}{--rev}),
442 % while short options start with one (e.g.~\hgopt{log}{-r}). 484 % while short options start with one (e.g.~\hgopt{log}{-r}).
485 \item $BD97A<0$N%*%W%7%g%s$O(B2$B$D$N%@%C%7%e$G;O$^$k!JNc(B
486 ~\hgopt{log}{--rev}$B!K!%0lJ}C;7A<0$N%*%W%7%g%s$O(B1$B$D$N%@%C%7%e$G;O$^(B
487 $B$k!JNc(B ~\hgopt{log}{-r}$B!K!%(B
443 %\item Option naming and usage is consistent across commands. For 488 %\item Option naming and usage is consistent across commands. For
444 % example, every command that lets you specify a changeset~ID or 489 % example, every command that lets you specify a changeset~ID or
445 % revision number accepts both \hgopt{log}{-r} and \hgopt{log}{--rev} 490 % revision number accepts both \hgopt{log}{-r} and \hgopt{log}{--rev}
446 % arguments. 491 % arguments.
447 %\end{itemize} 492 \item $B%*%W%7%g%s$NL?L>$H;HMQK!$O%3%^%s%I4V$G0l4S$7$F$$$k!%Nc$r5s$2$k$H!$(B
493 $B%A%'%s%8%;%C%H(BID$B$^$?$O%j%S%8%g%sHV9f$r;XDj$5$;$k%3%^%s%I$NA4$F$G(B
494 \hgopt{log}{-r}$B$H(B\hgopt{log}{--rev}$B$NN>J}$r<u$1IU$1$k!%(B
495 \end{itemize}
448 %In the examples throughout this book, I use short options instead of 496 %In the examples throughout this book, I use short options instead of
449 %long. This just reflects my own preference, so don't read anything 497 %long. This just reflects my own preference, so don't read anything
450 %significant into it. 498 %significant into it.
499 $B$3$NK\$NNc$NA4$F$GC;7A<0$N%*%W%7%g%s$rMQ$$$k!%$3$l$OC1$KI.<T$N9%$_$N$?$a(B
500 $B$G!$?<$$0UL#$O$J$$!%(B
451 501
452 %Most commands that print output of some kind will print more output 502 %Most commands that print output of some kind will print more output
453 %when passed a \hggopt{-v} (or \hggopt{--verbose}) option, and less 503 %when passed a \hggopt{-v} (or \hggopt{--verbose}) option, and less
454 %when passed \hggopt{-q} (or \hggopt{--quiet}). 504 %when passed \hggopt{-q} (or \hggopt{--quiet}).
505 $BI=<(=PNO$r9T$&$[$H$s$I$N%3%^%s%I$G(B\hggopt{-v}$B!J$^$?$O(B\hggopt{--verbose}$B!K(B
506 $B%*%W%7%g%s$rIU$1$k$H$h$j>\:Y$J=PNO$r9T$$!$(B\hggopt{-q}$B!J$^$?$O(B
507 \hggopt{--quiet}$B!K%*%W%7%g%s$rIU$1$k$H$h$j4J7i$J=PNO$H$J$k!%(B
455 508
456 %\section{Making and reviewing changes} 509 %\section{Making and reviewing changes}
457 \section{$BJQ99$N;EJ}!$JQ99$N%l%S%e!<(B} 510 \section{$BJQ99$N;EJ}!$JQ99$N%l%S%e!<(B}
458 511
459 %Now that we have a grasp of viewing history in Mercurial, let's take a 512 %Now that we have a grasp of viewing history in Mercurial, let's take a
460 %look at making some changes and examining them. 513 %look at making some changes and examining them.
514
515 Mercurial$B$GMzNr$r8+$kJ}K!$K$D$$$F$OM}2r$7$?!%$3$3$G$O2?$+JQ99$r9T$C$F!$(B
516 $B$3$l$r8+$F$_$h$&!%(B
461 517
462 %The first thing we'll do is isolate our experiment in a repository of 518 %The first thing we'll do is isolate our experiment in a repository of
463 %its own. We use the \hgcmd{clone} command, but we don't need to 519 %its own. We use the \hgcmd{clone} command, but we don't need to
464 %clone a copy of the remote repository. Since we already have a copy 520 %clone a copy of the remote repository. Since we already have a copy
465 %of it locally, we can just clone that instead. This is much faster 521 %of it locally, we can just clone that instead. This is much faster
472 %work on multiple tasks in parallel, each isolated from the others 528 %work on multiple tasks in parallel, each isolated from the others
473 %until it's complete and you're ready to integrate it back. Because 529 %until it's complete and you're ready to integrate it back. Because
474 %local clones are so cheap, there's almost no overhead to cloning and 530 %local clones are so cheap, there's almost no overhead to cloning and
475 %destroying repositories whenever you want. 531 %destroying repositories whenever you want.
476 532
533 $B$^$::G=i$K$3$N<B83$rK\Mh$N%j%]%8%H%j$+$i3VN%$9$k$?$a$K(B\hgcmd{clone}$B$r9T(B
534 $B$&!%$9$G$K%m!<%+%k$J%j%]%8%H%j$r;}$C$F$$$k$N$G!$$3$l$r%/%m!<%s$9$k$@$1$G(B
535 $B$h$/!$%j%b!<%H$N%j%]%8%H%j$r%3%T!<$9$kI,MW$O$J$$!%%m!<%+%k$J%/%m!<%s$O%M%C(B
536 $B%H%o!<%/1[$7$K9T$&%/%m!<%s$h$j$b$:$C$HB.$/!$B?$/$N>l9g;HMQ$9$k%G%#%9%/MF(B
537 $BNL$b>/$J$$!%(B
538 \interaction{tour.reclone}
539 $B$^$?!$2?$+:n6H$r$7$?$$;~$K%5%s%I%\%C%/%9$H$9$k$?$a$K0l;~E*$J%/%m!<%s$r:n(B
540 $B@.$7!$%j%b!<%H%j%]%8%H%j$N%3%T!<$r(B``$B@67i(B''$B$KJ]$D$3$H$O$7$P$7$PLr$KN)$D!%(B
541 $B$3$l$K$h$jJ#?t$N:n6H$rJB9T$7$F9T$&$3$H$,$G$-!$$+$D!$:n6H$,40N;$7!$:F$SE}(B
542 $B9g$9$k$^$GB>$N:n6H$+$i3VN%$5$l$?$^$^$K$7$F$*$/$3$H$,$G$-$k!%%j%]%8%H%j$N(B
543 $B%m!<%+%k%/%m!<%s$O$H$F$b<j7Z$G!$%/%m!<%s$HGQ4~$K$[$H$s$I%*!<%P%X%C%I$,$J(B
544 $B$$!%(B
545
477 %In our \dirname{my-hello} repository, we have a file 546 %In our \dirname{my-hello} repository, we have a file
478 %\filename{hello.c} that contains the classic ``hello, world'' program. 547 %\filename{hello.c} that contains the classic ``hello, world'' program.
479 %Let's use the ancient and venerable \command{sed} command to edit this 548 %Let's use the ancient and venerable \command{sed} command to edit this
480 %file so that it prints a second line of output. (I'm only using 549 %file so that it prints a second line of output. (I'm only using
481 %\command{sed} to do this because it's easy to write a scripted example 550 %\command{sed} to do this because it's easy to write a scripted example
482 %this way. Since you're not under the same constraint, you probably 551 %this way. Since you're not under the same constraint, you probably
483 %won't want to use \command{sed}; simply use your preferred text editor to 552 %won't want to use \command{sed}; simply use your preferred text editor to
484 %do the same thing.) 553 %do the same thing.)
485 %\interaction{tour.sed} 554 %\interaction{tour.sed}
486 555
556 \dirname{my-hello}$B%j%]%8%H%jFb$K$O%/%i%7%C%/$J(B``hello, world''$B%W%m%0%i%`(B
557 $B$G$"$k(B\filename{hello.c}$B$,$"$k!%8E$/$5$/?987$J(B\command{sed}$B$rMQ$$$F(B2$B9TL\(B
558 $B$N=PNO$r9T$&$h$&$KJQ99$9$k!%!J(B\command{sed}$B$r;H$&$N$O%9%/%j%W%H$K$h$kNc$r(B
559 $B:n$k$N$,4JC1$@$+$i$K2a$.$J$$!%FI<T$^$G(B\command{sed}$B$r;H$&I,MW$O$J$/!$9%$-(B
560 $B$J%F%-%9%H%(%G%#%?$GJT=8$7$F$h$$!%!K(B
561 \interaction{tour.sed}
562
487 %Mercurial's \hgcmd{status} command will tell us what Mercurial knows 563 %Mercurial's \hgcmd{status} command will tell us what Mercurial knows
488 %about the files in the repository. 564 %about the files in the repository.
489 %\interaction{tour.status} 565 %\interaction{tour.status}
490 %The \hgcmd{status} command prints no output for some files, but a line 566 %The \hgcmd{status} command prints no output for some files, but a line
491 %starting with ``\texttt{M}'' for \filename{hello.c}. Unless you tell 567 %starting with ``\texttt{M}'' for \filename{hello.c}. Unless you tell
492 %it to, \hgcmd{status} will not print any output for files that have 568 %it to, \hgcmd{status} will not print any output for files that have
493 %not been modified. 569 %not been modified.
494 570
571 $B%j%]%8%H%jFb$N%U%!%$%k$KBP$7$F(BMercurial$B$,GD0.$7$F$$$kFbMF$r(B
572 \hgcmd{status}$B%3%^%s%I$G8+$k$3$H$,$G$-$k!%(B
573 \interaction{tour.status}
574 \hgcmd{status}$B%3%^%s%I$O$$$/$D$+$N%U%!%$%k$KBP$7$F$O=PNO$r9T$o$J$$$,!$(B
575 \filename{hello.c}$B$KBP$7$F(B``\texttt{M}''$B$rI=<($9$k!%FC$K;X<($r$7$J$$>l(B
576 $B9g!$(B\hgcmd{status}$B%3%^%s%I$OJQ99$5$l$F$$$J$$%U%!%$%k$KBP$7$F$O2?$b=PNO$7(B
577 $B$J$$!%(B
578
495 %The ``\texttt{M}'' indicates that Mercurial has noticed that we 579 %The ``\texttt{M}'' indicates that Mercurial has noticed that we
496 %modified \filename{hello.c}. We didn't need to \emph{inform} 580 %modified \filename{hello.c}. We didn't need to \emph{inform}
497 %Mercurial that we were going to modify the file before we started, or 581 %Mercurial that we were going to modify the file before we started, or
498 %that we had modified the file after we were done; it was able to 582 %that we had modified the file after we were done; it was able to
499 %figure this out itself. 583 %figure this out itself.
500 584
585 ``\texttt{M}''$B$N0UL#$O!$(B\filename{hello.c}$B$KBP$7$F9T$o$l$?JQ99$r(B
586 Mercurial$B$,GD0.$7$?$H$$$&$3$H$G$"$k!%%U%!%$%k$NJQ99A0$K(BMercurial$B$K$3$l$+(B
587 $B$iJQ99$9$k%U%!%$%k$rEPO?$9$kI,MW$O$J$$$7!$JQ998e$K9T$&I,MW$b$J$$!%JQ99$5(B
588 $B$l$?%U%!%$%k$NH/8+$O<+F0E*$K9T$o$l$k!%(B
589
501 %It's a little bit helpful to know that we've modified 590 %It's a little bit helpful to know that we've modified
502 %\filename{hello.c}, but we might prefer to know exactly \emph{what} 591 %\filename{hello.c}, but we might prefer to know exactly \emph{what}
503 %changes we've made to it. To do this, we use the \hgcmd{diff} 592 %changes we've made to it. To do this, we use the \hgcmd{diff}
504 %command. 593 %command.
505 %\interaction{tour.diff} 594 %\interaction{tour.diff}
506 595
596 \filename{hello.c}$B$rJT=8$7$?$3$H$,J,$+$k$N$OB?>/Lr$KN)$D$,!$CN$j$?$$$N$O(B
597 $B$`$7$m(B\emph{$B2?$r(B}$BJQ99$7$?$N$+$G$"$k!%(B\hgcmd{diff}$B%3%^%s%I$r;H$($P$3$l$rCN(B
598 $B$k$3$H$,$G$-$k!%(B \interaction{tour.diff}
599
507 %\section{Recording changes in a new changeset} 600 %\section{Recording changes in a new changeset}
508 \section{$B?7$?$J%A%'%s%8%;%C%H$XJQ99$r5-O?$9$k(B} 601 \section{$B?7$?$J%A%'%s%8%;%C%H$XJQ99$r5-O?$9$k(B}
509 602
510 %We can modify files, build and test our changes, and use 603 %We can modify files, build and test our changes, and use
511 %\hgcmd{status} and \hgcmd{diff} to review our changes, until we're 604 %\hgcmd{status} and \hgcmd{diff} to review our changes, until we're
512 %satisfied with what we've done and arrive at a natural stopping point 605 %satisfied with what we've done and arrive at a natural stopping point
513 %where we want to record our work in a new changeset. 606 %where we want to record our work in a new changeset.
514 607
608 $B%U%!%$%k$rJQ99$7!$%S%k%I$H%F%9%H$r9T$$!$(B\hgcmd{status}$B$H(B\hgcmd{diff}$B$r;H$C(B
609 $B$FJQ99$N%l%S%e!<$r9T$$!$5$$N:Q$`$H$3$m$^$G$3$l$r7+JV$7!$;E;v$N7k2L$r?7$?(B
610 $B$J%A%'%s%8%;%C%H$K5-O?$9$k!%(B
611
515 %The \hgcmd{commit} command lets us create a new changeset; we'll 612 %The \hgcmd{commit} command lets us create a new changeset; we'll
516 %usually refer to this as ``making a commit'' or ``committing''. 613 %usually refer to this as ``making a commit'' or ``committing''.
614
615 $B?7$?$J%A%'%s%8%;%C%H$r:n@.$9$k$K$O(B\hgcmd{commit}$B%3%^%s%I$r;H$&!%(B
616 $B$3$NA`:n$r$h$/(B``$B%3%_%C%H$9$k(B''$B$H$+(B``$B%3%_%C%H(B''$B$H8F$V!%(B
517 617
518 %\subsection{Setting up a username} 618 %\subsection{Setting up a username}
519 \subsection{$B%f!<%6L>$r@_Dj$9$k(B} 619 \subsection{$B%f!<%6L>$r@_Dj$9$k(B}
520 620
521 %When you try to run \hgcmd{commit} for the first time, it is not 621 %When you try to run \hgcmd{commit} for the first time, it is not
522 %guaranteed to succeed. Mercurial records your name and address with 622 %guaranteed to succeed. Mercurial records your name and address with
523 %each change that you commit, so that you and others will later be able 623 %each change that you commit, so that you and others will later be able
524 %to tell who made each change. Mercurial tries to automatically figure 624 %to tell who made each change. Mercurial tries to automatically figure
525 %out a sensible username to commit the change with. It will attempt 625 %out a sensible username to commit the change with. It will attempt
526 %each of the following methods, in order: 626 %each of the following methods, in order:
527 %\begin{enumerate} 627
628 $B:G=i$K(B\hgcmd{commit}$B$r<B9T$9$k>l9g!$<B9T$,@.8y$9$k$+$I$&$+$OJ]>Z$5$l$F$$(B
629 $B$J$$!%$9$Y$F$N%3%_%C%H$G(BMercurial$B$O%f!<%6$NL>A0$H%"%I%l%9$r5-O?$7!$8e$GC/(B
630 $B$,$=$NJQ99$r9T$C$?$N$+J,$+$k$h$&$K$7$F$$$k!%(B Mercurial$B$OJQ99$r%3%_%C%H$9(B
631 $B$k:]$K<+F0E*$KBEEv$J%f!<%6L>$rIU$1$h$&$H$9$k!%(B
632 $B%f!<%6L>$N?dB,$O0J2<$N$h$&$J=g=x$G9T$o$l$k!'(B
633 \begin{enumerate}
528 %\item If you specify a \hgopt{commit}{-u} option to the \hgcmd{commit} 634 %\item If you specify a \hgopt{commit}{-u} option to the \hgcmd{commit}
529 % command on the command line, followed by a username, this is always 635 % command on the command line, followed by a username, this is always
530 % given the highest precedence. 636 % given the highest precedence.
637 \item \hgcmd{commit}$B%3%^%s%I$K(B\hgopt{commit}{-u}$B%*%W%7%g%s$H%f!<%6L>$rIU(B
638 $B$1$?>l9g!$$3$l$,:G$bM%@h$5$l$k!%(B
531 %\item If you have set the \envar{HGUSER} environment variable, this is 639 %\item If you have set the \envar{HGUSER} environment variable, this is
532 % checked next. 640 % checked next.
641 \item $B4D6-JQ?t(B\envar{HGUSER}$B$r@_Dj$7$F$$$k>l9g$O<!$K$3$l$,;2>H$5$l$k!%(B
533 %\item If you create a file in your home directory called 642 %\item If you create a file in your home directory called
534 % \sfilename{.hgrc}, with a \rcitem{ui}{username} entry, that will be 643 % \sfilename{.hgrc}, with a \rcitem{ui}{username} entry, that will be
535 % used next. To see what the contents of this file should look like, 644 % used next. To see what the contents of this file should look like,
536 % refer to section~\ref{sec:tour-basic:username} below. 645 % refer to section~\ref{sec:tour-basic:username} below.
646 \item $B%[!<%`%G%#%l%/%H%j$K(B\sfilename{.hgrc}$B%U%!%$%k$r:n$C$F$$$k>l(B
647 $B9g!$(B\rcitem{ui}{username}$B%(%s%H%j$,<!$K;2>H$5$l$k!%$3$N%U%!%$%k$N(B
648 $BFbMF$O(B\ref{sec:tour-basic:username}$B@a$G@bL@$7$F$$$k!%(B
537 %\item If you have set the \envar{EMAIL} environment variable, this 649 %\item If you have set the \envar{EMAIL} environment variable, this
538 % will be used next. 650 % will be used next.
651 \item $B4D6-JQ?t(B\envar{EMAIL}$B$r@_Dj$7$F$$$k$J$i<!$K$3$l$,;2>H$5$l$k!%(B
539 %\item Mercurial will query your system to find out your local user 652 %\item Mercurial will query your system to find out your local user
540 % name and host name, and construct a username from these components. 653 % name and host name, and construct a username from these components.
541 % Since this often results in a username that is not very useful, it 654 % Since this often results in a username that is not very useful, it
542 % will print a warning if it has to do this. 655 % will print a warning if it has to do this.
543 %\end{enumerate} 656 \item Mercurial$B$O%7%9%F%`$K%m!<%+%k%f!<%6L>$H%[%9%HL>$rLd$$9g$o$;!$$3$l(B
657 $B$i$+$i%3%_%C%H%f!<%6L>$r9=@.$9$k!%$3$N%f!<%6L>$OLr$KN)$?$J$$$3$H$,(B
658 $BB?$$$?$a!$$3$NJ}K!$r;H$C$?>l9g$O7Y9p%a%C%;!<%8$,I=<($5$l$k!%(B
659 \end{enumerate}
544 %If all of these mechanisms fail, Mercurial will fail, printing an 660 %If all of these mechanisms fail, Mercurial will fail, printing an
545 %error message. In this case, it will not let you commit until you set 661 %error message. In this case, it will not let you commit until you set
546 %up a username. 662 %up a username.
663 $B$3$l$i$N%a%+%K%:%`$N$9$Y$F$,<:GT$7$?>l9g!$(BMercurial$B$O%(%i!<%a%C%;!<%8$r(B
664 $BI=<($7$F<B9T$rCGG0$9$k!%$3$N>l9g!$%f!<%6L>$r@_Dj$9$k$^$G%3%_%C%H$9$k$3$H(B
665 $B$O$G$-$J$$!%(B
547 666
548 %You should think of the \envar{HGUSER} environment variable and the 667 %You should think of the \envar{HGUSER} environment variable and the
549 %\hgopt{commit}{-u} option to the \hgcmd{commit} command as ways to 668 %\hgopt{commit}{-u} option to the \hgcmd{commit} command as ways to
550 %\emph{override} Mercurial's default selection of username. For normal 669 %\emph{override} Mercurial's default selection of username. For normal
551 %use, the simplest and most robust way to set a username for yourself 670 %use, the simplest and most robust way to set a username for yourself
552 %is by creating a \sfilename{.hgrc} file; see below for details. 671 %is by creating a \sfilename{.hgrc} file; see below for details.
672
673 $B4D6-JQ?t(B\envar{HGUSER}$B$H(B\hgcmd{commit}$B%3%^%s%I$N(B\hgopt{commit}{-u}$B%*%W%7%g(B
674 $B%s$O!$(BMercurial$B$,%G%U%)%k%H$G@_Dj$9$k%f!<%6L>$r(B\emph{$B%*!<%P%i%$%I(B}$B$9$kJ}(B
675 $BK!$@$H9M$($k$H$h$$!%DL>o$NMxMQK!$G%f!<%6L>$r@_Dj$9$k:G$b4JC1$G:G$b4h6/$J(B
676 $BJ}K!$O(B\sfilename{.hgrc}$B%U%!%$%k$r:n@.$9$k$3$H$G$"$k!%$3$N$d$jJ}$K$D$$$F<!(B
677 $B$K=R$Y$k!%(B
553 678
554 %\subsubsection{Creating a Mercurial configuration file} 679 %\subsubsection{Creating a Mercurial configuration file}
555 \subsubsection{Mercurial$B$N@_Dj%U%!%$%k$r:n@.$9$k(B} 680 \subsubsection{Mercurial$B$N@_Dj%U%!%$%k$r:n@.$9$k(B}
556 \label{sec:tour-basic:username} 681 \label{sec:tour-basic:username}
557 682
569 %the value of the \texttt{username} item in the \texttt{ui} section''. 694 %the value of the \texttt{username} item in the \texttt{ui} section''.
570 %A section continues until a new section begins, or the end of the 695 %A section continues until a new section begins, or the end of the
571 %file. Mercurial ignores empty lines and treats any text from 696 %file. Mercurial ignores empty lines and treats any text from
572 %``\texttt{\#}'' to the end of a line as a comment. 697 %``\texttt{\#}'' to the end of a line as a comment.
573 698
699 $B%f!<%6L>$r@_Dj$9$k$K$O9%$_$N%(%G%#%?$G%[!<%`%G%#%l%/%H%j$K(B
700 \sfilename{.hgrc}$B$H$$$&%U%!%$%k$r:n@.$9$k!%(B Mercurial$B$O$3$N%U%!%$%k$+$i8D(B
701 $B?M@_Dj$r<hF@$7!$;HMQ$9$k!%(B\sfilename{.hgrc}$B%U%!%$%k$N:G=i$NFbMF$O0J2<$N$h(B
702 $B$&$J=q<0$K$9$k!%(B
703 \begin{codesample2}
704 # This is a Mercurial configuration file.
705 [ui]
706 username = Firstname Lastname <email.address@domain.net>
707 \end{codesample2}
708 ``\texttt{[ui]}''$B$N9T$G@_Dj%U%!%$%k$N(B\emph{$B%;%/%7%g%s(B}$B$,;O$^$k!%(B
709 ``\texttt{username = ...}''$B$N9T$O(B``\texttt{ui}$B%;%/%7%g%s$N(B
710 \texttt{username}$B9`L\$NCM$r@_Dj$9$k(B''$B$HFI$`$3$H$,$G$-$k!%(B
711 $B%;%/%7%g%s$O?7$?$JJL$N%;%/%7%g%s$,;O$^$k$+!$%U%!%$%k$,=*N;$9$k$^$GB3(B
712 $B$/!%(BMercurial$B$O6u9T$rL5;k$7!$(B``\texttt{\#}''$B$+$i9TKv$^$G$r%3%a%s%H$H$7$F(B
713 $B07$&!%(B
714
574 %\subsubsection{Choosing a user name} 715 %\subsubsection{Choosing a user name}
575 \subsubsection{$B%f!<%6L>$rA*$V(B} 716 \subsubsection{$B%f!<%6L>$rA*$V(B}
576 717
577 %You can use any text you like as the value of the \texttt{username} 718 %You can use any text you like as the value of the \texttt{username}
578 %config item, since this information is for reading by other people, 719 %config item, since this information is for reading by other people,
579 %but for interpreting by Mercurial. The convention that most people 720 %but for interpreting by Mercurial. The convention that most people
580 %follow is to use their name and email address, as in the example 721 %follow is to use their name and email address, as in the example
581 %above. 722 %above.
582 723
583 %\begin{note} 724 \texttt{username}$B$N@_Dj$K;HMQ$9$kJ8;zNs$O!$$3$l$,(BMercurial$B$K$h$C$F=hM}$5(B
725 $B$l$k$H$$$&E@$r=|$1$P!$C1$KB>$N%f!<%6$,FI$`$H$$$&$@$1$N>pJs$G$"$k$3$H$+(B
726 $B$i!$$I$N$h$&$JJ8;zNs$G$b9=$o$J$$!%B?$/$N%f!<%6$,=>$&=,47$O!$>e$NNc$N$h$&(B
727 $B$KL>A0$H(Bemail$B%"%I%l%9$r;H$&$b$N$G$"$k!%(B
728
729 \begin{note}
584 % Mercurial's built-in web server obfuscates email addresses, to make 730 % Mercurial's built-in web server obfuscates email addresses, to make
585 % it more difficult for the email harvesting tools that spammers use. 731 % it more difficult for the email harvesting tools that spammers use.
586 % This reduces the likelihood that you'll start receiving more junk 732 % This reduces the likelihood that you'll start receiving more junk
587 % email if you publish a Mercurial repository on the web. 733 % email if you publish a Mercurial repository on the web.
588 %\end{note} 734 Mercurial$B$NAH$_9~$_%&%'%V%5!<%P$O(Bemail$B%"%I%l%9$r%9%Q%^!<$,;H$&(Bemail$B<}=&%D!<(B
735 $B%k$K=&$o$lFq$/$9$k$h$&$K2~JQ$7!$(BMercurial$B%j%]%8%H%j$r%&%'%V$G8x3+$7$F$b%9(B
736 $B%Q%`$r<u$1<h$jFq$/$7$F$$$k!%(B
737 \end{note}
589 738
590 %\subsection{Writing a commit message} 739 %\subsection{Writing a commit message}
591 \subsection{$B%3%_%C%H%a%C%;!<%8$r=q$/(B} 740 \subsection{$B%3%_%C%H%a%C%;!<%8$r=q$/(B}
592 741
593 %When we commit a change, Mercurial drops us into a text editor, to 742 %When we commit a change, Mercurial drops us into a text editor, to
594 %enter a message that will describe the modifications we've made in 743 %enter a message that will describe the modifications we've made in
595 %this changeset. This is called the \emph{commit message}. It will be 744 %this changeset. This is called the \emph{commit message}. It will be
596 %a record for readers of what we did and why, and it will be printed by 745 %a record for readers of what we did and why, and it will be printed by
597 %\hgcmd{log} after we've finished committing. 746 %\hgcmd{log} after we've finished committing.
598 %\interaction{tour.commit} 747 %\interaction{tour.commit}
748
749 $BJQ99$r%3%_%C%H$9$k;~!$(BMercurial$B$O%A%'%s%8%;%C%H$G9T$C$?JQ99$K$D$$$F@bL@$9(B
750 $B$k%a%C%;!<%8$rF~NO$5$;$k$?$a$K%F%-%9%H%(%G%#%?$r5/F0$9$k!%(B
751 $B$3$l$O(B\emph{$B%3%_%C%H%a%C%;!<%8(B}$B$H8F$P$l$k!%(B
752 $B$3$l$O2?$r$J$<JQ99$7$?$N$+FI$_<j$KEA$($k$b$N$G!$%3%_%C%H40N;8e$K(B
753 \hgcmd{log}$B$GI=<($9$k$3$H$,$G$-$k!%(B
754 \interaction{tour.commit}
599 755
600 %The editor that the \hgcmd{commit} command drops us into will contain 756 %The editor that the \hgcmd{commit} command drops us into will contain
601 %an empty line, followed by a number of lines starting with 757 %an empty line, followed by a number of lines starting with
602 %``\texttt{HG:}''. 758 %``\texttt{HG:}''.
603 %\begin{codesample2} 759 %\begin{codesample2}
606 %\end{codesample2} 762 %\end{codesample2}
607 %Mercurial ignores the lines that start with ``\texttt{HG:}''; it uses 763 %Mercurial ignores the lines that start with ``\texttt{HG:}''; it uses
608 %them only to tell us which files it's recording changes to. Modifying 764 %them only to tell us which files it's recording changes to. Modifying
609 %or deleting these lines has no effect. 765 %or deleting these lines has no effect.
610 766
767 \hgcmd{commit}$B%3%^%s%I$,5/F0$9$k%(%G%#%?$O!$6u9T$H(B``\texttt{HG:}''$B$G;O$^(B
768 $B$k?t9T$r$9$G$K4^$s$G$$$k!%(B
769 \begin{codesample2}
770 \emph{empty line}
771 HG: changed hello.c
772 \end{codesample2}
773 Mercurial$B$O(B``\texttt{HG:}''$B$G;O$^$k9T$rL5;k$9$k!%$3$l$i$N9T$O$I$N%U%!%$%k(B
774 $B$X$NJQ99$J$N$+$r%f!<%6$KEA$($k$@$1$NL\E*$GB8:_$9$k!%$3$l$i$N9T$rJQ99$7$?(B
775 $B$j>C5n$7$?$j$7$F$b2?$N1F6A$bM?$($J$$!%(B
776
611 %\subsection{Writing a good commit message} 777 %\subsection{Writing a good commit message}
612 \subsection{$B$h$$%3%_%C%H%a%C%;!<%8$N=q$-J}(B} 778 \subsection{$B$h$$%3%_%C%H%a%C%;!<%8$N=q$-J}(B}
613 779
614 %Since \hgcmd{log} only prints the first line of a commit message by 780 %Since \hgcmd{log} only prints the first line of a commit message by
615 %default, it's best to write a commit message whose first line stands 781 %default, it's best to write a commit message whose first line stands
620 % user: Censored Person <censored.person@example.org> 786 % user: Censored Person <censored.person@example.org>
621 % date: Tue Sep 26 21:37:07 2006 -0700 787 % date: Tue Sep 26 21:37:07 2006 -0700
622 % summary: include buildmeister/commondefs. Add an exports and install 788 % summary: include buildmeister/commondefs. Add an exports and install
623 %\end{codesample2} 789 %\end{codesample2}
624 790
791 $B%G%U%)%k%H$G$O(B\hgcmd{log}$B$O%3%_%C%H%a%C%;!<%8$N:G=i$N9T$7$+I=<($7$J$$$?$a(B
792 $B%3%_%C%H%a%C%;!<%8$N:G=i$N9T$O(B1$B9T$G407k$9$k$h$&$K=q$/$H$h$$!%(B
793 $B%,%$%I%i%$%s$K(B\emph{$B=>$o$J$$(B}$B$?$aFI$a$J$$%3%_%C%H%a%C%;!<%8$NNc$r<($9!%(B
794 \begin{codesample2}
795 changeset: 73:584af0e231be
796 user: Censored Person <censored.person@example.org>
797 date: Tue Sep 26 21:37:07 2006 -0700
798 summary: include buildmeister/commondefs. Add an exports and install
799 \end{codesample2}
800
625 %As far as the remainder of the contents of the commit message are 801 %As far as the remainder of the contents of the commit message are
626 %concerned, there are no hard-and-fast rules. Mercurial itself doesn't 802 %concerned, there are no hard-and-fast rules. Mercurial itself doesn't
627 %interpret or care about the contents of the commit message, though 803 %interpret or care about the contents of the commit message, though
628 %your project may have policies that dictate a certain kind of 804 %your project may have policies that dictate a certain kind of
629 %formatting. 805 %formatting.
630 806
807 $B%3%_%C%H%a%C%;!<%8$N;D$j$NItJ,$K$O873J$J%k!<%k$O$J$$!%%W%m%8%'%/%H$G%U%)!<(B
808 $B%^%C%H$K4X$7$FMW5a$9$k%]%j%7!<$,$"$C$?$H$7$F$b!$(BMercurial$B$O%3%_%C%H%a%C%;!<(B
809 $B%8$rCfCG$7$?$j!$FCJL$NG[N8$r$9$k$3$H$O$J$$!%(B
810
631 %My personal preference is for short, but informative, commit messages 811 %My personal preference is for short, but informative, commit messages
632 %that tell me something that I can't figure out with a quick glance at 812 %that tell me something that I can't figure out with a quick glance at
633 %the output of \hgcmdargs{log}{--patch}. 813 %the output of \hgcmdargs{log}{--patch}.
814
815 $B8D?ME*$K$O!$4J7i$+$D>pJs$,$"$j!$(B \hgcmdargs{log}{--patch}$B$r0l8+$7$?$@$1$G(B
816 $B$O$o$+$i$J$$ItJ,$K$D$$$F@bL@$7$?%3%_%C%H%a%C%;!<%8$,9%$_$G$"$k!%(B
634 817
635 %\subsection{Aborting a commit} 818 %\subsection{Aborting a commit}
636 \subsection{$B%3%_%C%H$rCf;_$9$k(B} 819 \subsection{$B%3%_%C%H$rCf;_$9$k(B}
637 820
638 %If you decide that you don't want to commit while in the middle of 821 %If you decide that you don't want to commit while in the middle of
639 %editing a commit message, simply exit from your editor without saving 822 %editing a commit message, simply exit from your editor without saving
640 %the file that it's editing. This will cause nothing to happen to 823 %the file that it's editing. This will cause nothing to happen to
641 %either the repository or the working directory. 824 %either the repository or the working directory.
642 825
826 $B%3%_%C%H%a%C%;!<%8$rJT=8Cf$K%3%_%C%H$r<h$j;_$a$?$/$J$C$?;~$O!$JT=8Cf$N%U%!(B
827 $B%$%k$r%;!<%V$;$:$K%(%G%#%?$r=*N;$9$l$P$h$$!%$3$&$9$k$H%j%]%8%H%j$K$b%o!<(B
828 $B%-%s%0%G%#%l%/%H%j$K$b2?$b5/$-$J$$!%(B
829
643 %If we run the \hgcmd{commit} command without any arguments, it records 830 %If we run the \hgcmd{commit} command without any arguments, it records
644 %all of the changes we've made, as reported by \hgcmd{status} and 831 %all of the changes we've made, as reported by \hgcmd{status} and
645 %\hgcmd{diff}. 832 %\hgcmd{diff}.
833
834 \hgcmd{commit}$B%3%^%s%I$r0z?t$J$7$G<B9T$7$F$$$k>l9g!$(B\hgcmd{status}$B%3%^%s(B
835 $B%I$d(B\hgcmd{diff}$B%3%^%s%I$K8=$l$k$=$l$^$G$K9T$C$?JQ99$OJ]B8$5$l$k!%(B
646 836
647 %\subsection{Admiring our new handiwork} 837 %\subsection{Admiring our new handiwork}
648 \subsection{$B?7$?$J:n6H$r>N;?$9$k(B} 838 \subsection{$B?7$?$J:n6H$r>N;?$9$k(B}
649 839
650 %Once we've finished the commit, we can use the \hgcmd{tip} command to 840 %Once we've finished the commit, we can use the \hgcmd{tip} command to
653 %revision in the repository. 843 %revision in the repository.
654 %\interaction{tour.tip} 844 %\interaction{tour.tip}
655 %We refer to the newest revision in the repository as the tip revision, 845 %We refer to the newest revision in the repository as the tip revision,
656 %or simply the tip. 846 %or simply the tip.
657 847
848 $B%3%_%C%H$N40N;8e!$(B\hgcmd{tip}$B%3%^%s%I$G:#:n@.$7$?%A%'%s%8%;%C%H$rCN$k$3$H(B
849 $B$,$G$-$k!%$3$N%3%^%s%I$N=PNO$O%j%]%8%H%j$N:G?7%j%S%8%g%s$N$_$rI=<($9$k$H(B
850 $B$$$&E@$r=|$1$P(B\hgcmd{log}$B$HA4$/F1$8$G$"$k!%(B
851 \interaction{tour.tip}
852 $B%j%]%8%H%j$N:G?7%j%S%8%g%s$O(Btip$B%j%S%8%g%s$^$?$OC1$K(Btip$B$H8F$P$l$k!%(B
853
658 %\section{Sharing changes} 854 %\section{Sharing changes}
659 \section{$BJQ99$r6&M-$9$k(B} 855 \section{$BJQ99$r6&M-$9$k(B}
660 856
661 %We mentioned earlier that repositories in Mercurial are 857 %We mentioned earlier that repositories in Mercurial are
662 %self-contained. This means that the changeset we just created exists 858 %self-contained. This means that the changeset we just created exists
663 %only in our \dirname{my-hello} repository. Let's look at a few ways 859 %only in our \dirname{my-hello} repository. Let's look at a few ways
664 %that we can propagate this change into other repositories. 860 %that we can propagate this change into other repositories.
665 861
862 Mercurial$B$N%j%]%8%H%j$O<+8J=<B-E*$G$"$k$H$9$G$K=R$Y$?!%$D$^$j!$:#:n@.$7$?(B
863 $B%A%'%s%8%;%C%H$O(B\dirname{my-hello}$B%j%]%8%H%j$K$N$_B8:_$7$F$$$k!%$3$NJQ99(B
864 $B$rB>$N%j%]%8%H%j$KGH5Z$5$;$k$$$/$D$+$NJ}K!$r8+$F$_$h$&!%(B
865
666 %\subsection{Pulling changes from another repository} 866 %\subsection{Pulling changes from another repository}
667 \subsection{$BB>$N%j%]%8%H%j$+$iJQ99$r(Bpull$B$9$k(B} 867 \subsection{$BB>$N%j%]%8%H%j$+$iJQ99$r(Bpull$B$9$k(B}
668 \label{sec:tour:pull} 868 \label{sec:tour:pull}
669 869
670 %To get started, let's clone our original \dirname{hello} repository, 870 %To get started, let's clone our original \dirname{hello} repository,
671 %which does not contain the change we just committed. We'll call our 871 %which does not contain the change we just committed. We'll call our
672 %temporary repository \dirname{hello-pull}. 872 %temporary repository \dirname{hello-pull}.
673 %\interaction{tour.clone-pull} 873 %\interaction{tour.clone-pull}
874
875 $B;O$a$k$KEv$?$C$F!$:#%3%_%C%H$7$?JQ99$r4^$^$J$$%*%j%8%J%k$N(B
876 \dirname{hello}$B%j%]%8%H%j$r%/%m!<%s$9$k!%$3$N0l;~E*$J%j%]%8%H%j$r(B
877 \dirname{hello-pull}$B$H8F$V$3$H$K$9$k!%(B
878 \interaction{tour.clone-pull}
674 879
675 %We'll use the \hgcmd{pull} command to bring changes from 880 %We'll use the \hgcmd{pull} command to bring changes from
676 %\dirname{my-hello} into \dirname{hello-pull}. However, blindly 881 %\dirname{my-hello} into \dirname{hello-pull}. However, blindly
677 %pulling unknown changes into a repository is a somewhat scary 882 %pulling unknown changes into a repository is a somewhat scary
678 %prospect. Mercurial provides the \hgcmd{incoming} command to tell us 883 %prospect. Mercurial provides the \hgcmd{incoming} command to tell us
682 %(Of course, someone could cause more changesets to appear in the 887 %(Of course, someone could cause more changesets to appear in the
683 %repository that we ran \hgcmd{incoming} in, before we get a chance to 888 %repository that we ran \hgcmd{incoming} in, before we get a chance to
684 %\hgcmd{pull} the changes, so that we could end up pulling changes that we 889 %\hgcmd{pull} the changes, so that we could end up pulling changes that we
685 %didn't expect.) 890 %didn't expect.)
686 891
892 \hgcmd{pull}$B%3%^%s%I$GJQ99$r(B\dirname{my-hello}$B$+$i(B\dirname{hello-pull}$B$K(B
893 $B<h$j9~$`!%L$CN$NJQ99$rLUL\E*$K%j%]%8%H%j$K(Bpull$B$9$k$3$H$O>/!962$m$7(B
894 $B$$!%(BMercurial$B$K$O(B\hgcmd{pull}$B%3%^%s%I$G$I$N$h$&$JJQ99$,%j%]%8%H%j$K<h$j9~(B
895 $B$^$l$k$N$+$r<B:]$K$O(Bpull$B$9$k$3$H$J$/I=<($9$k(B\hgcmd{incoming}$B%3%^%s%I$,$"(B
896 $B$k!%(B
897 \interaction{tour.incoming}
898 $B!J$b$A$m$s(B\hgcmd{incoming}$B$r<B9T$7$F$+$i<B:]$K(B\hgcmd{pull}$B$9$k$^$G$N4V$K(B
899 $BC/$+$,?7$?$J%A%'%s%8%;%C%H$rDI2C$7!$$=$N7k2L!$M=4|$7$J$$%A%'%s%8%;%C%H$r(B
900 pull$B$7$F$7$^$&2DG=@-$O$"$k!%!K(B
901
687 %Bringing changes into a repository is a simple matter of running the 902 %Bringing changes into a repository is a simple matter of running the
688 %\hgcmd{pull} command, and telling it which repository to pull from. 903 %\hgcmd{pull} command, and telling it which repository to pull from.
689 %\interaction{tour.pull} 904 %\interaction{tour.pull}
690 %As you can see from the before-and-after output of \hgcmd{tip}, we 905 %As you can see from the before-and-after output of \hgcmd{tip}, we
691 %have successfully pulled changes into our repository. There remains 906 %have successfully pulled changes into our repository. There remains
692 %one step before we can see these changes in the working directory. 907 %one step before we can see these changes in the working directory.
908
909 $BJQ99$r%j%]%8%H%j$K<h$j9~$`$N$O!$<h$j9~$_85$N%j%]%8%H%j$r;XDj$7$F(B
910 \hgcmd{pull}$B%3%^%s%I$r<B9T$9$k$@$1$N%7%s%W%k$JA`:n$G$"$k!%(B
911 \interaction{tour.pull}
912 pull$B$NA08e$N(B\hgcmd{tip}$B=PNO$G%j%]%8%H%j$X$NJQ99$N<h$j9~$_$K@.8y$7$?$+$I$&(B
913 $B$+$,$o$+$k!%%o!<%-%s%0%G%#%l%/%H%j$KJQ99$rH?1G$5$;$k$K$O$b$&(B1$B%9%F%C%W$,I,(B
914 $BMW$G$"$k!%(B
693 915
694 %\subsection{Updating the working directory} 916 %\subsection{Updating the working directory}
695 \subsection{$B%o!<%-%s%0%G%#%l%/%H%j$r99?7$9$k(B} 917 \subsection{$B%o!<%-%s%0%G%#%l%/%H%j$r99?7$9$k(B}
696 918
697 %We have so far glossed over the relationship between a repository and 919 %We have so far glossed over the relationship between a repository and
701 %directory. This is because \hgcmd{pull} does not (by default) touch 923 %directory. This is because \hgcmd{pull} does not (by default) touch
702 %the working directory. Instead, we use the \hgcmd{update} command to 924 %the working directory. Instead, we use the \hgcmd{update} command to
703 %do this. 925 %do this.
704 %\interaction{tour.update} 926 %\interaction{tour.update}
705 927
928 $B$3$3$^$G$O%j%]%8%H%j$H%o!<%-%s%0%G%#%l%/%H%j$N4X78$r$"$^$jL@3N$K$;$:$KMh(B
929 $B$?!%(B \ref{sec:tour:pull}$B@a$G(B\hgcmd{pull}$B%3%^%s%I$r;H$C$FJQ99$r%j%]%8%H%j(B
930 $B$K<h$j9~$s$@$,!$Cm0U?<$/8+$k$H!$$=$l$i$NJQ99$O%o!<%-%s%0%G%#%l%/%H%j$KH?(B
931 $B1G$5$l$F$$$J$+$C$?!%$3$l$O!$(B\hgcmd{pull}$B%3%^%s%I$O!J%G%U%)%k%H$G$O!K%o!<(B
932 $B%-%s%0%G%#%l%/%H%j$K<j$rIU$1$J$$$?$a$G$"$k!%%o!<%-%s%0%G%#%l%/%H%j$rA`:n(B
933 $B$9$k$?$a$K$O(B\hgcmd{update}$B%3%^%s%I$r;H$&!%(B
934 \interaction{tour.update}
935
706 %It might seem a bit strange that \hgcmd{pull} doesn't update the 936 %It might seem a bit strange that \hgcmd{pull} doesn't update the
707 %working directory automatically. There's actually a good reason for 937 %working directory automatically. There's actually a good reason for
708 %this: you can use \hgcmd{update} to update the working directory to 938 %this: you can use \hgcmd{update} to update the working directory to
709 %the state it was in at \emph{any revision} in the history of the 939 %the state it was in at \emph{any revision} in the history of the
710 %repository. If you had the working directory updated to an old 940 %repository. If you had the working directory updated to an old
711 %revision---to hunt down the origin of a bug, say---and ran a 941 %revision---to hunt down the origin of a bug, say---and ran a
712 %\hgcmd{pull} which automatically updated the working directory to a 942 %\hgcmd{pull} which automatically updated the working directory to a
713 %new revision, you might not be terribly happy. 943 %new revision, you might not be terribly happy.
944
945 \hgcmd{pull}$B$,%o!<%-%s%0%G%#%l%/%H%j$r<+F0E*$K99?7$7$J$$$N$O$$$5$5$+4qL/(B
946 $B$K8+$($k$+$b$7$l$J$$!%$7$+$7$3$l$K$O$A$c$s$H$7$?M}M3$,$"$k!%%o!<%-%s%0%G%#(B
947 $B%l%/%H%j$O(B\hgcmd{update}$B$G%j%]%8%H%j$N$$$+$J$k%P!<%8%g%s$K$b99?7$G$-$k!%(B
948 $B%P%0$N860x$rC5$k$?$a$K%o!<%-%s%0%G%#%l%/%H%j$r8E$$%j%S%8%g%s$K$7$F$$$k;~!$(B
949 \hgcmd{pull}$B$r<B9T$7$?$?$a$K%o!<%-%s%0%G%#%l%/%H%j$,:G?7$N%j%S%8%g%s$K$J$C(B
950 $B$?$H$7$?$i!$<u$1$kHo32$O>/$J$/$J$$!%(B
714 951
715 %However, since pull-then-update is such a common thing to do, 952 %However, since pull-then-update is such a common thing to do,
716 %Mercurial lets you combine the two by passing the \hgopt{pull}{-u} 953 %Mercurial lets you combine the two by passing the \hgopt{pull}{-u}
717 %option to \hgcmd{pull}. 954 %option to \hgcmd{pull}.
718 %\begin{codesample2} 955 %\begin{codesample2}
724 %an explicit step to update the working directory: 961 %an explicit step to update the working directory:
725 %\begin{codesample2} 962 %\begin{codesample2}
726 % (run 'hg update' to get a working copy) 963 % (run 'hg update' to get a working copy)
727 %\end{codesample2} 964 %\end{codesample2}
728 965
966 $B$7$+$7$J$,$i!$!V(Bpull$B8e$K99?7!W$H$$$&A`:n$O$H$F$b$h$/9T$o$l$k$?$a!$(B
967 \hgcmd{pull}$B%3%^%s%I$K$O$3$l$i(B2$B$D$NA`:n$r0lEY$K9T$&%*%W%7%g%s!$(B
968 \hgopt{pull}{-u}$B$,$"$k!%(B
969 \begin{codesample2}
970 hg pull -u
971 \end{codesample2}
972 \ref{sec:tour:pull}$B@a$G(B\hgopt{pull}{-u}$B%*%W%7%g%s$J$7$G<B9T$5$l$F$$$k(B
973 \hgcmd{pull}$B%3%^%s%I$N=PNO$r2~$a$F8+$F$_$k$H!$%o!<%-%s%0%G%#%l%/%H%j$r(B
974 $BL@<(E*$K99?7$7$J$1$l$P$J$i$J$$$3$H$r<($9(B
975 \begin{codesample2}
976 (run 'hg update' to get a working copy)
977 \end{codesample2}
978 $B$H$$$&Cm0U=q$-$,$"$k$N$K5$$E$/!%(B
979
729 %To find out what revision the working directory is at, use the 980 %To find out what revision the working directory is at, use the
730 %\hgcmd{parents} command. 981 %\hgcmd{parents} command.
731 %\interaction{tour.parents} 982 %\interaction{tour.parents}
732 %If you look back at figure~\ref{fig:tour-basic:history}, you'll see 983 %If you look back at figure~\ref{fig:tour-basic:history}, you'll see
733 %arrows connecting each changeset. The node that the arrow leads 984 %arrows connecting each changeset. The node that the arrow leads
734 %\emph{from} in each case is a parent, and the node that the arrow 985 %\emph{from} in each case is a parent, and the node that the arrow
735 %leads \emph{to} is its child. The working directory has a parent in 986 %leads \emph{to} is its child. The working directory has a parent in
736 %just the same way; this is the changeset that the working directory 987 %just the same way; this is the changeset that the working directory
737 %currently contains. 988 %currently contains.
738 989
990 $B%o!<%-%s%0%G%#%l%/%H%j$N8=:_$N%j%S%8%g%s$rD4$Y$k$K$O(B\hgcmd{parents}$B%3%^(B
991 $B%s%I$r;H$&!%(B
992 \interaction{tour.parents}
993 $B?^(B~\ref{fig:tour-basic:history}$B$r8+D>$9$H!$3F!9$N%A%'%s%8%;%C%H$r7k$VLp0u(B
994 $B$,$"$k!%Lp0u$N=P$F$$$k$H$3$m$,?F$G!$Lp0u$,<($7$F$$$k$H$3$m$,;R$G$"$k!%%o!<(B
995 $B%-%s%0%G%#%l%/%H%j$OF1MM$K(B1$B$D$N?F$r;}$A!$$3$l$,%o!<%-%s%0%G%#%l%/%H%j$,8=(B
996 $B:_99?7$5$l$F$$$k%A%'%s%8%;%C%H$G$"$k!%(B
997
739 %To update the working directory to a particular revision, give a 998 %To update the working directory to a particular revision, give a
740 %revision number or changeset~ID to the \hgcmd{update} command. 999 %revision number or changeset~ID to the \hgcmd{update} command.
741 %\interaction{tour.older} 1000 %\interaction{tour.older}
742 %If you omit an explicit revision, \hgcmd{update} will update to the 1001 %If you omit an explicit revision, \hgcmd{update} will update to the
743 %tip revision, as shown by the second call to \hgcmd{update} in the 1002 %tip revision, as shown by the second call to \hgcmd{update} in the
744 %example above. 1003 %example above.
1004
1005 $BFCDj$N%j%S%8%g%s$K%o!<%-%s%0%G%#%l%/%H%j$r99?7$9$k$?$a$K(B
1006 $B$O!$(B\hgcmd{update}$B%3%^%s%I$K%j%S%8%g%sHV9f$^$?$O%A%'%s%8%;%C%H(BID$B$rEO$9!%(B
1007 \interaction{tour.older}
1008 $BL@<(E*$K%j%S%8%g%s$rEO$5$J$+$C$?>l9g!$>e$NNc$G(B2$B2sL\$N(B\hgcmd{update}$B$N<B9T(B
1009 $B$N$h$&$K(B\hgcmd{update}$B%3%^%s%I$O%o!<%-%s%0%G%#%l%/%H%j$r(Btip$B%j%S%8%g%s$X99(B
1010 $B?7$9$k!%(B
745 1011
746 %\subsection{Pushing changes to another repository} 1012 %\subsection{Pushing changes to another repository}
747 \subsection{$BB>$N%j%]%8%H%j$KJQ99$r(Bpush$B$9$k(B} 1013 \subsection{$BB>$N%j%]%8%H%j$KJQ99$r(Bpush$B$9$k(B}
748 1014
749 %Mercurial lets us push changes to another repository, from the 1015 %Mercurial lets us push changes to another repository, from the
759 %As with \hgcmd{pull}, the \hgcmd{push} command does not update the 1025 %As with \hgcmd{pull}, the \hgcmd{push} command does not update the
760 %working directory in the repository that it's pushing changes into. 1026 %working directory in the repository that it's pushing changes into.
761 %(Unlike \hgcmd{pull}, \hgcmd{push} does not provide a \texttt{-u} 1027 %(Unlike \hgcmd{pull}, \hgcmd{push} does not provide a \texttt{-u}
762 %option that updates the other repository's working directory.) 1028 %option that updates the other repository's working directory.)
763 1029
1030 Mercurial$B$G$O8=:_;HMQ$7$F$$$k%j%]%8%H%j$+$iB>$N%j%]%8%H%j$KJQ99$r(Bpush$B$9$k(B
1031 $B$3$H$,$G$-$k!%A0=R$N(B\hgcmd{pull}$B%3%^%s%I$N$h$&$K!$0l;~E*$J%j%]%8%H%j$r:n$C(B
1032 $B$F$=$3$KJQ99$r(Bpush$B$7$F$_$h$&!%(B
1033 \interaction{tour.clone-push}
1034 $BB>$N%j%]%8%H%j$K(Bpush$B$5$l$kJQ99$O(B\hgcmd{outgoing}$B%3%^%s%I$GCN$k$3$H$,$G$-(B
1035 $B$k!%(B
1036 \interaction{tour.outgoing}
1037 \hgcmd{push}$B%3%^%s%I$G<B:]$K(Bpush$B$r9T$&!%(B
1038 \interaction{tour.push}
1039 \hgcmd{pull}$B%3%^%s%I$HF1MM$K!$(B\hgcmd{push}$B%3%^%s%I$O(Bpush$B@h$N%j%]%8%H%j$N(B
1040 $B%o!<%-%s%0%G%#%l%/%H%j$N99?7$r9T$o$J$$!%!J(B\hgcmd{pull}$B%3%^%s%I$H0c$C$F(B
1041 \hgcmd{push}$B%3%^%s%I$O!$%o!<%-%s%0%G%#%l%/%H%j$N99?7$r9T$&(B\texttt{-u}$B%*%W(B
1042 $B%7%g%s$r;}$?$J$$!%!K(B
1043
764 %What happens if we try to pull or push changes and the receiving 1044 %What happens if we try to pull or push changes and the receiving
765 %repository already has those changes? Nothing too exciting. 1045 %repository already has those changes? Nothing too exciting.
766 %\interaction{tour.push.nothing} 1046 %\interaction{tour.push.nothing}
1047
1048 $B%j%]%8%H%j$,$"$kJQ99$r$9$G$K;}$C$F$$$k$H$-!$F1$8JQ99$r(Bpull$B$^$?$O(Bpush$B$7$h(B
1049 $B$&$H$9$k$H2?$,5/$-$k$@$m$&$+!)FC$K6C$/$h$&$J$3$H$O5/$-$J$$!%(B
1050 \interaction{tour.push.nothing}
767 1051
768 %\subsection{Sharing changes over a network} 1052 %\subsection{Sharing changes over a network}
769 \subsection{$BJQ99$r%M%C%H%o!<%/$rDL$8$F6&M-$9$k(B} 1053 \subsection{$BJQ99$r%M%C%H%o!<%/$rDL$8$F6&M-$9$k(B}
770 1054
771 %The commands we have covered in the previous few sections are not 1055 %The commands we have covered in the previous few sections are not
776 %In this example, we can see what changes we could push to the remote 1060 %In this example, we can see what changes we could push to the remote
777 %repository, but the repository is understandably not set up to let 1061 %repository, but the repository is understandably not set up to let
778 %anonymous users push to it. 1062 %anonymous users push to it.
779 %\interaction{tour.push.net} 1063 %\interaction{tour.push.net}
780 1064
781 1065 $B$3$l$h$jA0$N$$$/$D$+$N@a$G07$C$?%3%^%s%I$O!$%m!<%+%k%j%]%8%H%j$@$1$K8BDj(B
782 1066 $B$5$l$J$$!%$I$N%3%^%s%I$b%M%C%H%o!<%/7PM3$G$bA4$/F1$8$KF0:n$9$k!%0c$$$O%m!<(B
1067 $B%+%k%Q%9$NBe$o$j$K(BURL$B$rEO$9$@$1$G$"$k!%(B
1068 \interaction{tour.outgoing.net}
1069 $B$3$NNc$G$O!$%j%]!<%H%j%]%8%H%j$K(Bpush$B$7$h$&$H$9$k$,!$EvA3$N$3$H$J$,$iF?L>(B
1070 $B$N%f!<%6$K(Bpush$B$r5v2D$7$J$$$h$&$K@_Dj$5$l$F$$$k$?$a!$(Bpush$B$G$-$J$$!%(B
1071 \interaction{tour.push.net}
783 1072
784 %%% Local Variables: 1073 %%% Local Variables:
785 %%% mode: yatex 1074 %%% mode: yatex
786 %%% TeX-master: "00book" 1075 %%% TeX-master: "00book"
787 %%% End: 1076 %%% End: