这里和这里也有类似的问题,但是它们并不相同,因为它们是询问一般意义上如何将 Mercurial 和 subversion 一起使用。
仔细阅读 Mercurial 和 Subversion 页面,有四个选项,hgsubversion、mq、convert和 hgsvn。 hgsubversion 和 Convert 都需要存储库的完整本地副本,而我的存储库非常大(10+ gig),主要是对我没有用的二进制签入,所以我不热衷于这个选项。另一方面,mq 不允许任何离线历史搜索,因此违背了想要使用 Mercurial 的主要原因之一。
这将选项范围缩小到使用 hgsvn。我已经安装了这个并正在使用它,它似乎可以完成我想要的大部分功能。由于各种原因(主要与磁盘空间有关),我并不真正关心六个月以上的历史记录,因此我希望能够仅保留六个月的历史记录。然而,当您使用 hgimportsvn 设置 svn 树的副本时,您设置了要导入的初始存储库,并且当这些初始修订移出六个月窗口时,无法(使用 hgsvn)删除它们。
查看 https://www.mercurial-scm.org/wiki/EditingHistory 那里似乎不是一种容易实现此目的的自动化方法。 HistEdit 扩展确实允许完全执行我想要的操作,但似乎无法编写脚本。我对 MQ 的理解是,它不会做我想要的事情,因为它永远不会删除第一个修订版,尽管它可能用于折叠一些中间修订版。
编辑:尝试澄清一下我的问题。
基本上,我想要做的是将 subversion 的最后 1000 个修订版保留在我的 Mercurial 存储库中。一开始这很容易做到:
hgimportsvn -r$((TRUNKREV-1000)) $TRUNKURL
但是,一周后,我的 Mercurial 存储库中现在有 1200 个修订,因此我想通过删除/折叠前 200 个修订,将其再次减少到 1000 个。
有谁知道该怎么做?
There are similar questions here and here, however they are not the same, as they are asking about using mercurial and subversion together in a general sense.
Reading through the Mercurial and Subversion page, there are four options, hgsubversion, mq, convert and hgsvn. hgsubversion and convert both require a full local copy of the repository, and my repository is massively large (10+ gigs), mostly in binary checkins that are not useful to me, so I am not keen on this option. mq on the other hand doesn't allow any offline history searching, and so defeats one of the main reasons for wanting to use mercurial.
This narrows the options down to using hgsvn. I have installed this and am playing with it, and it seems to do most of what I want. For various reasons, mostly to do with disk space, I don't really care about the history from more than six months back, so I would like to be able to keep only six months of history. However when you use hgimportsvn to set up your copy of the svn tree, you set the initial repository to import, and there is no way (using hgsvn) to remove those initial revisions when they move out of the six month window.
Looking at https://www.mercurial-scm.org/wiki/EditingHistory there does not appear to be an easily automatable way of doing this. The HistEdit extension does allow doing exactly what I want, but does not seem to be scriptable. My understanding of MQ is that it won't do what I want, since it will never remove the first revision, although it could potentially be used to fold some of the middle revisions.
Edit: To try and clarify my question a little.
Basically, what I want to do is to keep the last 1000 revisions of subversion in my mercurial repository. This is easy to do to start off:
hgimportsvn -r$((TRUNKREV-1000)) $TRUNKURL
However, after a week my mercurial repository now has 1200 revisions in it, so I want to cut it back to 1000 again, by removing/collapsing the first 200 revisions.
Does anyone know how to do this?
发布评论
评论(1)
您不能将转换扩展与 --config Convert.svn.startrev=STARTREV 选项一起使用吗?
Cannot you use convert extension with --config convert.svn.startrev=STARTREV option?