Working with Subversion
Antoine Pitrou
solipsis at pitrou.net
Mon Feb 18 09:18:49 CST 2008
Patrick Mézard <pmezard <at> gmail.com> writes:
> Details about interoperating with Subversion repositories can be found here:
>
> http://www.selenic.com/mercurial/wiki/index.cgi/WorkingWithSubversion
>
> It is not exhaustive, I expect hgsvn users to describe a typical hgsvn session
there.
Let's say you want to contribute to CPython. You first import a recent chunk of
the CPython history (starting from rev 60800 - so that it doesn't take too much
time): (*)
$ hgimportsvn -r 60800 http://svn.python.org/projects/python/trunk
$ cd trunk
$ hgpullsvn
$ cd ..
You then have a folder named "trunk" containing both an hg repo (with each
changeset mirroring an SVN revision) and an SVN checkout. It has an unique named
branch "trunk".
You clone that repo in order to start hacking:
$ hg clone trunk mybugfix
$ cd mybugfix
$ hg branch mybugfix
# Hacking session, lots of hg add/hg ci etc.
When you want to produce a patch to the maintainers, it's simple:
$ hg di -b -r trunk > mybugfix.patch
Often patches are not reviewed immediately, so you will want to regenerate them
according to the latest changes in SVN trunk. You first fetch those changes:
$ cd ../trunk
$ hgpullsvn
$ cd ../mybugfix
$ hg pull
# Merge changes from trunk into the current "mybugfix" branch
$ hg merge
$ hg ci
Then you can regenerate the patch (of course you may have to rework some code if
the latest trunk changes conflict with your modifications):
$ hg di -b -r trunk > mybugfix2.patch
IMO, using both named branches and clones is much more practical than using mq.
Regards
Antoine.
(*) actually, I have mirrors of the CPython trunk and the py3k branch here, so I
just clone from them:
http://dev.pitrou.net:8000/
More information about the Mercurial
mailing list