view tests/test-bundle @ 5378:8a2915f57dfc

convert: add a mode where mercurial_sink skips empty revisions. The getchanges function of some converter_source classes can return some false positives. I.e. they sometimes claim that a file "foo" was changed in some revision, even though its contents are still the same. convert_svn is particularly bad, but I think this can also happen with convert_cvs and, at least in theory, with mercurial_source. For regular conversions this is not really a problem - as long as getfile returns the right contents, we'll get a converted revision with the right contents. But when we use --filemap, this could lead to superfluous revisions being converted. Instead of fixing every converter_source, I decided to change mercurial_sink to work around this problem. When --filemap is used, we're interested only in revisions that touch some specific files. If a revision doesn't change any of these files, then we're not interested in it (at least for revisions with a single parent; merges are special). For mercurial_sink, we abuse this property and rollback a commit if the manifest text hasn't changed. This avoids duplicating the logic from localrepo.filecommit to detect unchanged files.
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Thu, 04 Oct 2007 23:21:37 -0300
parents a6b62584d0b2
children
line wrap: on
line source

#!/bin/sh

cp "$TESTDIR"/printenv.py .

hg init test
cd test
echo 0 > afile
hg add afile
hg commit -m "0.0" -d "1000000 0"
echo 1 >> afile
hg commit -m "0.1" -d "1000000 0"
echo 2 >> afile
hg commit -m "0.2" -d "1000000 0"
echo 3 >> afile
hg commit -m "0.3" -d "1000000 0"
hg update -C 0
echo 1 >> afile
hg commit -m "1.1" -d "1000000 0"
echo 2 >> afile
hg commit -m "1.2" -d "1000000 0"
echo "a line" > fred
echo 3 >> afile
hg add fred
hg commit -m "1.3" -d "1000000 0"
hg mv afile adifferentfile
hg commit -m "1.3m" -d "1000000 0"
hg update -C 3
hg mv afile anotherfile
hg commit -m "0.3m" -d "1000000 0"
hg verify
cd ..
hg init empty
hg -R test bundle full.hg empty
hg -R test unbundle full.hg
hg -R empty heads
hg -R empty verify

hg --cwd test pull ../full.hg
hg --cwd empty pull ../full.hg
hg -R empty rollback
hg --cwd empty pull ../full.hg

rm -r empty
hg init empty
cd empty
hg -R bundle://../full.hg log
echo '[hooks]' >> .hg/hgrc
echo 'changegroup = python ../printenv.py changegroup' >> .hg/hgrc
#doesn't work (yet ?)
#hg -R bundle://../full.hg verify
hg pull bundle://../full.hg
cd ..

rm -r empty
hg init empty
hg clone -r 3 test partial
hg clone partial partial2
cd partial
hg -R bundle://../full.hg log
hg incoming bundle://../full.hg
hg -R bundle://../full.hg outgoing ../partial2
hg -R bundle://../does-not-exist.hg outgoing ../partial2
cd ..

# test for http://www.selenic.com/mercurial/bts/issue216
rm -r empty
hg init empty
hg -R test bundle --base null -r 0 ../0.hg
hg -R test bundle --base 0    -r 1 ../1.hg
hg -R empty unbundle -u ../0.hg ../1.hg

# test for 540d1059c802
hg init orig
cd orig
echo foo > foo
hg add foo
hg ci -m 'add foo' -d '0 0'

hg clone . ../copy
hg tag -d '0 0' foo

cd ../copy
echo >> foo
hg ci -m 'change foo' -d '0 0'
hg bundle ../bundle.hg ../orig

cd ../orig
hg incoming ../bundle.hg
cd ..