Because of work policies, I'm forced to use Subversion. Currently I've developed some code using Mercurial, and I have to convert this repository to a new Subversion repository. The current Mercurial repository also contains legacy code parts that I copied from another SVN repository (a HW driver), and this code contains keywords (like $Id: ...$
) that were expanded while I copied the code.
My current approach to do the conversion is:
hg convert --dest-type svn repository.hg repository.svn
This works, unfortunately it does not preserve the timestamps of Mercurial revisions. Additionally, it expands tags in some legacy code parts where someone wrote $Id: ...$
stuff.
The questions:
Sorry if this question has been answered already, I've searched intensely with Google and on here, but I cannot find an answer for this problem. Especially the timestamp problem must be something that others have already run into.
Cheers, H.
EDIT: I've since created a script that extracts timestamps from a Mercurial export file and updates a Subversion dumpfile, which is nothing more but a kludge, but it works. The $Id:
problem is still unsolved, unfortunately.
It is a tricky issue. Why aproaching the solution differently:
https://bitbucket.org/durin42/hgsubversion/wiki/Home
This is an extension to Mercurial which allows you to access it as a SVN Client, could it work for you?
I want to re-suggest hgsubversion as a solution. In the normal case, it is used to access a Subversion repository using hg
, but you can use it to convert a Mercurial repository to Subversion as well if you are not afraid to work on your history of changesets. (If you know how to work with changesets, you have quite a bit of control over the process.)
Essentially, you have to do the following steps:
hg pull
this SVN path (using hgsubversion) into your Mercurial repository. The Subversion path may have to be non-empty for this, but as long as there is no overlap with the files in the Mercurial repository, this should be fine.hg push
to send the result back to Subversion. The linear set of changes that descend from the former head of the Subversion repository will be added to the Subversion path.Check this blog article for some concrete command-line commands that you can use.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With