tests: unify test-convert-bzr
authorMatt Mackall <mpm@selenic.com>
Sun, 26 Sep 2010 14:35:24 -0500
changeset 12512 8d84166d34d7
parent 12511 0fefeb4fff49
child 12513 d1f88ae495b4
tests: unify test-convert-bzr
tests/test-convert-authormap.t
tests/test-convert-bzr
tests/test-convert-bzr.out
tests/test-convert-bzr.t
tests/test-convert.t
--- a/tests/test-convert-bzr	Sun Sep 26 14:33:08 2010 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,127 +0,0 @@
-#!/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 ../..
--- a/tests/test-convert-bzr.out	Sun Sep 26 14:33:08 2010 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-% create and rename on the same file in the same step
-a => b
-c => d
-e => f
-initializing destination source-hg repository
-scanning source...
-sorting...
-converting...
-1 Initial add: a, c, e
-0 rename a into b, create a, rename c into d
-o  1 "rename a into b, create a, rename c into d" files: a b c d e f
-|
-o  0 "Initial add: a, c, e" files: a c e
-
-% manifest
-a
-b
-d
-f
-% test --rev option
-initializing destination source-1-hg repository
-scanning source...
-sorting...
-converting...
-0 Initial add: a, c, e
-o  0 "Initial add: a, c, e" files: a c e
-
-% test with filemap
-initializing destination source-filemap-hg repository
-scanning source...
-sorting...
-converting...
-1 Initial add: a, c, e
-0 rename a into b, create a, rename c into d
-b
-d
-f
-% convert from lightweight checkout
-initializing destination source-light-hg repository
-warning: lightweight checkouts may cause conversion failures, try with a regular branch instead.
-scanning source...
-sorting...
-converting...
-1 Initial add: a, c, e
-0 rename a into b, create a, rename c into d
-% lightweight manifest
-a
-b
-d
-f
-% compare timestamps
-good: hg timestamps match bzr timestamps
-% merge
-initializing destination source-hg repository
-scanning source...
-sorting...
-converting...
-3 Initial add
-2 Editing a
-1 Editing b
-0 Merged improve branch
-o    3 "Merged improve branch" files:
-|\
-| o  2 "Editing b" files: b
-| |
-o |  1 "Editing a" files: a
-|/
-o  0 "Initial add" files: a b
-
-% symlinks and executable files
-initializing destination source-hg repository
-scanning source...
-sorting...
-converting...
-1 Initial setup
-0 Symlink changed, x bits changed
-% manifest of 0
-644 @ altname
-644   d/a
-755 * program
-644 @ syma
-% manifest of tip
-644 @ altname
-644   d/a
-755 * newprog
-644   program
-644 @ syma
-% test the symlinks can be recreated
-5 files updated, 0 files merged, 0 files removed, 0 files unresolved
-a
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-convert-bzr.t	Sun Sep 26 14:35:24 2010 -0500
@@ -0,0 +1,209 @@
+
+  $ . "$TESTDIR/bzr-definitions"
+
+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
+  a => b
+  $ bzr mv c d
+  c => d
+  $ bzr mv e f
+  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
+  initializing destination source-hg repository
+  scanning source...
+  sorting...
+  converting...
+  1 Initial add: a, c, e
+  0 rename a into b, create a, rename c into d
+  $ glog -R source-hg
+  o  1 "rename a into b, create a, rename c into d" files: a b c d e f
+  |
+  o  0 "Initial add: a, c, e" files: a c e
+  
+
+manifest
+
+  $ hg manifest -R source-hg -r tip
+  a
+  b
+  d
+  f
+
+test --rev option
+
+  $ hg convert -r 1 source source-1-hg
+  initializing destination source-1-hg repository
+  scanning source...
+  sorting...
+  converting...
+  0 Initial add: a, c, e
+  $ glog -R source-1-hg
+  o  0 "Initial add: a, c, e" files: a c e
+  
+
+test with filemap
+
+  $ cat > filemap <<EOF
+  > exclude a
+  > EOF
+  $ hg convert --filemap filemap source source-filemap-hg
+  initializing destination source-filemap-hg repository
+  scanning source...
+  sorting...
+  converting...
+  1 Initial add: a, c, e
+  0 rename a into b, create a, rename c into d
+  $ hg -R source-filemap-hg manifest -r tip
+  b
+  d
+  f
+
+convert from lightweight checkout
+
+  $ bzr checkout --lightweight source source-light
+  $ hg convert source-light source-light-hg
+  initializing destination source-light-hg repository
+  warning: lightweight checkouts may cause conversion failures, try with a regular branch instead.
+  scanning source...
+  sorting...
+  converting...
+  1 Initial add: a, c, e
+  0 rename a into b, create a, rename c into d
+
+lightweight manifest
+
+  $ hg manifest -R source-light-hg -r tip
+  a
+  b
+  d
+  f
+
+extract timestamps that look just like hg's {date|isodate}:
+yyyy-mm-dd HH:MM zzzz (no seconds!)
+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
+  $ diff -u bzr-timestamps hg-timestamps
+  $ cd ..
+
+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
+  initializing destination source-hg repository
+  scanning source...
+  sorting...
+  converting...
+  3 Initial add
+  2 Editing a
+  1 Editing b
+  0 Merged improve branch
+  $ glog -R source-hg
+  o    3 "Merged improve branch" files:
+  |\
+  | o  2 "Editing b" files: b
+  | |
+  o |  1 "Editing a" files: a
+  |/
+  o  0 "Initial add" files: a b
+  
+  $ cd ..
+
+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
+  initializing destination source-hg repository
+  scanning source...
+  sorting...
+  converting...
+  1 Initial setup
+  0 Symlink changed, x bits changed
+  $ manifest source-hg 0
+  % manifest of 0
+  644 @ altname
+  644   d/a
+  755 * program
+  644 @ syma
+  $ manifest source-hg tip
+  % manifest of tip
+  644 @ altname
+  644   d/a
+  755 * newprog
+  644   program
+  644 @ syma
+  $ cd source-hg
+
+test the symlinks can be recreated
+
+  $ hg up
+  5 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg cat syma; echo
+  a
+