tests/test-convert-bzr
author Nicolas Dumazet <nicdumz.commits@gmail.com>
Sat, 23 May 2009 18:44:01 +0900
changeset 8600 d46cdfcecaf1
parent 8470 dd24488cba2d
permissions -rwxr-xr-x
inotify: proper fix for issue1542 (partially reverting 67e59a9886d5) issue1542 description: Unknown files (?) placed in a directory are still marked as present and unknown when the containing directory is moved out of the repository scope. Why 67e59a9886d5 was bad: * When the problem we're addressing only deals with unknown files, the fix to updatestatus applies for all statuses * The only reason to move the call schedule_work(wpath, 'd') seems to be that it allowed an updatestatus call on the deleted directory, in deleted(). But deleted() should not be called on directories in the first place. * After fixing an independant issue (1371), test-inotify-issue1542 was failing Fix: When processing a deletion of a directory, walk the tree of the unknown files and remove the entries from repowatcher. This step does not need to be added in the generic scan() routine: it is only necessary on a directory deletion.

#!/bin/sh

. "$TESTDIR/bzr-definitions"

echo % create and rename on the same file in the same step
mkdir test-createandrename
cd test-createandrename
bzr init -q source
cd source
echo a > a
echo c > c
echo e > e
bzr add -q a c e
bzr commit -q -m 'Initial add: a, c, e'
bzr mv a b
bzr mv c d
bzr mv e f
echo a2 >> a
mkdir e
bzr add -q a e
bzr commit -q -m 'rename a into b, create a, rename c into d'
cd ..
hg convert source source-hg
glog -R source-hg
echo "% manifest"
hg manifest -R source-hg -r tip
echo "% test --rev option"
hg convert -r 1 source source-1-hg
glog -R source-1-hg
echo "% test with filemap"
cat > filemap <<EOF
exclude a
EOF
hg convert --filemap filemap source source-filemap-hg
hg -R source-filemap-hg manifest -r tip

echo '% convert from lightweight checkout'
bzr checkout --lightweight source source-light
hg convert source-light source-light-hg
echo "% lightweight manifest"
hg manifest -R source-light-hg -r tip

# extract timestamps that look just like hg's {date|isodate}:
# yyyy-mm-dd HH:MM zzzz (no seconds!)
echo "% compare timestamps"
cd source
bzr log | \
  sed '/timestamp/!d;s/.\{15\}\([0-9: -]\{16\}\):.. \(.[0-9]\{4\}\)/\1 \2/' \
  > ../bzr-timestamps
cd ..

hg -R source-hg log --template "{date|isodate}\n" > hg-timestamps
if diff -q bzr-timestamps hg-timestamps ; then
  echo "good: hg timestamps match bzr timestamps"
else
  echo "fail: bzr timestamps are:"
  cat bzr-timestamps
  echo "but hg timestamps are:"
  cat hg-timestamps
fi

cd ..

echo % merge
mkdir test-merge
cd test-merge

cat > helper.py <<EOF
import sys
from bzrlib import workingtree
wt = workingtree.WorkingTree.open('.')

message, stamp = sys.argv[1:]
wt.commit(message, timestamp=int(stamp))
EOF

bzr init -q source
cd source
echo content > a
echo content2 > b
bzr add -q a b
bzr commit -q -m 'Initial add'
cd ..
bzr branch -q source source-improve
cd source
echo more >> a
python ../helper.py 'Editing a' 100
cd ../source-improve
echo content3 >> b
python ../helper.py 'Editing b' 200
cd ../source
bzr merge -q ../source-improve
bzr commit -q -m 'Merged improve branch'
cd ..
hg convert --datesort source source-hg
glog -R source-hg
cd ..

echo % symlinks and executable files
mkdir test-symlinks
cd test-symlinks
bzr init -q source
cd source
touch program
chmod +x program
ln -s program altname
mkdir d
echo a > d/a
ln -s a syma
bzr add -q altname program syma d/a
bzr commit -q -m 'Initial setup'
touch newprog
chmod +x newprog
rm altname
ln -s newprog altname
chmod -x program
bzr add -q newprog
bzr commit -q -m 'Symlink changed, x bits changed'
cd ..
hg convert source source-hg
manifest source-hg 0
manifest source-hg tip
cd source-hg
echo % test the symlinks can be recreated
hg up
hg cat syma
cd ../..