hgbook
changeset 199:58e3a6c76725
More branch/merge stuff.
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Mon Apr 16 17:37:27 2007 -0700 (2007-04-16) |
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 |
line diff
1.1 --- a/en/branch.tex Mon Apr 16 17:21:38 2007 -0700 1.2 +++ b/en/branch.tex Mon Apr 16 17:37:27 2007 -0700 1.3 @@ -208,7 +208,21 @@ 1.4 isolated and unabated, in the \texttt{myproject} repository. 1.5 \interaction{branch-repo.new} 1.6 1.7 - 1.8 +\section{Don't repeat yourself: merging across branches} 1.9 + 1.10 +In many cases, if you have a bug to fix on a maintenance branch, the 1.11 +chances are good that the bug exists on your project's main branch 1.12 +(and possibly other maintenance branches, too). It's a rare developer 1.13 +who wants to fix the same bug multiple times, so let's look at a few 1.14 +ways that Mercurial can help you to manage these bugfixes without 1.15 +duplicating your work. 1.16 + 1.17 +In the simplest instance, all you need to do is pull changes from your 1.18 +maintenance branch into your local clone of the target branch. 1.19 +\interaction{branch-repo.pull} 1.20 +You'll then need to merge the heads of the two branches, and push back 1.21 +to the main branch. 1.22 +\interaction{branch-repo.merge} 1.23 1.24 %%% Local Variables: 1.25 %%% mode: latex
2.1 --- a/en/examples/branch-repo Mon Apr 16 17:21:38 2007 -0700 2.2 +++ b/en/examples/branch-repo Mon Apr 16 17:37:27 2007 -0700 2.3 @@ -30,6 +30,19 @@ 2.4 cd .. 2.5 hg clone myproject my-feature 2.6 cd my-feature 2.7 -echo "I'm adding a new feature with my mind!" > mynewfile 2.8 +echo 'This sure is an exciting new feature!' > mynewfile 2.9 hg commit -A -m 'New feature' 2.10 +hg push 2.11 2.12 +#$ name: pull 2.13 + 2.14 +cd .. 2.15 +hg clone myproject myproject-merge 2.16 +cd myproject-merge 2.17 +hg pull ../myproject-1.0.1 2.18 + 2.19 +#$ name: merge 2.20 + 2.21 +hg merge 2.22 +hg commit -m 'Merge bugfix from 1.0.1 branch' 2.23 +hg push
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/en/examples/branch-repo.merge.out Mon Apr 16 17:37:27 2007 -0700 3.3 @@ -0,0 +1,11 @@ 3.4 +$ \textbf{hg merge} 3.5 +1 files updated, 0 files merged, 0 files removed, 0 files unresolved 3.6 +(branch merge, don't forget to commit) 3.7 +$ \textbf{hg commit -m 'Merge bugfix from 1.0.1 branch'} 3.8 +$ \textbf{hg push} 3.9 +pushing to 3.10 +searching for changes 3.11 +adding changesets 3.12 +adding manifests 3.13 +adding file changes 3.14 +added 2 changesets with 1 changes to 1 files
4.1 --- a/en/examples/branch-repo.new.out Mon Apr 16 17:21:38 2007 -0700 4.2 +++ b/en/examples/branch-repo.new.out Mon Apr 16 17:37:27 2007 -0700 4.3 @@ -2,7 +2,13 @@ 4.4 $ \textbf{hg clone myproject my-feature} 4.5 2 files updated, 0 files merged, 0 files removed, 0 files unresolved 4.6 $ \textbf{cd my-feature} 4.7 -$ \textbf{echo "I'm adding a new feature with my mind!" > mynewfile} 4.8 -bash: !": event not found 4.9 +$ \textbf{echo 'This sure is an exciting new feature!' > mynewfile} 4.10 $ \textbf{hg commit -A -m 'New feature'} 4.11 -nothing changed 4.12 +adding mynewfile 4.13 +$ \textbf{hg push} 4.14 +pushing to 4.15 +searching for changes 4.16 +adding changesets 4.17 +adding manifests 4.18 +adding file changes 4.19 +added 1 changesets with 1 changes to 1 files
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 5.2 +++ b/en/examples/branch-repo.pull.out Mon Apr 16 17:37:27 2007 -0700 5.3 @@ -0,0 +1,12 @@ 5.4 +$ \textbf{cd ..} 5.5 +$ \textbf{hg clone myproject myproject-merge} 5.6 +3 files updated, 0 files merged, 0 files removed, 0 files unresolved 5.7 +$ \textbf{cd myproject-merge} 5.8 +$ \textbf{hg pull ../myproject-1.0.1} 5.9 +pulling from ../myproject-1.0.1 5.10 +searching for changes 5.11 +adding changesets 5.12 +adding manifests 5.13 +adding file changes 5.14 +added 1 changesets with 1 changes to 1 files (+1 heads) 5.15 +(run 'hg heads' to see heads, 'hg merge' to merge)