h1

More on Named Branches

March 20, 2010

In my named branch extrabranch, I cloned the coverage package.

C:\Users\Fatima\pony-build-hg-test>hg branch extrabranch
C:\Users\Fatima\pony-build-hg-test>ls
mercurial-repo test1 test2 test3.txt test4.py
C:\Users\Fatima\pony-build-hg-test>hg clone http://bitbucket.org/ned/coveragepy/
destination directory: coveragepy
requesting all changes
adding changesets
adding manifests
adding file changes
added 762 changesets with 1904 changes to 241 files
updating to branch default
203 files updated, 0 files merged, 0 files removed, 0 files unresolved

Checked if the package is there :
C:\Users\Fatima\pony-build-hg-test>ls
coveragepy mercurial-repo test1 test2 test3.txt test4.py
And if we are still in the same branch
C:\Users\Fatima\pony-build-hg-test>hg branch
extrabranch

Now switched to the default branch
C:\Users\Fatima\pony-build-hg-test>hg update default
resolving manifests
removing test3.txt
removing test4.py
getting test1
1 files updated, 0 files merged, 2 files removed, 0 files unresolved

C:\Users\Fatima\pony-build-hg-test>hg branch
default

The package is there.
C:\Users\Fatima\pony-build-hg-test>ls
coveragepy mercurial-repo test1 test2

Hg status doesn’t show any file added, so cannot commit or push.
C:\Users\Fatima\pony-build-hg-test>hg status
C:\Users\Fatima\pony-build-hg-test>hg commit
nothing changed

C:\Users\Fatima\pony-build-hg-test>hg push
real URL is https://bitbucket.org/cherkf/pony-build-hg-test/
pushing to https://cherkf@bitbucket.org/cherkf/pony-build-hg-test
searching for changes
no changes found

To fetch the two branches in hg, we need to hg Merge then hg commit.
In the default branch,I used the -P extension to show a preview of the merge before performing it

C:\Users\Fatima\pony-build-hg-test>hg merge -P extrabranch
changeset: 3:e2a62a3939f7
branch: extrabranch
user: Fatima Cherkaoui
date: Sat Mar 13 15:48:16 2010 -0600
description:
start a new branch

changeset: 4:d50e059fcd4f
branch: extrabranch
user: Fatima Cherkaoui
date: Sat Mar 13 16:13:14 2010 -0600
files: test3.txt
description:
‘test3.txt’

changeset: 5:b7399aa89111
branch: extrabranch
user: Fatima Cherkaoui
date: Sun Mar 14 20:04:40 2010 -0500
files: test4.py
description:
test4

changeset: 6:356d42d7cd3d
branch: extrabranch
user: Fatima Cherkaoui
date: Mon Mar 15 18:20:30 2010 -0500
files: test3.txt
description:
test3.txt

changeset: 7:1d4537588c4c
branch: extrabranch
tag: tip
user: Fatima Cherkaoui
date: Mon Mar 15 18:52:04 2010 -0500
files: test1
description:
test1

If we want to clone from a specific branch : Hg clone url -r branchName

C:\Python26>hg clone https://cherkf@bitbucket.org/cherkf/pony-build-hg-test/ -r
default
destination directory: pony-build-hg-test
requesting all changes
adding changesets
adding manifests
adding file changes
added 3 changesets with 3 changes to 2 files
updating to branch default
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
C:\Python26>cd pony-build-hg-test
C:\Python26\pony-build-hg-test>ls
test1 test2

Leave a comment