# HG changeset patch # User Bryan O'Sullivan # Date 1176770247 25200 # Node ID 58e3a6c7672599b67b1ab7d9b955669fef5d26af # Parent 615f3c6b30e1906e6e4f2bb919c571ffbefcd2bd More branch/merge stuff. diff -r 615f3c6b30e1 -r 58e3a6c76725 en/branch.tex --- 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 diff -r 615f3c6b30e1 -r 58e3a6c76725 en/examples/branch-repo --- 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 diff -r 615f3c6b30e1 -r 58e3a6c76725 en/examples/branch-repo.merge.out --- /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 diff -r 615f3c6b30e1 -r 58e3a6c76725 en/examples/branch-repo.new.out --- 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 diff -r 615f3c6b30e1 -r 58e3a6c76725 en/examples/branch-repo.pull.out --- /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)