From: Carl Worth Date: Thu, 27 Sep 2007 22:52:33 +0000 (-0700) Subject: Convert examples to proper markdown style (tab-indented) X-Git-Url: https://git.cworth.org/git?p=hgbook-git;a=commitdiff_plain;h=7fe6568ea41eb049a96604ec50b034646c399515 Convert examples to proper markdown style (tab-indented) Also drop line numbers from the examples, (I don't *think* the text references these. --- diff --git a/tour.mdwn b/tour.mdwn index 641383d..1d8435b 100644 --- a/tour.mdwn +++ b/tour.mdwn @@ -34,24 +34,24 @@ mercurial. * Debian -1  apt-get install mercurial + apt-get install mercurial * Fedora Core -1  yum install mercurial + yum install mercurial * Gentoo -1  emerge mercurial + emerge mercurial * OpenSUSE -1  yum install mercurial + yum install mercurial * Ubuntu Ubuntu’s Mercurial package is based on Debian’s. To install it, run the following command. -1  apt-get install mercurial + apt-get install mercurial The Ubuntu package for Mercurial tends to lag behind the Debian version by a considerable time margin (at the time of writing, seven @@ -88,12 +88,12 @@ Mercurial is actually installed properly. The actual version information that it prints isn’t so important; it’s whether it prints anything at all that we care about. -1  $ hg version -2  Mercurial Distributed SCM (version 2937d0dbfab0) -3   -4  Copyright (C) 2005, 2006 Matt Mackall  -5  This is free software; see the source for copying conditions. There is NO -6  warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + $ hg version + Mercurial Distributed SCM (version 2937d0dbfab0) + + Copyright (C) 2005, 2006 Matt Mackall  + This is free software; see the source for copying conditions. There is NO + warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. #### 2.2.1 Built-in help @@ -104,26 +104,26 @@ print a brief list of commands, along with a description of what each does. If you ask for help on a specific command (as below), it prints more detailed information. -1  $ hg help init -2  hg init [-e CMD] [--remotecmd CMD] [DEST] -3   -4  create a new repository in the given directory -5   -6      Initialize a new repository in the given directory.  If the given -7      directory does not exist, it is created. -8   -9      If no directory is given, the current directory is used. -10   -11      It is possible to specify an ssh:// URL as the destination. -12      Look at the help text for the pull command for important details -13      about ssh:// URLs. -14   -15  options: -16   -17   -e --ssh        specify ssh command to use -18      --remotecmd  specify hg command to run on the remote side -19   -20  use "hg -v help init" to show global options + $ hg help init + hg init [-e CMD] [--remotecmd CMD] [DEST] + + create a new repository in the given directory + + Initialize a new repository in the given directory.  If the given + directory does not exist, it is created. + + If no directory is given, the current directory is used. + + It is possible to specify an ssh:// URL as the destination. + Look at the help text for the pull command for important details + about ssh:// URLs. + + options: + + -e --ssh        specify ssh command to use + --remotecmd  specify hg command to run on the remote side + + use "hg -v help init" to show global options For a more impressive level of detail (which you won’t usually need) run “hg help -v”. The -v option is short for --verbose, and tells @@ -148,23 +148,23 @@ best to use a built-in command that Mercurial provides. This command is called “hg clone”, because it creates an identical copy of an existing repository. -1  $ hg clone http://hg.serpentine.com/tutorial/hello -2  destination directory: hello -3  requesting all changes -4  adding changesets -5  adding manifests -6  adding file changes -7  added 5 changesets with 5 changes to 2 files -8  2 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg clone http://hg.serpentine.com/tutorial/hello + destination directory: hello + requesting all changes + adding changesets + adding manifests + adding file changes + added 5 changesets with 5 changes to 2 files + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved If our clone succeeded, we should now have a local directory called hello. This directory will contain some files. -1  $ ls -l -2  total 4 -3  drwxrwxr-x 3 bos bos 4096 Jun 17 18:05 hello -4  $ ls hello -5  Makefile  hello.c + $ ls -l + total 4 + drwxrwxr-x 3 bos bos 4096 Jun 17 18:05 hello + $ ls hello + Makefile  hello.c These files have the same contents and history in our repository as they do in the repository we cloned. @@ -185,9 +185,9 @@ When we take a more detailed look inside a repository, we can see that it contains a directory named .hg. This is where Mercurial keeps all of its metadata for the repository. -1  $ cd hello -2  $ ls -a -3  .  ..  .hg  Makefile  hello.c + $ cd hello + $ ls -a + .  ..  .hg  Makefile  hello.c The contents of the .hg directory and its subdirectories are private to Mercurial. Every other file and directory in the repository is @@ -206,33 +206,33 @@ One of the first things we might want to do with a new, unfamiliar repository is understand its history. The “hg log” command gives us a view of history. -1  $ hg log -2  changeset:   4:b57f9a090b62 -3  tag:         tip -4  user:        Bryan O'Sullivan  -5  date:        Tue Sep 06 15:43:07 2005 -0700 -6  summary:     Trim comments. -7   -8  changeset:   3:ff5d7b70a2a9 -9  user:        Bryan O'Sullivan  -10  date:        Tue Sep 06 13:15:58 2005 -0700 -11  summary:     Get make to generate the final binary from a .o file. -12   -13  changeset:   2:057d3c2d823c -14  user:        Bryan O'Sullivan  -15  date:        Tue Sep 06 13:15:43 2005 -0700 -16  summary:     Introduce a typo into hello.c. -17   -18  changeset:   1:82e55d328c8c -19  user:        mpm@selenic.com -20  date:        Fri Aug 26 01:21:28 2005 -0700 -21  summary:     Create a makefile -22   -23  changeset:   0:0a04b987be5a -24  user:        mpm@selenic.com -25  date:        Fri Aug 26 01:20:50 2005 -0700 -26  summary:     Create a standard "hello, world" program -27   + $ hg log + changeset:   4:b57f9a090b62 + tag:         tip + user:        Bryan O'Sullivan  + date:        Tue Sep 06 15:43:07 2005 -0700 + summary:     Trim comments. + + changeset:   3:ff5d7b70a2a9 + user:        Bryan O'Sullivan  + date:        Tue Sep 06 13:15:58 2005 -0700 + summary:     Get make to generate the final binary from a .o file. + + changeset:   2:057d3c2d823c + user:        Bryan O'Sullivan  + date:        Tue Sep 06 13:15:43 2005 -0700 + summary:     Introduce a typo into hello.c. + + changeset:   1:82e55d328c8c + user:        mpm@selenic.com + date:        Fri Aug 26 01:21:28 2005 -0700 + summary:     Create a makefile + + changeset:   0:0a04b987be5a + user:        mpm@selenic.com + date:        Fri Aug 26 01:20:50 2005 -0700 + summary:     Create a standard "hello, world" program + By default, this command prints a brief paragraph of output for each change to the project that was recorded. In Mercurial terminology, we @@ -313,52 +313,52 @@ To narrow the output of “hg log” down to a single revision, use the -r changeset identifier, and you can provide as many revisions as you want. -1  $ hg log -r 3 -2  changeset:   3:ff5d7b70a2a9 -3  user:        Bryan O'Sullivan  -4  date:        Tue Sep 06 13:15:58 2005 -0700 -5  summary:     Get make to generate the final binary from a .o file. -6   -7  $ hg log -r ff5d7b70a2a9 -8  changeset:   3:ff5d7b70a2a9 -9  user:        Bryan O'Sullivan  -10  date:        Tue Sep 06 13:15:58 2005 -0700 -11  summary:     Get make to generate the final binary from a .o file. -12   -13  $ hg log -r 1 -r 4 -14  changeset:   1:82e55d328c8c -15  user:        mpm@selenic.com -16  date:        Fri Aug 26 01:21:28 2005 -0700 -17  summary:     Create a makefile -18   -19  changeset:   4:b57f9a090b62 -20  tag:         tip -21  user:        Bryan O'Sullivan  -22  date:        Tue Sep 06 15:43:07 2005 -0700 -23  summary:     Trim comments. -24   + $ hg log -r 3 + changeset:   3:ff5d7b70a2a9 + user:        Bryan O'Sullivan  + date:        Tue Sep 06 13:15:58 2005 -0700 + summary:     Get make to generate the final binary from a .o file. + + $ hg log -r ff5d7b70a2a9 + changeset:   3:ff5d7b70a2a9 + user:        Bryan O'Sullivan  + date:        Tue Sep 06 13:15:58 2005 -0700 + summary:     Get make to generate the final binary from a .o file. + + $ hg log -r 1 -r 4 + changeset:   1:82e55d328c8c + user:        mpm@selenic.com + date:        Fri Aug 26 01:21:28 2005 -0700 + summary:     Create a makefile + + changeset:   4:b57f9a090b62 + tag:         tip + user:        Bryan O'Sullivan  + date:        Tue Sep 06 15:43:07 2005 -0700 + summary:     Trim comments. + If you want to see the history of several revisions without having to list each one, you can use range notation; this lets you express the idea “I want all revisions between a and b, inclusive”. -1  $ hg log -r 2:4 -2  changeset:   2:057d3c2d823c -3  user:        Bryan O'Sullivan  -4  date:        Tue Sep 06 13:15:43 2005 -0700 -5  summary:     Introduce a typo into hello.c. -6   -7  changeset:   3:ff5d7b70a2a9 -8  user:        Bryan O'Sullivan  -9  date:        Tue Sep 06 13:15:58 2005 -0700 -10  summary:     Get make to generate the final binary from a .o file. -11   -12  changeset:   4:b57f9a090b62 -13  tag:         tip -14  user:        Bryan O'Sullivan  -15  date:        Tue Sep 06 15:43:07 2005 -0700 -16  summary:     Trim comments. -17   + $ hg log -r 2:4 + changeset:   2:057d3c2d823c + user:        Bryan O'Sullivan  + date:        Tue Sep 06 13:15:43 2005 -0700 + summary:     Introduce a typo into hello.c. + + changeset:   3:ff5d7b70a2a9 + user:        Bryan O'Sullivan  + date:        Tue Sep 06 13:15:58 2005 -0700 + summary:     Get make to generate the final binary from a .o file. + + changeset:   4:b57f9a090b62 + tag:         tip + user:        Bryan O'Sullivan  + date:        Tue Sep 06 15:43:07 2005 -0700 + summary:     Trim comments. + Mercurial also honours the order in which you specify revisions, so “hg log -r 2:4” prints 2,3,4 while “hg log -r 4:2” prints 4,3,2. @@ -372,42 +372,42 @@ trying to decide whether a changeset is the one you’re looking for. The “hg log” command’s -v (or --verbose) option gives you this extra detail. -1  $ hg log -v -r 3 -2  changeset:   3:ff5d7b70a2a9 -3  user:        Bryan O'Sullivan  -4  date:        Tue Sep 06 13:15:58 2005 -0700 -5  files:       Makefile -6  description: -7  Get make to generate the final binary from a .o file. -8   -9   + $ hg log -v -r 3 + changeset:   3:ff5d7b70a2a9 + user:        Bryan O'Sullivan  + date:        Tue Sep 06 13:15:58 2005 -0700 + files:       Makefile + description: + Get make to generate the final binary from a .o file. + + If you want to see both the description and content of a change, add the -p (or --patch) option. This displays the content of a change as a unified diff (if you’ve never seen a unified diff before, see section [12.4][10] for an overview). -1  $ hg log -v -p -r 2 -2  changeset:   2:057d3c2d823c -3  user:        Bryan O'Sullivan  -4  date:        Tue Sep 06 13:15:43 2005 -0700 -5  files:       hello.c -6  description: -7  Introduce a typo into hello.c. -8   -9   -10  diff -r 82e55d328c8c -r 057d3c2d823c hello.c -11  --- a/hello.c Fri Aug 26 01:21:28 2005 -0700 -12  +++ b/hello.c Tue Sep 06 13:15:43 2005 -0700 -13  @@ -11,6 +11,6 @@ -14   -15   int main(int argc, char ⋆⋆argv) -16   { -17  - printf("hello, world!∖n"); -18  + printf("hello, world!∖"); -19    return 0; -20   } -21   + $ hg log -v -p -r 2 + changeset:   2:057d3c2d823c + user:        Bryan O'Sullivan  + date:        Tue Sep 06 13:15:43 2005 -0700 + files:       hello.c + description: + Introduce a typo into hello.c. + + + diff -r 82e55d328c8c -r 057d3c2d823c hello.c + --- a/hello.c Fri Aug 26 01:21:28 2005 -0700 + +++ b/hello.c Tue Sep 06 13:15:43 2005 -0700 + @@ -11,6 +11,6 @@ + + int main(int argc, char ⋆⋆argv) + { + - printf("hello, world!∖n"); + + printf("hello, world!∖"); + return 0; + } + ### 2.5 All about command options @@ -451,10 +451,10 @@ locally, we can just clone that instead. This is much faster than cloning over the network, and cloning a local repository uses less disk space in most cases, too. -1  $ cd .. -2  $ hg clone hello my-hello -3  2 files updated, 0 files merged, 0 files removed, 0 files unresolved -4  $ cd my-hello + $ cd .. + $ hg clone hello my-hello + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ cd my-hello As an aside, it’s often good practice to keep a “pristine” copy of a remote repository around, which you can then make temporary clones of @@ -472,15 +472,15 @@ scripted example this way. Since you’re not under the same constraint, you probably won’t want to use sed; simply use your preferred text editor to do the same thing.) -1  $ sed -i '/printf/a∖∖tprintf("hello again!∖∖n");' hello.c + $ sed -i '/printf/a∖∖tprintf("hello again!∖∖n");' hello.c Mercurial’s “hg status” command will tell us what Mercurial knows about the files in the repository. -1  $ ls -2  Makefile  hello.c -3  $ hg status -4  M hello.c + $ ls + Makefile  hello.c + $ hg status + M hello.c The “hg status” command prints no output for some files, but a line starting with “M” for hello.c. Unless you tell it to, “hg status” will @@ -495,17 +495,17 @@ It’s a little bit helpful to know that we’ve modified hello.c, but we might prefer to know exactly what changes we’ve made to it. To do this, we use the “hg diff” command. -1  $ hg diff -2  diff -r b57f9a090b62 hello.c -3  --- a/hello.c Tue Sep 06 15:43:07 2005 -0700 -4  +++ b/hello.c Sun Jun 17 18:05:50 2007 +0000 -5  @@ -8,5 +8,6 @@ int main(int argc, char ⋆⋆argv) -6   int main(int argc, char ⋆⋆argv) -7   { -8    printf("hello, world!∖"); -9  + printf("hello again!∖n"); -10    return 0; -11   } + $ hg diff + diff -r b57f9a090b62 hello.c + --- a/hello.c Tue Sep 06 15:43:07 2005 -0700 + +++ b/hello.c Sun Jun 17 18:05:50 2007 +0000 + @@ -8,5 +8,6 @@ int main(int argc, char ⋆⋆argv) + int main(int argc, char ⋆⋆argv) + { + printf("hello, world!∖"); + + printf("hello again!∖n"); + return 0; + } ### 2.7 Recording changes in a new changeset @@ -558,9 +558,9 @@ To set a user name, use your favourite editor to create a file called your personalised configuration settings. The initial contents of your .hgrc should look like this. -1  # This is a Mercurial configuration file. -2  [ui] -3  username = Firstname Lastname  + # This is a Mercurial configuration file. + [ui] + username = Firstname Lastname  The “[ui]” line begins a section of the config file, so you can read the “username = ...” line as meaning “set the value of the username @@ -588,13 +588,13 @@ this changeset. This is called the commit message. It will be a record for readers of what we did and why, and it will be printed by “hg log” after we’ve finished committing. -1  $ hg commit + $ hg commit The editor that the “hg commit” command drops us into will contain an empty line, followed by a number of lines starting with “HG:”. -1  empty line -2  HG: changed hello.c + empty line + HG: changed hello.c Mercurial ignores the lines that start with “HG:”; it uses them only to tell us which files it’s recording changes to. Modifying or @@ -607,10 +607,10 @@ default, it’s best to write a commit message whose first line stands alone. Here’s a real example of a commit message that doesn’t follow this guideline, and hence has a summary that is not readable. -1  changeset:   73:584af0e231be -2  user:        Censored Person  -3  date:        Tue Sep 26 21:37:07 2006 -0700 -4  summary:     include buildmeister/commondefs.   Add an exports and install + changeset:   73:584af0e231be + user:        Censored Person  + date:        Tue Sep 26 21:37:07 2006 -0700 + summary:     include buildmeister/commondefs.   Add an exports and install As far as the remainder of the contents of the commit message are concerned, there are no hard-and-fast rules. Mercurial itself doesn’t @@ -640,27 +640,27 @@ display the changeset we just created. This command produces output that is identical to “hg log”, but it only displays the newest revision in the repository. -1  $ hg tip -vp -2  changeset:   5:fa1321bf0c80 -3  tag:         tip -4  user:        Bryan O'Sullivan  -5  date:        Sun Jun 17 18:05:50 2007 +0000 -6  files:       hello.c -7  description: -8  Added an extra line of output -9   -10   -11  diff -r b57f9a090b62 -r fa1321bf0c80 hello.c -12  --- a/hello.c Tue Sep 06 15:43:07 2005 -0700 -13  +++ b/hello.c Sun Jun 17 18:05:50 2007 +0000 -14  @@ -8,5 +8,6 @@ int main(int argc, char ⋆⋆argv) -15   int main(int argc, char ⋆⋆argv) -16   { -17    printf("hello, world!∖"); -18  + printf("hello again!∖n"); -19    return 0; -20   } -21   + $ hg tip -vp + changeset:   5:fa1321bf0c80 + tag:         tip + user:        Bryan O'Sullivan  + date:        Sun Jun 17 18:05:50 2007 +0000 + files:       hello.c + description: + Added an extra line of output + + + diff -r b57f9a090b62 -r fa1321bf0c80 hello.c + --- a/hello.c Tue Sep 06 15:43:07 2005 -0700 + +++ b/hello.c Sun Jun 17 18:05:50 2007 +0000 + @@ -8,5 +8,6 @@ int main(int argc, char ⋆⋆argv) + int main(int argc, char ⋆⋆argv) + { + printf("hello, world!∖"); + + printf("hello again!∖n"); + return 0; + } + We refer to the newest revision in the repository as the tip revision, or simply the tip. @@ -678,9 +678,9 @@ To get started, let’s clone our original hello repository, which does not contain the change we just committed. We’ll call our temporary repository hello-pull. -1  $ cd .. -2  $ hg clone hello hello-pull -3  2 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ cd .. + $ hg clone hello hello-pull + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved We’ll use the “hg pull” command to bring changes from my-hello into hello-pull. However, blindly pulling unknown changes into a repository @@ -688,16 +688,16 @@ is a somewhat scary prospect. Mercurial provides the “hg incoming” command to tell us what changes the “hg pull” command would pull into the repository, without actually pulling the changes in. -1  $ cd hello-pull -2  $ hg incoming ../my-hello -3  comparing with ../my-hello -4  searching for changes -5  changeset:   5:fa1321bf0c80 -6  tag:         tip -7  user:        Bryan O'Sullivan  -8  date:        Sun Jun 17 18:05:50 2007 +0000 -9  summary:     Added an extra line of output -10   + $ cd hello-pull + $ hg incoming ../my-hello + comparing with ../my-hello + searching for changes + changeset:   5:fa1321bf0c80 + tag:         tip + user:        Bryan O'Sullivan  + date:        Sun Jun 17 18:05:50 2007 +0000 + summary:     Added an extra line of output + (Of course, someone could cause more changesets to appear in the repository that we ran “hg incoming” in, before we get a chance to “hg @@ -707,28 +707,28 @@ didn’t expect.) Bringing changes into a repository is a simple matter of running the “hg pull” command, and telling it which repository to pull from. -1  $ hg tip -2  changeset:   4:b57f9a090b62 -3  tag:         tip -4  user:        Bryan O'Sullivan  -5  date:        Tue Sep 06 15:43:07 2005 -0700 -6  summary:     Trim comments. -7   -8  $ hg pull ../my-hello -9  pulling from ../my-hello -10  searching for changes -11  adding changesets -12  adding manifests -13  adding file changes -14  added 1 changesets with 1 changes to 1 files -15  (run 'hg update' to get a working copy) -16  $ hg tip -17  changeset:   5:fa1321bf0c80 -18  tag:         tip -19  user:        Bryan O'Sullivan  -20  date:        Sun Jun 17 18:05:50 2007 +0000 -21  summary:     Added an extra line of output -22   + $ hg tip + changeset:   4:b57f9a090b62 + tag:         tip + user:        Bryan O'Sullivan  + date:        Tue Sep 06 15:43:07 2005 -0700 + summary:     Trim comments. + + $ hg pull ../my-hello + pulling from ../my-hello + searching for changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + (run 'hg update' to get a working copy) + $ hg tip + changeset:   5:fa1321bf0c80 + tag:         tip + user:        Bryan O'Sullivan  + date:        Sun Jun 17 18:05:50 2007 +0000 + summary:     Added an extra line of output + As you can see from the before-and-after output of “hg tip”, we have successfully pulled changes into our repository. There remains one @@ -743,13 +743,13 @@ check, there’s no sign of those changes in the working directory. This is because “hg pull” does not (by default) touch the working directory. Instead, we use the “hg update” command to do this. -1  $ grep printf hello.c -2   printf("hello, world!∖"); -3  $ hg update tip -4  1 files updated, 0 files merged, 0 files removed, 0 files unresolved -5  $ grep printf hello.c -6   printf("hello, world!∖"); -7   printf("hello again!∖n"); + $ grep printf hello.c + printf("hello, world!∖"); + $ hg update tip + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ grep printf hello.c + printf("hello, world!∖"); + printf("hello again!∖n"); It might seem a bit strange that “hg pull” doesn’t update the working directory automatically. There’s actually a good reason for this: you @@ -764,25 +764,25 @@ However, since pull-then-update is such a common thing to do, Mercurial lets you combine the two by passing the -u option to “hg pull”. -1  hg pull -u + hg pull -u If you look back at the output of “hg pull” in section [2.8.1][12] when we ran it without -u, you can see that it printed a helpful reminder that we’d have to take an explicit step to update the working directory: -1  (run 'hg update' to get a working copy) + (run 'hg update' to get a working copy) To find out what revision the working directory is at, use the “hg parents” command. -1  $ hg parents -2  changeset:   5:fa1321bf0c80 -3  tag:         tip -4  user:        Bryan O'Sullivan  -5  date:        Sun Jun 17 18:05:50 2007 +0000 -6  summary:     Added an extra line of output -7   + $ hg parents + changeset:   5:fa1321bf0c80 + tag:         tip + user:        Bryan O'Sullivan  + date:        Sun Jun 17 18:05:50 2007 +0000 + summary:     Added an extra line of output + If you look back at figure [2.1][8], you’ll see arrows connecting each changeset. The node that the arrow leads from in each case is a @@ -793,16 +793,16 @@ that the working directory currently contains. To update the working directory to a particular revision, give a revision number or changeset ID to the “hg update” command. -1  $ hg update 2 -2  2 files updated, 0 files merged, 0 files removed, 0 files unresolved -3  $ hg parents -4  changeset:   2:057d3c2d823c -5  user:        Bryan O'Sullivan  -6  date:        Tue Sep 06 13:15:43 2005 -0700 -7  summary:     Introduce a typo into hello.c. -8   -9  $ hg update -10  2 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg update 2 + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg parents + changeset:   2:057d3c2d823c + user:        Bryan O'Sullivan  + date:        Tue Sep 06 13:15:43 2005 -0700 + summary:     Introduce a typo into hello.c. + + $ hg update + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved If you omit an explicit revision, “hg update” will update to the tip revision, as shown by the second call to “hg update” in the example @@ -814,33 +814,33 @@ Mercurial lets us push changes to another repository, from the repository we’re currently visiting. As with the example of “hg pull” above, we’ll create a temporary repository to push our changes into. -1  $ cd .. -2  $ hg clone hello hello-push -3  2 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ cd .. + $ hg clone hello hello-push + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved The “hg outgoing” command tells us what changes would be pushed into another repository. -1  $ cd my-hello -2  $ hg outgoing ../hello-push -3  comparing with ../hello-push -4  searching for changes -5  changeset:   5:fa1321bf0c80 -6  tag:         tip -7  user:        Bryan O'Sullivan  -8  date:        Sun Jun 17 18:05:50 2007 +0000 -9  summary:     Added an extra line of output -10   + $ cd my-hello + $ hg outgoing ../hello-push + comparing with ../hello-push + searching for changes + changeset:   5:fa1321bf0c80 + tag:         tip + user:        Bryan O'Sullivan  + date:        Sun Jun 17 18:05:50 2007 +0000 + summary:     Added an extra line of output + And the “hg push” command does the actual push. -1  $ hg push ../hello-push -2  pushing to ../hello-push -3  searching for changes -4  adding changesets -5  adding manifests -6  adding file changes -7  added 1 changesets with 1 changes to 1 files + $ hg push ../hello-push + pushing to ../hello-push + searching for changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files As with “hg pull”, the “hg push” command does not update the working directory in the repository that it’s pushing changes into. (Unlike @@ -850,10 +850,10 @@ other repository’s working directory.) What happens if we try to pull or push changes and the receiving repository already has those changes? Nothing too exciting. -1  $ hg push ../hello-push -2  pushing to ../hello-push -3  searching for changes -4  no changes found + $ hg push ../hello-push + pushing to ../hello-push + searching for changes + no changes found #### 2.8.4 Sharing changes over a network @@ -862,24 +862,24 @@ limited to working with local repositories. Each works in exactly the same fashion over a network connection; simply pass in a URL instead of a local path. -1  $ hg outgoing http://hg.serpentine.com/tutorial/hello -2  comparing with http://hg.serpentine.com/tutorial/hello -3  searching for changes -4  changeset:   5:fa1321bf0c80 -5  tag:         tip -6  user:        Bryan O'Sullivan  -7  date:        Sun Jun 17 18:05:50 2007 +0000 -8  summary:     Added an extra line of output -9   + $ hg outgoing http://hg.serpentine.com/tutorial/hello + comparing with http://hg.serpentine.com/tutorial/hello + searching for changes + changeset:   5:fa1321bf0c80 + tag:         tip + user:        Bryan O'Sullivan  + date:        Sun Jun 17 18:05:50 2007 +0000 + summary:     Added an extra line of output + In this example, we can see what changes we could push to the remote repository, but the repository is understandably not set up to let anonymous users push to it. -1  $ hg push http://hg.serpentine.com/tutorial/hello -2  pushing to http://hg.serpentine.com/tutorial/hello -3  searching for changes -4  ssl required + $ hg push http://hg.serpentine.com/tutorial/hello + pushing to http://hg.serpentine.com/tutorial/hello + searching for changes + ssl required [1]: http://hgbook.red-bean.com/hgbookch3.html [2]: http://hgbook.red-bean.com/hgbookch1.html