Mercurial > hgbook
comparison en/ch02-tour-basic.xml @ 657:8631da51309b
Slow progress on XML conversion
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Mon, 09 Feb 2009 23:25:40 -0800 |
parents | 863a82f13901 |
children | b90b024729f1 |
comparison
equal
deleted
inserted
replaced
656:23dc79421e06 | 657:8631da51309b |
---|---|
235 to describe the changeset.</para></listitem></itemizedlist> | 235 to describe the changeset.</para></listitem></itemizedlist> |
236 <para>The default output printed by <command role="hg-cmd">hg | 236 <para>The default output printed by <command role="hg-cmd">hg |
237 log</command> is purely a summary; it is missing a lot of | 237 log</command> is purely a summary; it is missing a lot of |
238 detail.</para> | 238 detail.</para> |
239 | 239 |
240 <para>Figure <xref id="fig:tour-basic:history"/> provides a | 240 <para>Figure <xref linkend="fig:tour-basic:history"/> provides a |
241 graphical representation of the history of the <filename | 241 graphical representation of the history of the <filename |
242 class="directory">hello</filename> repository, to make it a | 242 class="directory">hello</filename> repository, to make it a |
243 little easier to see which direction history is | 243 little easier to see which direction history is |
244 <quote>flowing</quote> in. We'll be returning to this figure | 244 <quote>flowing</quote> in. We'll be returning to this figure |
245 several times in this chapter and the chapter that | 245 several times in this chapter and the chapter that |
246 follows.</para> | 246 follows.</para> |
247 | 247 |
248 <figure> | 248 <informalfigure id="fig:tour-basic:history"> |
249 | 249 <mediaobject> |
250 <para> <mediaobject><imageobject><imagedata | 250 <imageobject><imagedata fileref="tour-history"/></imageobject> |
251 fileref="tour-history"/></imageobject><textobject><phrase>XXX | 251 <textobject><phrase>XXX add text</phrase></textobject> |
252 add text</phrase></textobject></mediaobject> | 252 <caption><para>Graphical history of the <filename |
253 <caption>Graphical history of the <filename | 253 class="directory">hello</filename> |
254 class="directory">hello</filename> repository</caption> | 254 repository</para></caption> |
255 \label{fig:tour-basic:history}</para> | 255 </mediaobject> |
256 </figure> | 256 </informalfigure> |
257 | 257 |
258 <sect2> | 258 <sect2> |
259 <title>Changesets, revisions, and talking to other | 259 <title>Changesets, revisions, and talking to other |
260 people</title> | 260 people</title> |
261 | 261 |
340 <para>If you want to see both the description and content of a | 340 <para>If you want to see both the description and content of a |
341 change, add the <option role="hg-opt-log">-p</option> (or | 341 change, add the <option role="hg-opt-log">-p</option> (or |
342 <option role="hg-opt-log">--patch</option>) option. This | 342 <option role="hg-opt-log">--patch</option>) option. This |
343 displays the content of a change as a <emphasis>unified | 343 displays the content of a change as a <emphasis>unified |
344 diff</emphasis> (if you've never seen a unified diff before, | 344 diff</emphasis> (if you've never seen a unified diff before, |
345 see section <xref id="sec:mq:patch"/> for an | 345 see section <xref linkend="sec:mq:patch"/> for an |
346 overview). <!-- &interaction.tour.log-vp; --></para> | 346 overview). <!-- &interaction.tour.log-vp; --></para> |
347 | 347 |
348 </sect2> | 348 </sect2> |
349 </sect1> | 349 </sect1> |
350 <sect1> | 350 <sect1> |
487 <listitem><para>If you create a file in your home directory | 487 <listitem><para>If you create a file in your home directory |
488 called <filename role="special">.hgrc</filename>, with a | 488 called <filename role="special">.hgrc</filename>, with a |
489 <envar role="rc-item-ui">username</envar> entry, that will | 489 <envar role="rc-item-ui">username</envar> entry, that will |
490 be used next. To see what the contents of this file | 490 be used next. To see what the contents of this file |
491 should look like, refer to section <xref | 491 should look like, refer to section <xref |
492 id="sec:tour-basic:username"/> | 492 linkend="sec:tour-basic:username"/> |
493 below.</para></listitem> | 493 below.</para></listitem> |
494 <listitem><para>If you have set the <envar>EMAIL</envar> | 494 <listitem><para>If you have set the <envar>EMAIL</envar> |
495 environment variable, this will be used | 495 environment variable, this will be used |
496 next.</para></listitem> | 496 next.</para></listitem> |
497 <listitem><para>Mercurial will query your system to find out | 497 <listitem><para>Mercurial will query your system to find out |
498 your local user name and host name, and construct a | 498 your local user name and host name, and construct a |
499 username from these components. Since this often results | 499 username from these components. Since this often results |
500 in a username that is not very useful, it will print a | 500 in a username that is not very useful, it will print a |
501 warning if it has to do | 501 warning if it has to do |
502 this.</para></listitem></orderedlist> | 502 this.</para></listitem> |
503 <listitem><para>If all of these mechanisms fail, Mercurial will | 503 </orderedlist> |
504 <para>If all of these mechanisms fail, Mercurial will | |
504 fail, printing an error message. In this case, it will not | 505 fail, printing an error message. In this case, it will not |
505 let you commit until you set up a | 506 let you commit until you set up a |
506 username.</para></listitem> | 507 username.</para> |
507 <listitem><para>You should think of the <envar>HGUSER</envar> | 508 <para>You should think of the <envar>HGUSER</envar> environment |
508 environment variable and the <option | 509 variable and the <option role="hg-opt-commit">-u</option> |
509 role="hg-opt-commit">-u</option> option to the <command | 510 option to the <command role="hg-cmd">hg commit</command> |
510 role="hg-cmd">hg commit</command> command as ways to | 511 command as ways to <emphasis>override</emphasis> Mercurial's |
511 <emphasis>override</emphasis> Mercurial's default selection | 512 default selection of username. For normal use, the simplest |
512 of username. For normal use, the simplest and most robust | 513 and most robust way to set a username for yourself is by |
513 way to set a username for yourself is by creating a | 514 creating a <filename role="special">.hgrc</filename> file; see |
514 <filename role="special">.hgrc</filename> file; see below | 515 below for details.</para> |
515 for details.</para></listitem> | 516 <sect3 id="sec:tour-basic:username"> |
516 <sect3> | |
517 <title>Creating a Mercurial configuration file</title> | 517 <title>Creating a Mercurial configuration file</title> |
518 <listitem><para>\label{sec:tour-basic:username}</para></listitem> | 518 |
519 <listitem><para>To set a user name, use your favourite editor | 519 <para>To set a user name, use your favourite editor |
520 to create a file called <filename | 520 to create a file called <filename |
521 role="special">.hgrc</filename> in your home directory. | 521 role="special">.hgrc</filename> in your home directory. |
522 Mercurial will use this file to look up your personalised | 522 Mercurial will use this file to look up your personalised |
523 configuration settings. The initial contents of your | 523 configuration settings. The initial contents of your |
524 <filename role="special">.hgrc</filename> should look like | 524 <filename role="special">.hgrc</filename> should look like |
525 this.</para></listitem><programlisting> | 525 this.</para> |
526 <listitem><para> # This is a Mercurial configuration file. | 526 <programlisting># This is a Mercurial configuration file. |
527 [ui] username = Firstname Lastname | 527 [ui] username = Firstname Lastname |
528 <email.address@domain.net></para></listitem></programlisting> | 528 <email.address@domain.net></programlisting> |
529 <listitem><para>The <quote><literal>[ui]</literal></quote> | 529 |
530 line begins a <emphasis>section</emphasis> of the config | 530 <para>The <quote><literal>[ui]</literal></quote> line begins a |
531 file, so you can read the <quote><literal>username = | 531 <emphasis>section</emphasis> of the config file, so you can |
532 ...</literal></quote> line as meaning <quote>set the | 532 read the <quote><literal>username = ...</literal></quote> |
533 value of the <literal>username</literal> item in the | 533 line as meaning <quote>set the value of the |
534 <literal>ui</literal> section</quote>. A section | 534 <literal>username</literal> item in the |
535 continues until a new section begins, or the end of the | 535 <literal>ui</literal> section</quote>. A section continues |
536 file. Mercurial ignores empty lines and treats any text | 536 until a new section begins, or the end of the file. |
537 from <quote><literal>#</literal></quote> to the end of a | 537 Mercurial ignores empty lines and treats any text from |
538 line as a comment.</para></listitem> | 538 <quote><literal>#</literal></quote> to the end of a line as |
539 a comment.</para> | |
539 </sect3> | 540 </sect3> |
541 | |
540 <sect3> | 542 <sect3> |
541 <title>Choosing a user name</title> | 543 <title>Choosing a user name</title> |
542 | 544 |
543 <listitem><para>You can use any text you like as the value of | 545 <para>You can use any text you like as the value of |
544 the <literal>username</literal> config item, since this | 546 the <literal>username</literal> config item, since this |
545 information is for reading by other people, but for | 547 information is for reading by other people, but for |
546 interpreting by Mercurial. The convention that most | 548 interpreting by Mercurial. The convention that most |
547 people follow is to use their name and email address, as | 549 people follow is to use their name and email address, as |
548 in the example above.</para></listitem> | 550 in the example above.</para> |
549 <note> | 551 <note> |
550 <listitem><para> Mercurial's built-in web server obfuscates | 552 <para>Mercurial's built-in web server obfuscates |
551 email addresses, to make it more difficult for the email | 553 email addresses, to make it more difficult for the email |
552 harvesting tools that spammers use. This reduces the | 554 harvesting tools that spammers use. This reduces the |
553 likelihood that you'll start receiving more junk email | 555 likelihood that you'll start receiving more junk email |
554 if you publish a Mercurial repository on the | 556 if you publish a Mercurial repository on the |
555 web.</para></listitem></note> | 557 web.</para></note> |
556 | 558 |
557 </sect3> | 559 </sect3> |
558 </sect2> | 560 </sect2> |
559 <sect2> | 561 <sect2> |
560 <title>Writing a commit message</title> | 562 <title>Writing a commit message</title> |
561 | 563 |
562 <listitem><para>When we commit a change, Mercurial drops us into | 564 <para>When we commit a change, Mercurial drops us into |
563 a text editor, to enter a message that will describe the | 565 a text editor, to enter a message that will describe the |
564 modifications we've made in this changeset. This is called | 566 modifications we've made in this changeset. This is called |
565 the <emphasis>commit message</emphasis>. It will be a | 567 the <emphasis>commit message</emphasis>. It will be a |
566 record for readers of what we did and why, and it will be | 568 record for readers of what we did and why, and it will be |
567 printed by <command role="hg-cmd">hg log</command> after | 569 printed by <command role="hg-cmd">hg log</command> after |
568 we've finished committing. <!-- &interaction.tour.commit; | 570 we've finished committing.</para> |
569 --></para></listitem> | 571 |
570 <listitem><para>The editor that the <command role="hg-cmd">hg | 572 <!-- &interaction.tour.commit; --> |
573 | |
574 <para>The editor that the <command role="hg-cmd">hg | |
571 commit</command> command drops us into will contain an | 575 commit</command> command drops us into will contain an |
572 empty line, followed by a number of lines starting with | 576 empty line, followed by a number of lines starting with |
573 <quote><literal>HG:</literal></quote>.</para></listitem><programlisting> | 577 <quote><literal>HG:</literal></quote>.</para> |
574 <listitem><para> <emphasis>empty line</emphasis> HG: changed | 578 |
575 hello.c</para></listitem></programlisting> | 579 <programlisting>XXX fix this XXX</programlisting> |
576 <listitem><para>Mercurial ignores the lines that start with | 580 |
581 <para>Mercurial ignores the lines that start with | |
577 <quote><literal>HG:</literal></quote>; it uses them only to | 582 <quote><literal>HG:</literal></quote>; it uses them only to |
578 tell us which files it's recording changes to. Modifying or | 583 tell us which files it's recording changes to. Modifying or |
579 deleting these lines has no effect.</para></listitem> | 584 deleting these lines has no effect.</para> |
580 </sect2> | 585 </sect2> |
581 <sect2> | 586 <sect2> |
582 <title>Writing a good commit message</title> | 587 <title>Writing a good commit message</title> |
583 | 588 |
584 <listitem><para>Since <command role="hg-cmd">hg log</command> | 589 <para>Since <command role="hg-cmd">hg log</command> |
585 only prints the first line of a commit message by default, | 590 only prints the first line of a commit message by default, |
586 it's best to write a commit message whose first line stands | 591 it's best to write a commit message whose first line stands |
587 alone. Here's a real example of a commit message that | 592 alone. Here's a real example of a commit message that |
588 <emphasis>doesn't</emphasis> follow this guideline, and | 593 <emphasis>doesn't</emphasis> follow this guideline, and |
589 hence has a summary that is not | 594 hence has a summary that is not |
590 readable.</para></listitem><programlisting> | 595 readable.</para> |
591 <listitem><para> changeset: 73:584af0e231be user: Censored | 596 |
592 Person <censored.person@example.org> date: Tue Sep | 597 <programlisting> |
593 26 21:37:07 2006 -0700 summary: include | 598 changeset: 73:584af0e231be |
594 buildmeister/commondefs. Add an exports and | 599 user: Censored Person <censored.person@example.org> |
595 install</para></listitem></programlisting> | 600 date: Tue Sep 26 21:37:07 2006 -0700 |
596 | 601 summary: include buildmeister/commondefs. Add exports.</programlisting> |
597 <listitem><para>As far as the remainder of the contents of the | 602 |
603 <para>As far as the remainder of the contents of the | |
598 commit message are concerned, there are no hard-and-fast | 604 commit message are concerned, there are no hard-and-fast |
599 rules. Mercurial itself doesn't interpret or care about the | 605 rules. Mercurial itself doesn't interpret or care about the |
600 contents of the commit message, though your project may have | 606 contents of the commit message, though your project may have |
601 policies that dictate a certain kind of | 607 policies that dictate a certain kind of |
602 formatting.</para></listitem> | 608 formatting.</para> |
603 <listitem><para>My personal preference is for short, but | 609 <para>My personal preference is for short, but |
604 informative, commit messages that tell me something that I | 610 informative, commit messages that tell me something that I |
605 can't figure out with a quick glance at the output of | 611 can't figure out with a quick glance at the output of |
606 <command role="hg-cmd">hg log | 612 <command role="hg-cmd">hg log |
607 --patch</command>.</para></listitem> | 613 --patch</command>.</para> |
608 </sect2> | 614 </sect2> |
609 <sect2> | 615 <sect2> |
610 <title>Aborting a commit</title> | 616 <title>Aborting a commit</title> |
611 | 617 |
612 <listitem><para>If you decide that you don't want to commit | 618 <para>If you decide that you don't want to commit |
613 while in the middle of editing a commit message, simply exit | 619 while in the middle of editing a commit message, simply exit |
614 from your editor without saving the file that it's editing. | 620 from your editor without saving the file that it's editing. |
615 This will cause nothing to happen to either the repository | 621 This will cause nothing to happen to either the repository |
616 or the working directory.</para></listitem> | 622 or the working directory.</para> |
617 <listitem><para>If we run the <command role="hg-cmd">hg | 623 <para>If we run the <command role="hg-cmd">hg |
618 commit</command> command without any arguments, it records | 624 commit</command> command without any arguments, it records |
619 all of the changes we've made, as reported by <command | 625 all of the changes we've made, as reported by <command |
620 role="hg-cmd">hg status</command> and <command | 626 role="hg-cmd">hg status</command> and <command |
621 role="hg-cmd">hg diff</command>.</para></listitem> | 627 role="hg-cmd">hg diff</command>.</para> |
622 </sect2> | 628 </sect2> |
623 <sect2> | 629 <sect2> |
624 <title>Admiring our new handiwork</title> | 630 <title>Admiring our new handiwork</title> |
625 | 631 |
626 <listitem><para>Once we've finished the commit, we can use the | 632 <para>Once we've finished the commit, we can use the |
627 <command role="hg-cmd">hg tip</command> command to display | 633 <command role="hg-cmd">hg tip</command> command to display |
628 the changeset we just created. This command produces output | 634 the changeset we just created. This command produces output |
629 that is identical to <command role="hg-cmd">hg | 635 that is identical to <command role="hg-cmd">hg |
630 log</command>, but it only displays the newest revision in | 636 log</command>, but it only displays the newest revision in |
631 the repository. <!-- &interaction.tour.tip; --> We refer to | 637 the repository.</para> |
638 | |
639 <!-- &interaction.tour.tip; --> | |
640 | |
641 <para>We refer to | |
632 the newest revision in the repository as the tip revision, | 642 the newest revision in the repository as the tip revision, |
633 or simply the tip.</para></listitem> | 643 or simply the tip.</para> |
634 </sect2> | 644 </sect2> |
635 </sect1> | 645 </sect1> |
646 | |
636 <sect1> | 647 <sect1> |
637 <title>Sharing changes</title> | 648 <title>Sharing changes</title> |
638 | 649 |
639 <listitem><para>We mentioned earlier that repositories in | 650 <para>We mentioned earlier that repositories in |
640 Mercurial are self-contained. This means that the changeset | 651 Mercurial are self-contained. This means that the changeset |
641 we just created exists only in our <filename | 652 we just created exists only in our <filename |
642 class="directory">my-hello</filename> repository. Let's | 653 class="directory">my-hello</filename> repository. Let's |
643 look at a few ways that we can propagate this change into | 654 look at a few ways that we can propagate this change into |
644 other repositories.</para></listitem> | 655 other repositories.</para> |
645 <sect2> | 656 |
657 <sect2 id="sec:tour:pull"> | |
646 <title>Pulling changes from another repository</title> | 658 <title>Pulling changes from another repository</title> |
647 <listitem><para>\label{sec:tour:pull}</para></listitem> | 659 <para>To get started, let's clone our original |
648 <listitem><para>To get started, let's clone our original | |
649 <filename class="directory">hello</filename> repository, | 660 <filename class="directory">hello</filename> repository, |
650 which does not contain the change we just committed. We'll | 661 which does not contain the change we just committed. We'll |
651 call our temporary repository <filename | 662 call our temporary repository <filename |
652 class="directory">hello-pull</filename>. <!-- | 663 class="directory">hello-pull</filename>.</para> |
653 &interaction.tour.clone-pull; --></para></listitem> | 664 |
654 <listitem><para>We'll use the <command role="hg-cmd">hg | 665 <!-- &interaction.tour.clone-pull; --> |
666 | |
667 <para>We'll use the <command role="hg-cmd">hg | |
655 pull</command> command to bring changes from <filename | 668 pull</command> command to bring changes from <filename |
656 class="directory">my-hello</filename> into <filename | 669 class="directory">my-hello</filename> into <filename |
657 class="directory">hello-pull</filename>. However, blindly | 670 class="directory">hello-pull</filename>. However, blindly |
658 pulling unknown changes into a repository is a somewhat | 671 pulling unknown changes into a repository is a somewhat |
659 scary prospect. Mercurial provides the <command | 672 scary prospect. Mercurial provides the <command |
660 role="hg-cmd">hg incoming</command> command to tell us | 673 role="hg-cmd">hg incoming</command> command to tell us |
661 what changes the <command role="hg-cmd">hg pull</command> | 674 what changes the <command role="hg-cmd">hg pull</command> |
662 command <emphasis>would</emphasis> pull into the repository, | 675 command <emphasis>would</emphasis> pull into the repository, |
663 without actually pulling the changes in. <!-- | 676 without actually pulling the changes in.</para> |
664 &interaction.tour.incoming; --> (Of course, someone could | 677 |
678 <!-- &interaction.tour.incoming; --> | |
679 | |
680 <para>(Of course, someone could | |
665 cause more changesets to appear in the repository that we | 681 cause more changesets to appear in the repository that we |
666 ran <command role="hg-cmd">hg incoming</command> in, before | 682 ran <command role="hg-cmd">hg incoming</command> in, before |
667 we get a chance to <command role="hg-cmd">hg pull</command> | 683 we get a chance to <command role="hg-cmd">hg pull</command> |
668 the changes, so that we could end up pulling changes that we | 684 the changes, so that we could end up pulling changes that we |
669 didn't expect.)</para></listitem> | 685 didn't expect.)</para> |
670 <listitem><para>Bringing changes into a repository is a simple | 686 |
687 <para>Bringing changes into a repository is a simple | |
671 matter of running the <command role="hg-cmd">hg | 688 matter of running the <command role="hg-cmd">hg |
672 pull</command> command, and telling it which repository to | 689 pull</command> command, and telling it which repository to |
673 pull from. <!-- &interaction.tour.pull; --> As you can see | 690 pull from.</para> |
691 | |
692 <!-- &interaction.tour.pull; --> | |
693 | |
694 <para>As you can see | |
674 from the before-and-after output of <command | 695 from the before-and-after output of <command |
675 role="hg-cmd">hg tip</command>, we have successfully | 696 role="hg-cmd">hg tip</command>, we have successfully |
676 pulled changes into our repository. There remains one step | 697 pulled changes into our repository. There remains one step |
677 before we can see these changes in the working | 698 before we can see these changes in the working |
678 directory.</para></listitem> | 699 directory.</para> |
679 </sect2> | 700 </sect2> |
680 <sect2> | 701 <sect2> |
681 <title>Updating the working directory</title> | 702 <title>Updating the working directory</title> |
682 | 703 |
683 <listitem><para>We have so far glossed over the relationship | 704 <para>We have so far glossed over the relationship |
684 between a repository and its working directory. The | 705 between a repository and its working directory. The |
685 <command role="hg-cmd">hg pull</command> command that we ran | 706 <command role="hg-cmd">hg pull</command> command that we ran |
686 in section <xref id="sec:tour:pull"/> brought changes into | 707 in section <xref linkend="sec:tour:pull"/> brought changes into |
687 the | 708 the |
688 repository, but if we check, there's no sign of those | 709 repository, but if we check, there's no sign of those |
689 changes in the working directory. This is because <command | 710 changes in the working directory. This is because <command |
690 role="hg-cmd">hg pull</command> does not (by default) | 711 role="hg-cmd">hg pull</command> does not (by default) |
691 touch the working directory. Instead, we use the <command | 712 touch the working directory. Instead, we use the <command |
692 role="hg-cmd">hg update</command> command to do this. <!-- | 713 role="hg-cmd">hg update</command> command to do this. <!-- |
693 &interaction.tour.update; --></para></listitem> | 714 &interaction.tour.update; --></para> |
694 <listitem><para>It might seem a bit strange that <command | 715 <para>It might seem a bit strange that <command |
695 role="hg-cmd">hg pull</command> doesn't update the working | 716 role="hg-cmd">hg pull</command> doesn't update the working |
696 directory automatically. There's actually a good reason for | 717 directory automatically. There's actually a good reason for |
697 this: you can use <command role="hg-cmd">hg update</command> | 718 this: you can use <command role="hg-cmd">hg update</command> |
698 to update the working directory to the state it was in at | 719 to update the working directory to the state it was in at |
699 <emphasis>any revision</emphasis> in the history of the | 720 <emphasis>any revision</emphasis> in the history of the |
700 repository. If you had the working directory updated to an | 721 repository. If you had the working directory updated to an |
701 old revision---to hunt down the origin of a bug, say---and | 722 old revision---to hunt down the origin of a bug, say---and |
702 ran a <command role="hg-cmd">hg pull</command> which | 723 ran a <command role="hg-cmd">hg pull</command> which |
703 automatically updated the working directory to a new | 724 automatically updated the working directory to a new |
704 revision, you might not be terribly happy.</para></listitem> | 725 revision, you might not be terribly happy.</para> |
705 <listitem><para>However, since pull-then-update is such a common | 726 <para>However, since pull-then-update is such a common |
706 thing to do, Mercurial lets you combine the two by passing | 727 thing to do, Mercurial lets you combine the two by passing |
707 the <option role="hg-opt-pull">-u</option> option to | 728 the <option role="hg-opt-pull">-u</option> option to |
708 <command role="hg-cmd">hg | 729 <command role="hg-cmd">hg |
709 pull</command>.</para></listitem><programlisting> | 730 pull</command>.</para> |
710 <listitem><para> hg pull | 731 |
711 -u</para></listitem></programlisting> | 732 <para>If you look back at the output of <command |
712 <listitem><para>If you look back at the output of <command | |
713 role="hg-cmd">hg pull</command> in section <xref | 733 role="hg-cmd">hg pull</command> in section <xref |
714 id="sec:tour:pull"/> when we ran it without <option | 734 linkend="sec:tour:pull"/> when we ran it without <option |
715 role="hg-opt-pull">-u</option>, you can see that it | 735 role="hg-opt-pull">-u</option>, you can see that it |
716 printed a helpful reminder that we'd have to take an | 736 printed a helpful reminder that we'd have to take an |
717 explicit step to update the working | 737 explicit step to update the working |
718 directory:</para></listitem><programlisting> | 738 directory:</para> |
719 <listitem><para> (run 'hg update' to get a working | 739 |
720 copy)</para></listitem></programlisting> | 740 <!-- &interaction.xxx.fixme; --> |
721 | 741 |
722 <listitem><para>To find out what revision the working directory | 742 <para>To find out what revision the working directory |
723 is at, use the <command role="hg-cmd">hg parents</command> | 743 is at, use the <command role="hg-cmd">hg parents</command> |
724 command. <!-- &interaction.tour.parents; --> If you look | 744 command.</para> |
725 back at figure <xref id="fig:tour-basic:history"/>, you'll | 745 |
746 <!-- &interaction.tour.parents; --> | |
747 | |
748 <para>If you look | |
749 back at figure <xref linkend="fig:tour-basic:history"/>, you'll | |
726 see arrows connecting each changeset. The node that the | 750 see arrows connecting each changeset. The node that the |
727 arrow leads <emphasis>from</emphasis> in each case is a | 751 arrow leads <emphasis>from</emphasis> in each case is a |
728 parent, and the node that the arrow leads | 752 parent, and the node that the arrow leads |
729 <emphasis>to</emphasis> is its child. The working directory | 753 <emphasis>to</emphasis> is its child. The working directory |
730 has a parent in just the same way; this is the changeset | 754 has a parent in just the same way; this is the changeset |
731 that the working directory currently | 755 that the working directory currently |
732 contains.</para></listitem> | 756 contains.</para> |
733 <listitem><para>To update the working directory to a particular | 757 <para>To update the working directory to a particular |
734 revision, give a revision number or changeset ID to the | 758 revision, give a revision number or changeset ID to the |
735 <command role="hg-cmd">hg update</command> command. <!-- | 759 <command role="hg-cmd">hg update</command> command. <!-- |
736 &interaction.tour.older; --> If you omit an explicit | 760 &interaction.tour.older; --> If you omit an explicit |
737 revision, <command role="hg-cmd">hg update</command> will | 761 revision, <command role="hg-cmd">hg update</command> will |
738 update to the tip revision, as shown by the second call to | 762 update to the tip revision, as shown by the second call to |
739 <command role="hg-cmd">hg update</command> in the example | 763 <command role="hg-cmd">hg update</command> in the example |
740 above.</para></listitem> | 764 above.</para> |
741 </sect2> | 765 </sect2> |
766 | |
742 <sect2> | 767 <sect2> |
743 <title>Pushing changes to another repository</title> | 768 <title>Pushing changes to another repository</title> |
744 | 769 |
745 <listitem><para>Mercurial lets us push changes to another | 770 <para>Mercurial lets us push changes to another |
746 repository, from the repository we're currently visiting. | 771 repository, from the repository we're currently visiting. |
747 As with the example of <command role="hg-cmd">hg | 772 As with the example of <command role="hg-cmd">hg |
748 pull</command> above, we'll create a temporary repository | 773 pull</command> above, we'll create a temporary repository |
749 to push our changes into. <!-- &interaction.tour.clone-push; | 774 to push our changes into.</para> |
750 --> The <command role="hg-cmd">hg outgoing</command> command | 775 |
776 <!-- &interaction.tour.clone-push; --> | |
777 | |
778 <para>The <command role="hg-cmd">hg outgoing</command> command | |
751 tells us what changes would be pushed into another | 779 tells us what changes would be pushed into another |
752 repository. <!-- &interaction.tour.outgoing; --> And the | 780 repository.</para> |
781 | |
782 <!-- &interaction.tour.outgoing; --> | |
783 | |
784 <para>And the | |
753 <command role="hg-cmd">hg push</command> command does the | 785 <command role="hg-cmd">hg push</command> command does the |
754 actual push. <!-- &interaction.tour.push; --> As with | 786 actual push.</para> |
787 | |
788 <!-- &interaction.tour.push; --> | |
789 | |
790 <para>As with | |
755 <command role="hg-cmd">hg pull</command>, the <command | 791 <command role="hg-cmd">hg pull</command>, the <command |
756 role="hg-cmd">hg push</command> command does not update | 792 role="hg-cmd">hg push</command> command does not update |
757 the working directory in the repository that it's pushing | 793 the working directory in the repository that it's pushing |
758 changes into. (Unlike <command role="hg-cmd">hg | 794 changes into. (Unlike <command role="hg-cmd">hg |
759 pull</command>, <command role="hg-cmd">hg push</command> | 795 pull</command>, <command role="hg-cmd">hg push</command> |
760 does not provide a <literal>-u</literal> option that updates | 796 does not provide a <literal>-u</literal> option that updates |
761 the other repository's working directory.)</para></listitem> | 797 the other repository's working directory.)</para> |
762 <listitem><para>What happens if we try to pull or push changes | 798 |
799 <para>What happens if we try to pull or push changes | |
763 and the receiving repository already has those changes? | 800 and the receiving repository already has those changes? |
764 Nothing too exciting. <!-- &interaction.tour.push.nothing; | 801 Nothing too exciting.</para> |
765 --></para></listitem> | 802 |
803 <!-- &interaction.tour.push.nothing; --> | |
766 </sect2> | 804 </sect2> |
767 <sect2> | 805 <sect2> |
768 <title>Sharing changes over a network</title> | 806 <title>Sharing changes over a network</title> |
769 | 807 |
770 <listitem><para>The commands we have covered in the previous few | 808 <para>The commands we have covered in the previous few |
771 sections are not limited to working with local repositories. | 809 sections are not limited to working with local repositories. |
772 Each works in exactly the same fashion over a network | 810 Each works in exactly the same fashion over a network |
773 connection; simply pass in a URL instead of a local path. | 811 connection; simply pass in a URL instead of a local |
774 <!-- &interaction.tour.outgoing.net; --> In this example, we | 812 path.</para> |
813 | |
814 <!-- &interaction.tour.outgoing.net; --> | |
815 | |
816 <para>In this example, we | |
775 can see what changes we could push to the remote repository, | 817 can see what changes we could push to the remote repository, |
776 but the repository is understandably not set up to let | 818 but the repository is understandably not set up to let |
777 anonymous users push to it. <!-- &interaction.tour.push.net; | 819 anonymous users push to it.</para> |
778 --></para></listitem> | 820 |
821 <!-- &interaction.tour.push.net; --> | |
779 </sect2> | 822 </sect2> |
780 </sect1> | 823 </sect1> |
781 </chapter> | 824 </chapter> |
782 | 825 |
783 <!-- | 826 <!-- |