开发者

How to import a deleted path in a svn repositroy into git or mercurial

I need to do some research about sources in a svn-deleted path in our company svn repository. Since I need to work a lot with annotate, I want to have the history in mercurial or git. I tried so far:

  • hgsubversion and git-svn: For both programs I can't find a way to specify that I need a older revision where the path existed, both try the svn HEAD and fail since the path is deleted there.
  • hgsvn: It finds the old path (with a peg revision), but fails to do the initial update, since it wants to get the log f开发者_StackOverflow社区rom the svn HEAD revision, where the wanted path doesn't exist anymore.

So is there a way to import a deleted svn path into git or hg?


Assuming that the path was deleted on revision 117, the following should work with hgsubversion:

hg clone -r 116 http://svn.example.com/whereever

(I haven't tested this recently, but it should work. It's a bug if it doesn't…)

You should also note that despite what khmarbaise claimed, closing a branch in Mercurial does not delete it from history. Closing a branch will merely hide it from hg heads unless the -c/--closed argument is given.


As far as I know neither git nor hg is capable of handling deleted paths. If you delete a branch in git the branch is removed from history.


It's not clear from your question why you need git or hg. You can just use svn annotate. It is not a problem to analyze a deleted objects in SVN, you can use a peg revision like so:

svn annotate http://example.com/svn/somefile@321

This will work even when somefile has been deleted or renamed some time after revision 321.

edit: After thinking about it, I'm guessing you want hg/git because having a local copy of the repository might speed up annotation considerably. You can achieve the same with svn by creating a mirror repository on your local filesystem with svnsync, and accessing it with a file:/// URL.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜