annotate tests/test-convert-bzr @ 10545:b9e4a67329cd stable

Updated contrib/vim/patchreview.* to version 0.2.1 1) adds a :DiffReview command to review code changes in the current workspace. 2) removes the need to have patchutils (specifically filterdiff) installed on the system by implementing patch extraction in pure vim script.
author Manpreet Singh <junkblocker@yahoo.com>
date Wed, 24 Feb 2010 13:12:17 -0800
parents dd24488cba2d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7053
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
1 #!/bin/sh
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
2
7058
9e6d6568bf7a `source` doesn't work for some /bin/sh, use `.` instead
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 7053
diff changeset
3 . "$TESTDIR/bzr-definitions"
7053
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
4
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
5 echo % create and rename on the same file in the same step
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
6 mkdir test-createandrename
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
7 cd test-createandrename
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
8 bzr init -q source
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
9 cd source
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
10 echo a > a
8036
dbcf5d52fcf5 test-convert-bzr: check renamed files are removed (issue1505)
Patrick Mezard <pmezard@gmail.com>
parents: 7058
diff changeset
11 echo c > c
8045
e09a2f2ef85d convert/bzr: fix file rename replaced by a dir case (issue1583)
Patrick Mezard <pmezard@gmail.com>
parents: 8036
diff changeset
12 echo e > e
e09a2f2ef85d convert/bzr: fix file rename replaced by a dir case (issue1583)
Patrick Mezard <pmezard@gmail.com>
parents: 8036
diff changeset
13 bzr add -q a c e
e09a2f2ef85d convert/bzr: fix file rename replaced by a dir case (issue1583)
Patrick Mezard <pmezard@gmail.com>
parents: 8036
diff changeset
14 bzr commit -q -m 'Initial add: a, c, e'
7053
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
15 bzr mv a b
8036
dbcf5d52fcf5 test-convert-bzr: check renamed files are removed (issue1505)
Patrick Mezard <pmezard@gmail.com>
parents: 7058
diff changeset
16 bzr mv c d
8045
e09a2f2ef85d convert/bzr: fix file rename replaced by a dir case (issue1583)
Patrick Mezard <pmezard@gmail.com>
parents: 8036
diff changeset
17 bzr mv e f
7053
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
18 echo a2 >> a
8045
e09a2f2ef85d convert/bzr: fix file rename replaced by a dir case (issue1583)
Patrick Mezard <pmezard@gmail.com>
parents: 8036
diff changeset
19 mkdir e
e09a2f2ef85d convert/bzr: fix file rename replaced by a dir case (issue1583)
Patrick Mezard <pmezard@gmail.com>
parents: 8036
diff changeset
20 bzr add -q a e
8036
dbcf5d52fcf5 test-convert-bzr: check renamed files are removed (issue1505)
Patrick Mezard <pmezard@gmail.com>
parents: 7058
diff changeset
21 bzr commit -q -m 'rename a into b, create a, rename c into d'
7053
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
22 cd ..
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
23 hg convert source source-hg
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
24 glog -R source-hg
8036
dbcf5d52fcf5 test-convert-bzr: check renamed files are removed (issue1505)
Patrick Mezard <pmezard@gmail.com>
parents: 7058
diff changeset
25 echo "% manifest"
dbcf5d52fcf5 test-convert-bzr: check renamed files are removed (issue1505)
Patrick Mezard <pmezard@gmail.com>
parents: 7058
diff changeset
26 hg manifest -R source-hg -r tip
7053
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
27 echo "% test --rev option"
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
28 hg convert -r 1 source source-1-hg
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
29 glog -R source-1-hg
8165
78658990c725 convert/bzr: make it work with filemaps (issue1631)
Patrick Mezard <pmezard@gmail.com>
parents: 8148
diff changeset
30 echo "% test with filemap"
78658990c725 convert/bzr: make it work with filemaps (issue1631)
Patrick Mezard <pmezard@gmail.com>
parents: 8148
diff changeset
31 cat > filemap <<EOF
78658990c725 convert/bzr: make it work with filemaps (issue1631)
Patrick Mezard <pmezard@gmail.com>
parents: 8148
diff changeset
32 exclude a
78658990c725 convert/bzr: make it work with filemaps (issue1631)
Patrick Mezard <pmezard@gmail.com>
parents: 8148
diff changeset
33 EOF
78658990c725 convert/bzr: make it work with filemaps (issue1631)
Patrick Mezard <pmezard@gmail.com>
parents: 8148
diff changeset
34 hg convert --filemap filemap source source-filemap-hg
78658990c725 convert/bzr: make it work with filemaps (issue1631)
Patrick Mezard <pmezard@gmail.com>
parents: 8148
diff changeset
35 hg -R source-filemap-hg manifest -r tip
8305
7a0fcdd3828f convert/bzr: handle Bazaar timestamps correctly (issue1652).
Greg Ward <greg-hg@gerg.ca>
parents: 8165
diff changeset
36
8470
dd24488cba2d convert/bzr: warn when source is a lightweight checkout (issue1647)
Patrick Mezard <pmezard@gmail.com>
parents: 8434
diff changeset
37 echo '% convert from lightweight checkout'
dd24488cba2d convert/bzr: warn when source is a lightweight checkout (issue1647)
Patrick Mezard <pmezard@gmail.com>
parents: 8434
diff changeset
38 bzr checkout --lightweight source source-light
dd24488cba2d convert/bzr: warn when source is a lightweight checkout (issue1647)
Patrick Mezard <pmezard@gmail.com>
parents: 8434
diff changeset
39 hg convert source-light source-light-hg
dd24488cba2d convert/bzr: warn when source is a lightweight checkout (issue1647)
Patrick Mezard <pmezard@gmail.com>
parents: 8434
diff changeset
40 echo "% lightweight manifest"
dd24488cba2d convert/bzr: warn when source is a lightweight checkout (issue1647)
Patrick Mezard <pmezard@gmail.com>
parents: 8434
diff changeset
41 hg manifest -R source-light-hg -r tip
dd24488cba2d convert/bzr: warn when source is a lightweight checkout (issue1647)
Patrick Mezard <pmezard@gmail.com>
parents: 8434
diff changeset
42
8305
7a0fcdd3828f convert/bzr: handle Bazaar timestamps correctly (issue1652).
Greg Ward <greg-hg@gerg.ca>
parents: 8165
diff changeset
43 # extract timestamps that look just like hg's {date|isodate}:
7a0fcdd3828f convert/bzr: handle Bazaar timestamps correctly (issue1652).
Greg Ward <greg-hg@gerg.ca>
parents: 8165
diff changeset
44 # yyyy-mm-dd HH:MM zzzz (no seconds!)
7a0fcdd3828f convert/bzr: handle Bazaar timestamps correctly (issue1652).
Greg Ward <greg-hg@gerg.ca>
parents: 8165
diff changeset
45 echo "% compare timestamps"
7a0fcdd3828f convert/bzr: handle Bazaar timestamps correctly (issue1652).
Greg Ward <greg-hg@gerg.ca>
parents: 8165
diff changeset
46 cd source
7a0fcdd3828f convert/bzr: handle Bazaar timestamps correctly (issue1652).
Greg Ward <greg-hg@gerg.ca>
parents: 8165
diff changeset
47 bzr log | \
8308
1268b895f69b test-convert-bzr: tweak sed hack to preserve timezone in 'bzr log' output
Greg Ward <greg-hg@gerg.ca>
parents: 8306
diff changeset
48 sed '/timestamp/!d;s/.\{15\}\([0-9: -]\{16\}\):.. \(.[0-9]\{4\}\)/\1 \2/' \
8305
7a0fcdd3828f convert/bzr: handle Bazaar timestamps correctly (issue1652).
Greg Ward <greg-hg@gerg.ca>
parents: 8165
diff changeset
49 > ../bzr-timestamps
7a0fcdd3828f convert/bzr: handle Bazaar timestamps correctly (issue1652).
Greg Ward <greg-hg@gerg.ca>
parents: 8165
diff changeset
50 cd ..
7a0fcdd3828f convert/bzr: handle Bazaar timestamps correctly (issue1652).
Greg Ward <greg-hg@gerg.ca>
parents: 8165
diff changeset
51
7a0fcdd3828f convert/bzr: handle Bazaar timestamps correctly (issue1652).
Greg Ward <greg-hg@gerg.ca>
parents: 8165
diff changeset
52 hg -R source-hg log --template "{date|isodate}\n" > hg-timestamps
7a0fcdd3828f convert/bzr: handle Bazaar timestamps correctly (issue1652).
Greg Ward <greg-hg@gerg.ca>
parents: 8165
diff changeset
53 if diff -q bzr-timestamps hg-timestamps ; then
7a0fcdd3828f convert/bzr: handle Bazaar timestamps correctly (issue1652).
Greg Ward <greg-hg@gerg.ca>
parents: 8165
diff changeset
54 echo "good: hg timestamps match bzr timestamps"
7a0fcdd3828f convert/bzr: handle Bazaar timestamps correctly (issue1652).
Greg Ward <greg-hg@gerg.ca>
parents: 8165
diff changeset
55 else
7a0fcdd3828f convert/bzr: handle Bazaar timestamps correctly (issue1652).
Greg Ward <greg-hg@gerg.ca>
parents: 8165
diff changeset
56 echo "fail: bzr timestamps are:"
7a0fcdd3828f convert/bzr: handle Bazaar timestamps correctly (issue1652).
Greg Ward <greg-hg@gerg.ca>
parents: 8165
diff changeset
57 cat bzr-timestamps
7a0fcdd3828f convert/bzr: handle Bazaar timestamps correctly (issue1652).
Greg Ward <greg-hg@gerg.ca>
parents: 8165
diff changeset
58 echo "but hg timestamps are:"
7a0fcdd3828f convert/bzr: handle Bazaar timestamps correctly (issue1652).
Greg Ward <greg-hg@gerg.ca>
parents: 8165
diff changeset
59 cat hg-timestamps
7a0fcdd3828f convert/bzr: handle Bazaar timestamps correctly (issue1652).
Greg Ward <greg-hg@gerg.ca>
parents: 8165
diff changeset
60 fi
7a0fcdd3828f convert/bzr: handle Bazaar timestamps correctly (issue1652).
Greg Ward <greg-hg@gerg.ca>
parents: 8165
diff changeset
61
7053
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
62 cd ..
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
63
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
64 echo % merge
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
65 mkdir test-merge
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
66 cd test-merge
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
67
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
68 cat > helper.py <<EOF
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
69 import sys
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
70 from bzrlib import workingtree
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
71 wt = workingtree.WorkingTree.open('.')
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
72
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
73 message, stamp = sys.argv[1:]
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
74 wt.commit(message, timestamp=int(stamp))
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
75 EOF
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
76
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
77 bzr init -q source
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
78 cd source
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
79 echo content > a
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
80 echo content2 > b
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
81 bzr add -q a b
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
82 bzr commit -q -m 'Initial add'
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
83 cd ..
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
84 bzr branch -q source source-improve
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
85 cd source
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
86 echo more >> a
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
87 python ../helper.py 'Editing a' 100
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
88 cd ../source-improve
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
89 echo content3 >> b
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
90 python ../helper.py 'Editing b' 200
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
91 cd ../source
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
92 bzr merge -q ../source-improve
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
93 bzr commit -q -m 'Merged improve branch'
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
94 cd ..
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
95 hg convert --datesort source source-hg
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
96 glog -R source-hg
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
97 cd ..
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
98
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
99 echo % symlinks and executable files
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
100 mkdir test-symlinks
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
101 cd test-symlinks
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
102 bzr init -q source
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
103 cd source
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
104 touch program
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
105 chmod +x program
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
106 ln -s program altname
8148
adce97d28389 convert/bzr: fix symlink handling (issue1626)
Patrick Mezard <pmezard@gmail.com>
parents: 8045
diff changeset
107 mkdir d
adce97d28389 convert/bzr: fix symlink handling (issue1626)
Patrick Mezard <pmezard@gmail.com>
parents: 8045
diff changeset
108 echo a > d/a
adce97d28389 convert/bzr: fix symlink handling (issue1626)
Patrick Mezard <pmezard@gmail.com>
parents: 8045
diff changeset
109 ln -s a syma
adce97d28389 convert/bzr: fix symlink handling (issue1626)
Patrick Mezard <pmezard@gmail.com>
parents: 8045
diff changeset
110 bzr add -q altname program syma d/a
7053
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
111 bzr commit -q -m 'Initial setup'
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
112 touch newprog
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
113 chmod +x newprog
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
114 rm altname
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
115 ln -s newprog altname
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
116 chmod -x program
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
117 bzr add -q newprog
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
118 bzr commit -q -m 'Symlink changed, x bits changed'
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
119 cd ..
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
120 hg convert source source-hg
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
121 manifest source-hg 0
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
122 manifest source-hg tip
8423
eb7be0e752d9 convert/bzr: fix symlinks target (issue1626/2)
Patrick Mezard <pmezard@gmail.com>
parents: 8165
diff changeset
123 cd source-hg
eb7be0e752d9 convert/bzr: fix symlinks target (issue1626/2)
Patrick Mezard <pmezard@gmail.com>
parents: 8165
diff changeset
124 echo % test the symlinks can be recreated
eb7be0e752d9 convert/bzr: fix symlinks target (issue1626/2)
Patrick Mezard <pmezard@gmail.com>
parents: 8165
diff changeset
125 hg up
eb7be0e752d9 convert/bzr: fix symlinks target (issue1626/2)
Patrick Mezard <pmezard@gmail.com>
parents: 8165
diff changeset
126 hg cat syma
eb7be0e752d9 convert/bzr: fix symlinks target (issue1626/2)
Patrick Mezard <pmezard@gmail.com>
parents: 8165
diff changeset
127 cd ../..