[Python-Dev] Mercurial conversion repositories

Antoine Pitrou solipsis at pitrou.net
Fri Feb 25 17:29:01 CET 2011


Hi Barry,

> The way I work with the Subversion branches is to have all the active branches
> checked out into separate directories under a common parent, e.g.
> 
> ~/projects/python/py26
> ~/projects/python/py27
> ~/projects/python/trunk
> ~/projects/python/py31
> ~/projects/python/py32
> ~/projects/python/py3k
> 
> This makes it very easy to just cd, svn up, make distclean, configure, make to
> test things.  How can I do this with the hg clone when all the branches are
> in the single repository, but more or less hidden?  After doing the 'hg clone'
> operation specified by Antoine, I'm left with a single cpython directory
> containing (iiuc) the contents of the 'default' branch.

Indeed, the default branch is checked out by default. But you can
switch to another branch:

$ hg sum
parent: 68026:f12ef116dd10 tip
 In FTP.close() method, make sure to also close the socket object, not only the file.
branch: default
commit: (clean)
update: (current)

$ hg up 2.7
3310 files updated, 0 files merged, 378 files removed, 0 files unresolved

$ hg sum
parent: 68010:8174d00d0797 
 Merged revisions 88486 via svnmerge from
branch: 2.7
commit: (clean)
update: (current)

("hg sum" is a shorthand for "hg summary")

Furthermore, once you have a local clone, you can clone it further to
get several independent clones, and keep each of them updated on
whatever branch you want. This makes it easy to replicate your workflow
(by having a "master clone" - a mirror if you want - and then child
clones that get updated from the master clone by running "hg pull").

> I'm sure I'm not the only one who works this way with Subversion.  IWBN to
> cover this in the devguide (or is it there and I missed it?).

Use of "hg update" to switch between branches is mentioned in 
http://potrou.net/hgdevguide/setup.html#getting-the-source-code
and also http://potrou.net/hgdevguide/coredev.html#read-write-checkout
and also in
http://potrou.net/hgdevguide/committing.html#porting-within-a-major-version.

But a dedicated FAQ entry could be added.

Regards

Antoine.




More information about the Python-Dev mailing list