问题描述
我有一个Hg储存库,其变更集0仅表示添加.hgignore".从变更集1开始,我通过脚本从多个Subversion修订版中逐步添加了变更集.然后我和汞一起工作了一段时间.
I have a Hg repository with changeset 0 representing just "adding .hgignore". Starting with changeset 1 I added changesets step by step from a number of Subversion revisions by a script. Then I worked for some time with Hg.
现在,我决定需要更多的Svn修订版本,这些修订版本的历史记录要比开始的修订版本(Hg中的变更集1)早.
Now I decided that some more Svn revisions will be needed, which are located earlier in history than the beginning revision (changeset 1 in Hg).
是否可以在0到1之间插入新的变更集?如果是,怎么办?
Is it possible to insert new changesets between 0 and 1? If yes: How?
推荐答案
您可以为此使用 Mercurial到Mercurial 转换.为此,您需要启用转换扩展名.该扩展程序可让您拼接历史记录作为转换的一部分.这只是意味着您可以为现有变更集指定新的父级.
You can use a Mercurial to Mercurial conversion for this. You need to enable the convert extension for this. The extension will let you splice history together as part of the conversion. This simply means that you can specify new parents for an existing changeset.
因此,如果您以
$ hg glog
@ changeset: 1:aaee9686dedf
| tag: tip
| user: Martin Geisler <[email protected]>
| date: Fri Mar 23 15:08:11 2012 +0100
| summary: bar
|
o changeset: 0:17474bd28fe5
user: Martin Geisler <[email protected]>
date: Fri Mar 23 15:08:05 2012 +0100
summary: foo
您可以先从SVN导入所需的修订版本:
You can first import the needed revisions from SVN:
$ hg update null
$ run-your-script.sh
这将创建第二个根变更集-您现在实际上在存储库中有两个不相交的历史记录.我做了一个变更集,在其中添加了baz
文件:
This will create a second root changeset — you now effectively have two disjoint histories in your repository. I made a single changeset where I added a baz
file:
$ hg glog
@ changeset: 2:515e1292862b
tag: tip
parent: -1:000000000000
user: Martin Geisler <[email protected]>
date: Fri Mar 23 15:09:19 2012 +0100
summary: baz
o changeset: 1:aaee9686dedf
| user: Martin Geisler <[email protected]>
| date: Fri Mar 23 15:08:11 2012 +0100
| summary: bar
|
o changeset: 0:17474bd28fe5
user: Martin Geisler <[email protected]>
date: Fri Mar 23 15:08:05 2012 +0100
summary: foo
最后一步是将历史联系在一起:我们希望17474bd28fe5将515e1292862b作为其第一父级.使用hg log --debug
查看完整的变更集散列并使用制作切片图文件
The final step is to link the histories together: we want 17474bd28fe5 to have 515e1292862b as its first parent. Use hg log --debug
to see the full changeset hashes and make a slice map file with
17474bd28fe535c15c7dad3659994ab048146e99 515e1292862ba2d6776294ffb00c533dc6850c66
然后运行
$ hg convert --splicemap map.txt your-repo your-spliced-repo
您将在your-spliced-repo
中找到修改后的历史记录.
You will find the modified history in your-spliced-repo
.
这篇关于在变更集0(零)之前添加其他变更集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!