Managing Big-Picture Branches in Repositories
The easiest way to isolate a big-picture branch in
Mercurial is in a dedicated repository. If you have an existing shared repository—let’s call it
myproject
—that reaches a “1.0”
milestone, you can start to prepare for future maintenance releases on
top of version 1.0 by tagging the revision from which you prepared the
1.0 release.
$
cd myproject
$
hg tag v1.0
You can then clone a new shared
myproject-1.0.1
repository as of that tag.
$
cd ..
$
hg clone myproject myproject-1.0.1
updating working directory 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
Afterwards, if someone needs to work on a bug fix that
ought to go into an upcoming 1.0.1 minor release, they clone the
myproject-1.0.1
repository, make their changes, and
push them back.
$
hg clone myproject-1.0.1 my-1.0.1-bugfix
updating working directory 2 files updated, 0 files merged, 0 files removed, 0 files unresolved$
cd my-1.0.1-bugfix
$
echo 'I fixed a bug using only echo!' >> myfile
$
hg commit -m 'Important fix for 1.0.1'
$
hg push
pushing to /tmp/branch-repo8ztZpS/myproject-1.0.1 searching for changes adding changesets adding manifests adding file changes added 1 changesets with 1 changes to 1 files
Meanwhile, development for the next major release can
continue, isolated and unabated, in the myproject
repository.
$
cd ..
$
hg clone myproject my-feature
updating working directory 2 files updated, 0 files merged, 0 files removed, 0 files unresolved$
cd my-feature ...
Get Mercurial: The Definitive Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.