[Python-Dev] Mercurial conversion repositories

Adrian Buehlmann adrian at cadifra.com
Fri Feb 25 18:40:53 CET 2011


On 2011-02-25 17:12, Barry Warsaw wrote:
> On Feb 25, 2011, at 01:50 AM, Raymond Hettinger wrote:
> 
>>
>> On Feb 25, 2011, at 12:09 AM, Martin v. Löwis wrote:
>>
>>> I think I would have liked the strategy of the PEP better (i.e.
>>> create clones for feature branches, rather than putting all
>>> in a single repository).
>>
>> In my brief tests, the single repository has been easy to work with.
>> If they were separate, it would complicate backporting patches
>> and merges.  So, I'm happy with how George and Benjamin put this together.
> 
> 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.
> 
> 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?).

I know (almost) nothing about developing Python (this is my first post
to this list after lurking for quite a while now), but as a regular
Mercurial contributor, I think the following could be useful for you:

First, get an initial clone (let's name it 'master') over the wire
using: [1]

  $ hg clone -U ssh://hg@hg.python.org/cpython master

Then create a hardlinked clone [2] for working in each branch,
specifying the branch to check out using option -u:

  $ hg clone master py26 -u 2.6
  updating to branch 2.6
  NNN files updated, 0 files merged, 0 files removed, 0 files unresolved

  $ hg clone master py27 -u 2.7
  updating to branch 2.7
  NNN files updated, 0 files merged, 0 files removed, 0 files unresolved

  $ hg clone master trunk -u trunk
  updating to branch trunk
  NNN files updated, 0 files merged, 0 files removed, 0 files unresolved

  $ hg clone master py31 -u 3.1
  updating to branch 3.1
  NNN files updated, 0 files merged, 0 files removed, 0 files unresolved

  $ hg clone master py32 -u 3.2
  updating to branch 3.2
  NNN files updated, 0 files merged, 0 files removed, 0 files unresolved

This will be fast and save space as these local 'branch clones' will
share diskspace inside .hg/store by using hardlinks, and you need to do
the initial slow clone over the wire only once.

Note that each of these branch clones will initially have your local
master repo as the default path [3,4]. If you'd like to have the default
push/pull path to point to ssh://hg@hg.python.org/cpython instead, you'd
want to edit the [paths] section in the .hg/hgrc file in each of the
branch repos. But of course you can also leave the default paths as they
are and synchronize via the master repo (e.g. pull new changesets into
master first, and then pull into the specific branch repo).

[1] http://selenic.com/repo/hg/help/clone
[2] http://mercurial.selenic.com/wiki/HardlinkedClones
[3] http://www.selenic.com/mercurial/hgrc.5.html#paths
[4] http://selenic.com/repo/hg/help/urls


More information about the Python-Dev mailing list