changeset 199:58e3a6c76725

More branch/merge stuff.
author Bryan O'Sullivan <bos@serpentine.com>
date Mon, 16 Apr 2007 17:37:27 -0700
parents 615f3c6b30e1
children 9bba958be4c6
files en/branch.tex en/examples/branch-repo en/examples/branch-repo.merge.out en/examples/branch-repo.new.out en/examples/branch-repo.pull.out
diffstat 5 files changed, 60 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/en/branch.tex	Mon Apr 16 17:21:38 2007 -0700
+++ b/en/branch.tex	Mon Apr 16 17:37:27 2007 -0700
@@ -208,7 +208,21 @@
 isolated and unabated, in the \texttt{myproject} repository.
 \interaction{branch-repo.new}
 
+\section{Don't repeat yourself: merging across branches}
 
+In many cases, if you have a bug to fix on a maintenance branch, the
+chances are good that the bug exists on your project's main branch
+(and possibly other maintenance branches, too).  It's a rare developer
+who wants to fix the same bug multiple times, so let's look at a few
+ways that Mercurial can help you to manage these bugfixes without
+duplicating your work.
+
+In the simplest instance, all you need to do is pull changes from your
+maintenance branch into your local clone of the target branch.
+\interaction{branch-repo.pull}
+You'll then need to merge the heads of the two branches, and push back
+to the main branch.
+\interaction{branch-repo.merge}
 
 %%% Local Variables: 
 %%% mode: latex
--- a/en/examples/branch-repo	Mon Apr 16 17:21:38 2007 -0700
+++ b/en/examples/branch-repo	Mon Apr 16 17:37:27 2007 -0700
@@ -30,6 +30,19 @@
 cd ..
 hg clone myproject my-feature
 cd my-feature
-echo "I'm adding a new feature with my mind!" > mynewfile
+echo 'This sure is an exciting new feature!' > mynewfile
 hg commit -A -m 'New feature'
+hg push
 
+#$ name: pull
+
+cd ..
+hg clone myproject myproject-merge
+cd myproject-merge
+hg pull ../myproject-1.0.1
+
+#$ name: merge
+
+hg merge
+hg commit -m 'Merge bugfix from 1.0.1 branch'
+hg push
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/en/examples/branch-repo.merge.out	Mon Apr 16 17:37:27 2007 -0700
@@ -0,0 +1,11 @@
+$ \textbf{hg merge}
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+(branch merge, don't forget to commit)
+$ \textbf{hg commit -m 'Merge bugfix from 1.0.1 branch'}
+$ \textbf{hg push}
+pushing to 
+searching for changes
+adding changesets
+adding manifests
+adding file changes
+added 2 changesets with 1 changes to 1 files
--- a/en/examples/branch-repo.new.out	Mon Apr 16 17:21:38 2007 -0700
+++ b/en/examples/branch-repo.new.out	Mon Apr 16 17:37:27 2007 -0700
@@ -2,7 +2,13 @@
 $ \textbf{hg clone myproject my-feature}
 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
 $ \textbf{cd my-feature}
-$ \textbf{echo "I'm adding a new feature with my mind!" > mynewfile}
-bash: !": event not found
+$ \textbf{echo 'This sure is an exciting new feature!' > mynewfile}
 $ \textbf{hg commit -A -m 'New feature'}
-nothing changed
+adding mynewfile
+$ \textbf{hg push}
+pushing to 
+searching for changes
+adding changesets
+adding manifests
+adding file changes
+added 1 changesets with 1 changes to 1 files
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/en/examples/branch-repo.pull.out	Mon Apr 16 17:37:27 2007 -0700
@@ -0,0 +1,12 @@
+$ \textbf{cd ..}
+$ \textbf{hg clone myproject myproject-merge}
+3 files updated, 0 files merged, 0 files removed, 0 files unresolved
+$ \textbf{cd myproject-merge}
+$ \textbf{hg pull ../myproject-1.0.1}
+pulling from ../myproject-1.0.1
+searching for changes
+adding changesets
+adding manifests
+adding file changes
+added 1 changesets with 1 changes to 1 files (+1 heads)
+(run 'hg heads' to see heads, 'hg merge' to merge)