29 May 2009
Notes on Mercurial / MQ and Subversion
I am currently working on some patches for a project. The project uses Subversion for version control; I won't have commit rights, but I still want to track the original sources as well as my changes. Rather than configuring svn externals (which are really thought out for different usecases, typically libraries), I decided to try my hand at one of the newest Distributed Version Control Systems, which are built exactly for this sort of scenario.
Being a Python-whore, I obviously picked Mercurial. Here's a little memo with what I've done, mostly following the page on the Mercurial wiki dedicated to Subversion interop. Note that this may not be the optimal solution, it's a work-in-progress:
- enable the MQ extension in .hgrc or Mercurial.ini
- check out the original Subversion repository
- in the checked-out copy, do
hg init
- in the same place, create a file called .hgignore, listing the files we don't want to track; typically, this means the .svn/ directory and .hgignore itself
- add all the files to Mercurial:
hg ci -Am "Original svn checkout"
- initialize MQ:
hg qinit -c
- if you have existing patches, you want to start applying them now. If they create new files, you'll need to "hg add" them
- when you want to save state, use
hg qnew -f mynewpatch
This will create a patch called "mynewpatch" in the MQ stack, listing differences with the original version, and it will consider it as applied.
In this way, I can always resync the svn repository (using svn itself), commit the new "upstream" revision to the local hg repository, then reapply the patch queue. At least in theory :)
Labels: GeekDiary, mercurial, svn
3 Comments:
At 29/5/09 12:36, Giulio Piancastelli said…
This post has been removed by the author.
At 29/5/09 12:39, Giulio Piancastelli said…
Uh, nice, I didn't know about hg command abbreviations. You learn something every day.
Well, let us know how it goes. Somehow, I feel a certain amount of inertia to overcome in the whole process.
At 6/8/09 18:16, Giulio Piancastelli said…
Also, uhm, now that I learned a bit about MQ, I wonder why it is called "Queues" since, as far as I understood, it uses a data structure with stack semantics.
Post a Comment
|Links to this post:
Create a Link
<< Home