如何插入或更改 Mercurial 修订版
如何更改 r0
使其看起来像是在创建存储库时添加了 .hgignore
或在当前的 r0
之前插入提交?
我刚刚使用 hgsvn 将一个巨大的 SVN 存储库转换为 Mercurial。花了几个小时,并且必须经过大约十几个分行才能拿到整个东西。我现在的问题是 .hgignore
没有提交,所以当我 hgimportsvn
分支时,.hgignore
似乎没有附带它。我想将该文件作为 r0 的一部分插入或在其之前插入(并将所有内容移 1)。我也尝试在我的 Mercurial 主干结帐结束时提交它,但似乎 hgimportsvn
总是从我的 SVN 分支创建的同一个 Mercurial 版本克隆(分支?),所以 .hgignore
又丢失了。
How can I alter r0
so it looks like I added .hgignore
when I created my repository or insert a commit before my current r0
?
I just converted a huge SVN repo using hgsvn to mercurial. It took several hours and had to go through about a dozen branches to get the whole thing. My problem now is that .hgignore
isn't committed, so when I hgimportsvn
a branch, the .hgignore
doesn't seem to come with it. I would like to insert that file as part of r0
or insert it before that (and shift everything by 1). I've also tried committing it at the end of my Mercurial trunk checkout, but it seems hgimportsvn
always clones (branches?) from the same Mercurial revision my SVN branch was created from so .hgignore
is lost again.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可能需要类似 ConvertExtension 的东西。查看
--splicemap
选项。要使用添加为第一个修订版的 .hgignore 文件创建新历史记录:
这会将当前数据库中的每个修订添加到新数据库中。 splicemap 指定对父级的编辑,因此如果当前数据库的修订版 0 将其父级设置为新数据库的修订版 0。
下面是一个 Windows 批处理文件,它创建一个 3 修订版数据库和一个 1 修订版数据库,其中包含 .hgignore 文件,并将它们拼接在一起。结果应该是您正在寻找的结果。如果您有一个大型原始数据库,则可能需要一段时间,因为源数据库的整个历史记录都会被重写到目标数据库。
You probably need something like the ConvertExtension. Check out the
--splicemap
option.To create a new history with a .hgignore file added as the first revision:
hg convert <current_db_dir> <new_db_dir> --splicemap splice_filename
This adds each revision in the current database to the new database. The splicemap specifies editing of parents, so if revision 0 of the current database gets its parent set to revision 0 of the new database.
Below is a Windows batch file that creates a 3-revision database and a 1-revision database with an .hgignore file in it, the splices them together. The result should be what you are looking for. If you have a large original database it could take a while, since the entire history of the source database is re-written to the destination database.
也许您可以提交 .hgignore,然后将提交重新设置为历史记录的开头(请参阅 https:// www.mercurial-scm.org/wiki/RebaseProject)。
Maybe you could commit .hgignore and then rebase the commit to the beginning of history (see https://www.mercurial-scm.org/wiki/RebaseProject).