问题
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:
- Update the source repo to the the new "initial commit" (
xin your diagram) - Copy (file copy, not clone!) to the target directory and
hg inita new repo - use hg convert with the
--splicemapoption to say "start at revisionxin 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
andsplicemap.txthas[hash-of-x-in-old-repo] [hash-of-x-in-new-repo] - 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