view tests/test-merge-commit @ 5377:756a43a30e34

convert: readd --filemap To handle merges correctly, this revision adds a filemap_source class that wraps a converter_source and does the work necessary to calculate the subgraph we're interested in. The wrapped converter_source must provide a new getchangedfiles method that, given a revision rev, and an index N, returns the list of files that are different in rev and its Nth parent. The implementation depends on the ability to skip some revisions and to change the parents field of the commit objects that we returned earlier. To make the conversion restartable, we assume the revisons in the revmapfile are topologically sorted.
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Thu, 04 Oct 2007 23:21:37 -0300
parents 46280c004f22
children
line wrap: on
line source

#!/bin/sh
# check that renames are correctly saved by a commit after a merge

# test with the merge on 3 having the rename on the local parent
hg init a
cd a

echo line1 > foo
hg add foo
hg ci -m '0: add foo' -d '0 0'

echo line2 >> foo
hg ci -m '1: change foo' -d '0 0'

hg up -C 0
hg mv foo bar
rm bar
echo line0 > bar
echo line1 >> bar
hg ci -m '2: mv foo bar; change bar' -d '0 0'

hg merge 1
echo '% contents of bar should be line0 line1 line2'
cat bar
hg ci -m '3: merge with local rename' -d '0 0'
hg debugindex .hg/store/data/bar.i
hg debugrename bar
hg debugindex .hg/store/data/foo.i

# revert the content change from rev 2
hg up -C 2
rm bar
echo line1 > bar
hg ci -m '4: revert content change from rev 2' -d '0 0'

hg log --template '#rev#:#node|short# #parents#\n'
echo '% this should use bar@rev2 as the ancestor'
hg --debug merge 3
echo '% contents of bar should be line1 line2'
cat bar
hg ci -m '5: merge' -d '0 0'
hg debugindex .hg/store/data/bar.i


# same thing, but with the merge on 3 having the rename on the remote parent
echo
echo
cd ..
hg clone -U -r 1 -r 2 a b
cd b

hg up -C 1
hg merge 2
echo '% contents of bar should be line0 line1 line2'
cat bar
hg ci -m '3: merge with remote rename' -d '0 0'
hg debugindex .hg/store/data/bar.i
hg debugrename bar
hg debugindex .hg/store/data/foo.i

# revert the content change from rev 2
hg up -C 2
rm bar
echo line1 > bar
hg ci -m '4: revert content change from rev 2' -d '0 0'

hg log --template '#rev#:#node|short# #parents#\n'
echo '% this should use bar@rev2 as the ancestor'
hg --debug merge 3
echo '% contents of bar should be line1 line2'
cat bar
hg ci -m '5: merge' -d '0 0'
hg debugindex .hg/store/data/bar.i