压缩掉存储库中的所有父母? [英] Compress away all parents in a repository?

查看:73
本文介绍了压缩掉存储库中的所有父母?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我删除了我的最后一个问题,因为我想我会问一个更简单的问题:有没有办法压缩节点的所有父节点(基本上,假装存储库从这里开始").

I removed my last question because I think I'll ask a more simple question: Is there a way to compress ALL parents of a node (Basically, "pretend the repository starts here").

所以转

 o---o----o---o----o ....... x--+--+----+--+----+
     \    \        /                 \         /
      o---o---o----o                  *----*---*

进入

 x--+--+----+--+----+
 \         /
  *----*---*

(如果我可以修改x,但乞be不能成为选择者,那就更好了)

(Even better if I can modify x, but beggars can't be choosers)

推荐答案

在这里,我将通过制作一个新的存储库来处理它,该存储库将具有您想要的使用

Here's how I would approach it by making a new repo that will have the history you'd like using the Convert Extention:

  1. 将源存储库更新为新的初始提交"(在图中为x)
  2. 复制(文件副本,而不是克隆文件!)到目标目录并hg init一个新的仓库
  3. --splicemap选项中使用 hg convert 表示从修订版开始x在源存储库中,并将其应用于目标存储库中的修订版0".例如(注意:未经测试!)
    hg convert --splicemap splicemap.txt .\old-repo .\new-repo
    并且splicemap.txt具有
    [hash-of-x-in-old-repo] [hash-of-x-in-new-repo]
  4. 然后我会压缩源存储库,以防万一我再次需要它:)
  1. Update the source repo to the the new "initial commit" (x in your diagram)
  2. Copy (file copy, not clone!) to the target directory and hg init a new repo
  3. use hg convert with the --splicemap option to say "start at revision x in the source repo and apply it to revision 0 in the target repo". e.g. (note: untested!)
    hg convert --splicemap splicemap.txt .\old-repo .\new-repo
    and splicemap.txt has
    [hash-of-x-in-old-repo] [hash-of-x-in-new-repo]
  4. I'd then zip up the source repo in case I ever needed it again :)

这篇关于压缩掉存储库中的所有父母?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆