Transplant problems

Guido Ostkamp hg at ostkamp.fastmail.fm
Mon May 28 11:37:48 UTC 2007


Hello,

I checked out the 'transplant' extension to remove some bad changes (e.g. 
introduction of a huge binary by mistake in earlier changeset) by 
rewriting a repository ommitting that changeset. Unfortunately I got some 
problems, I would like to discuss here - any help is appreciated.

Here are some simple testcases (description below):

# --- snip --- snap ---
echo '### Preparing Testcases ###'
rm -fr test1 test2 test3 test4
hg init test1
cd test1
echo "first version" > file
hg add file
hg commit -m "initial" file
echo "second version" > file
hg commit -m "change 1" file
echo "third version" > file
hg commit -m "change 2" file
cd ..

echo '### Testcase 1 ###'
hg init test2
cd test2
hg transplant -s ../test1 0 2
cd ..

echo '### Testcase 2 ###'
hg init test3
cd test3
touch file
hg add file
hg commit -m "dummy" file
hg transplant -s ../test1 0
hg transplant -s ../test1 2
cd ..

echo '### Testcase 3 ###'
hg init test4
cd test4
touch file
hg add file
hg commit -m "dummy" file
hg transplant -s ../test1 -p 1
cd ..
# --- snip --- snap ---


I have got three versions of a 'file' in changesets 0-2 of repository 
'test1'. I want to remove changeset 1.

Problem #1:

For an unknown reason testcase 1 fails with the error message 'abort: no 
revision checked out'. This appears strange, as changeset 0 should 
initially create the file and I don't see any problem to do this in an 
empty repository 'test2'.

Problem #2:

After creating an empty file, replaying changeset 0 on top of this went 
ok. However, applying changeset 2 fails because the patch created doesn't 
fit.

Problem #3:

With changed syntax (omit 1) a question pops up whether to apply changeset 
0. This was not the case in testcase 2. Secondly applying changeset 2 
fails again for the same reason as in Problem #2.


In my mind, the solution to problem #2 and #3 (2nd part) would be to 
simply import the file versions as present in the changeset to be imported 
(e.g. result from 'hg cat -r 2 file' in 'test1' repository) for all files, 
where patching failed.

I can't see, why there is no option to do this automatically.

Any ideas?

Regards

Guido



More information about the Mercurial mailing list