changeset 203:d7615e15510f

More about named branches, and early use of them.
author Bryan O'Sullivan <bos@serpentine.com>
date Fri, 20 Apr 2007 14:35:39 -0700
parents 6f167e644762
children 927e74f0e838
files en/branch.tex en/examples/branch-named
diffstat 2 files changed, 52 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/en/branch.tex	Fri Apr 20 14:02:10 2007 -0700
+++ b/en/branch.tex	Fri Apr 20 14:35:39 2007 -0700
@@ -256,8 +256,38 @@
 
 To start working with named branches, use the \hgcmd{branches}
 command.  This command lists the named branches already present in
-your repository.
+your repository, telling you which changeset is the tip of each.
 \interaction{branch-named.branches}
+Since you haven't created any named branches yet, the only one that
+exists is \texttt{default}.
+
+To find out what the ``current'' branch is, run the \hgcmd{branch}
+command, giving it no arguments.  This tells you what branch the
+parent of the current changeset is on.
+\interaction{branch-named.branch}
+
+To create a new branch, run the \hgcmd{branch} command again.  This
+time, give it one argument: the name of the branch you want to create.
+\interaction{branch-named.create}
+
+After you've created a branch, you might wonder what effect the
+\hgcmd{branch} command has had.  What do the \hgcmd{status} and
+\hgcmd{tip} commands report?
+\interaction{branch-named.status}
+Nothing has changed in the working directory, and there's been no new
+history created.  As this suggests, running the \hgcmd{branch} command
+has no permanent effect; it only tells Mercurial what branch name to
+use the \emph{next} time you commit a changeset.
+
+When you commit a change, Mercurial records the name of the branch on
+which you committed.  Once you've switched from the \texttt{default}
+branch to another and committed, you'll see the name of the new branch
+show up in the output of \hgcmd{log}, \hgcmd{tip}, and other commands
+that display the same kind of output.
+\interaction{branch-named.commit}
+The \hgcmd{log}-like commands will print the branch name of every
+changeset that's not on the \texttt{default} branch, so if you never
+use named branches, you'll never see this information.
 
 %%% Local Variables: 
 %%% mode: latex
--- a/en/examples/branch-named	Fri Apr 20 14:02:10 2007 -0700
+++ b/en/examples/branch-named	Fri Apr 20 14:35:39 2007 -0700
@@ -7,4 +7,25 @@
 
 #$ name: branches
 
+hg tip
 hg branches
+
+#$ name: branch
+
+hg branch
+
+#$ name: create
+
+hg branch foo
+hg branch
+
+#$ name: status
+
+hg status
+hg tip
+
+#$ name: commit
+
+echo 'hello again' >> myfile
+hg commit -m 'Second commit'
+hg tip