如何将 svn 存储库中已删除的路径导入 git 或 Mercurial

发布于 2024-10-06 18:34:51 字数 373 浏览 7 评论 0原文

我需要对我们公司 svn 存储库中 svn 删除的路径中的源进行一些研究。由于我需要大量使用注释,因此我希望拥有 Mercurial 或 git 中的历史记录。到目前为止我尝试过:

  • hgsubversiongit-svn:对于这两个程序,我找不到一种方法来指定我需要路径存在的较旧版本,两者都尝试svn HEAD 并失败,因为那里的路径已被删除。
  • hgsvn:它找到旧路径(带有 peg 修订版),但无法执行初始更新,因为它想要从 svn HEAD 修订版获取日志,而所需路径不存在不再了。

那么有没有办法将删除的svn路径导入到git或hg中呢?

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 from 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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

阿楠 2024-10-13 18:34:51

假设该路径在修订版 117 上被删除,以下内容应该适用于 hgsubversion:(

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

我最近没有测试过这个,但它应该可以工作。如果没有,那就是一个错误......)

您还应该注意,尽管 khmarbaise 声称,关闭 Mercurial 中的分支不会将其从历史记录中删除。关闭分支只会将其隐藏在 hg head 中,除非给出了 -c/--angled 参数。

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.

旧人九事 2024-10-13 18:34:51

据我所知 git 和 hg 都无法处理已删除的路径。如果您删除 git 中的分支,该分支将从历史记录中删除。

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.

标点 2024-10-13 18:34:51

从你的问题中不清楚为什么你需要 git 或 hg 。您可以只使用svn annotate。在SVN中分析删除的对象不是问题,您可以使用 peg revision 像这样:

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

即使某些文件在修订版 321 之后的某个时间被删除或重命名,这也会起作用。

编辑: 经过思考,我猜你想要 hg/ git,因为拥有存储库的本地副本可能会大大加快注释速度。您可以通过使用 svnsync,并使用 file:/// URL 访问它。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文