Compress away all parents in a repository?

对着背影说爱祢 提交于 2019-12-20 02:28:58

问题


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").

So turn

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

into

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

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


回答1:


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. 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 :)


来源:https://stackoverflow.com/questions/22382143/compress-away-all-parents-in-a-repository

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!