view tests/test-bundle @ 8849:80cc4b1a62d0

compare grep result between target and its parent I found that typical case is that grep target is added at (*) revision in the tree shown below. +--- 1(*) --- 3 0 +--- 2 ------ 4 Now, I expect 'hg grep --all' to show only rev:1 which is first appearance of target line. But 'hg grep --all' will tell: target line dis-appeared at 3 => 4 target line appeared at 2 => 3 target line dis-appeared at 1 => 2 target line appeared at 0 => 1 because current 'hg grep' implementation compares not between target revision and its parent, but between neighbor revisions in walkthrough order. I checked performance of this patch by "hg grep --follow --all walkchangerevs" on whole Mercurial repo, and patched version could complete as fast as un-patched one.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Tue, 19 May 2009 16:49:54 +0900
parents 6c82beaaa11a
children 1de6e7e1bb9f
line wrap: on
line source

#!/bin/sh

cp "$TESTDIR"/printenv.py .

echo "====== Setting up test"
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

echo "====== Bundle --all"
hg -R test bundle --all all.hg

echo "====== Bundle test to full.hg"
hg -R test bundle full.hg empty
echo "====== Unbundle full.hg in test"
hg -R test unbundle full.hg
echo "====== Verify empty"
hg -R empty heads
hg -R empty verify

echo "====== Pull full.hg into test (using --cwd)"
hg --cwd test pull ../full.hg
echo "====== Pull full.hg into empty (using --cwd)"
hg --cwd empty pull ../full.hg
echo "====== Rollback empty"
hg -R empty rollback
echo "====== Pull full.hg into empty again (using --cwd)"
hg --cwd empty pull ../full.hg

echo "====== Pull full.hg into test (using -R)"
hg -R test pull full.hg
echo "====== Pull full.hg into empty (using -R)"
hg -R empty pull full.hg
echo "====== Rollback empty"
hg -R empty rollback
echo "====== Pull full.hg into empty again (using -R)"
hg -R empty pull full.hg

echo "====== Log -R full.hg in fresh empty"
rm -r empty
hg init empty
cd empty
hg -R bundle://../full.hg log

echo "====== Pull ../full.hg into empty (with hook)"
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
echo "====== Rollback empty"
hg rollback
cd ..
echo "====== Log -R bundle:empty+full.hg"
hg -R bundle:empty+full.hg log --template="{rev} "
echo ""
echo "====== Pull full.hg into empty again (using -R; with hook)"
hg -R empty pull full.hg

echo "====== Create partial clones"
rm -r empty
hg init empty
hg clone -r 3 test partial
hg clone partial partial2
cd partial
echo "====== Log -R full.hg in partial"
hg -R bundle://../full.hg log
echo "====== Incoming full.hg in partial"
hg incoming bundle://../full.hg
echo "====== Outgoing -R full.hg vs partial2 in partial"
hg -R bundle://../full.hg outgoing ../partial2
echo "====== Outgoing -R does-not-exist.hg vs partial2 in partial"
hg -R bundle://../does-not-exist.hg outgoing ../partial2
cd ..

echo "====== Direct clone from bundle (all-history)"
hg clone full.hg full-clone
hg -R full-clone heads
rm -r full-clone

# test for http://www.selenic.com/mercurial/bts/issue216
echo "====== Unbundle incremental bundles into fresh empty in one go"
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
echo "====== test for 540d1059c802"
hg init orig
cd orig
echo foo > foo
hg add foo
hg ci -m 'add foo'

hg clone . ../copy
hg tag foo

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

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

# test for http://www.selenic.com/mercurial/bts/issue1144
echo "===== test that verify bundle does not traceback"
# partial history bundle, fails w/ unkown parent
hg -R bundle.hg verify
# full history bundle, refuses to verify non-local repo
hg -R all.hg verify
# but, regular verify must continue to work
hg -R orig verify

echo "====== diff against bundle"
hg init b
cd b
hg -R ../all.hg diff -r tip
cd ..