How does one quickly reparent a tree in mercurial such that if this is the original structure:
A-B-C-D-E-F
I want to change it to:
D-E-F
(or even A-D-E-F
would do)
I tried the suggestion in this answer with the splicemap but it fails with the error splice map revision <hash> is not being converted, ignoring'
It also prints out abort: no node!
Any help will be appreciated. Thank you.
I'd do this using the histedit
extension:
First, let's create a test repo with the structure you want:
hg init
echo "a" > file
hg ci -m "a"
echo "b" >> file
hg ci -m "b"
echo "c" >> file
hg ci -m "c"
echo "d" >> file
hg ci -m "d"
echo "e" >> file
hg ci -m "e"
echo "f" >> file
hg ci -m "f"
Then, do hg histedit
, and enter the following selections in your editor:
pick e4c09693d7a6 0 a
r 380d6d1ef006 1 b
r 33131e82bb1b 2 c
r pick 9325fb48b48e 3 d
pick 844ebb0b3844 4 e
pick bc85bc9ade8f 5 f
That will leave only three commits in the repo.
Note that for this to work the phase of the commits in your repo must be draft. You also might need to activate the histedit extension, which ships with mercurial.