Mercurial > hg
annotate tests/test-convert-bzr @ 8434:4a3e7c380834
Merge with crew-stable
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Fri, 15 May 2009 16:17:56 +0200 |
parents | 1268b895f69b eb7be0e752d9 |
children | dd24488cba2d |
rev | line source |
---|---|
7053 | 1 #!/bin/sh |
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 | 4 |
5 echo % create and rename on the same file in the same step | |
6 mkdir test-createandrename | |
7 cd test-createandrename | |
8 bzr init -q source | |
9 cd source | |
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 | 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 | 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 | 22 cd .. |
23 hg convert source source-hg | |
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 | 27 echo "% test --rev option" |
28 hg convert -r 1 source source-1-hg | |
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 |
7a0fcdd3828f
convert/bzr: handle Bazaar timestamps correctly (issue1652).
Greg Ward <greg-hg@gerg.ca>
parents:
8165
diff
changeset
|
37 # 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
|
38 # 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
|
39 echo "% compare timestamps" |
7a0fcdd3828f
convert/bzr: handle Bazaar timestamps correctly (issue1652).
Greg Ward <greg-hg@gerg.ca>
parents:
8165
diff
changeset
|
40 cd source |
7a0fcdd3828f
convert/bzr: handle Bazaar timestamps correctly (issue1652).
Greg Ward <greg-hg@gerg.ca>
parents:
8165
diff
changeset
|
41 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
|
42 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
|
43 > ../bzr-timestamps |
7a0fcdd3828f
convert/bzr: handle Bazaar timestamps correctly (issue1652).
Greg Ward <greg-hg@gerg.ca>
parents:
8165
diff
changeset
|
44 cd .. |
7a0fcdd3828f
convert/bzr: handle Bazaar timestamps correctly (issue1652).
Greg Ward <greg-hg@gerg.ca>
parents:
8165
diff
changeset
|
45 |
7a0fcdd3828f
convert/bzr: handle Bazaar timestamps correctly (issue1652).
Greg Ward <greg-hg@gerg.ca>
parents:
8165
diff
changeset
|
46 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
|
47 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
|
48 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
|
49 else |
7a0fcdd3828f
convert/bzr: handle Bazaar timestamps correctly (issue1652).
Greg Ward <greg-hg@gerg.ca>
parents:
8165
diff
changeset
|
50 echo "fail: bzr timestamps are:" |
7a0fcdd3828f
convert/bzr: handle Bazaar timestamps correctly (issue1652).
Greg Ward <greg-hg@gerg.ca>
parents:
8165
diff
changeset
|
51 cat bzr-timestamps |
7a0fcdd3828f
convert/bzr: handle Bazaar timestamps correctly (issue1652).
Greg Ward <greg-hg@gerg.ca>
parents:
8165
diff
changeset
|
52 echo "but hg timestamps are:" |
7a0fcdd3828f
convert/bzr: handle Bazaar timestamps correctly (issue1652).
Greg Ward <greg-hg@gerg.ca>
parents:
8165
diff
changeset
|
53 cat hg-timestamps |
7a0fcdd3828f
convert/bzr: handle Bazaar timestamps correctly (issue1652).
Greg Ward <greg-hg@gerg.ca>
parents:
8165
diff
changeset
|
54 fi |
7a0fcdd3828f
convert/bzr: handle Bazaar timestamps correctly (issue1652).
Greg Ward <greg-hg@gerg.ca>
parents:
8165
diff
changeset
|
55 |
7053 | 56 cd .. |
57 | |
58 echo % merge | |
59 mkdir test-merge | |
60 cd test-merge | |
61 | |
62 cat > helper.py <<EOF | |
63 import sys | |
64 from bzrlib import workingtree | |
65 wt = workingtree.WorkingTree.open('.') | |
66 | |
67 message, stamp = sys.argv[1:] | |
68 wt.commit(message, timestamp=int(stamp)) | |
69 EOF | |
70 | |
71 bzr init -q source | |
72 cd source | |
73 echo content > a | |
74 echo content2 > b | |
75 bzr add -q a b | |
76 bzr commit -q -m 'Initial add' | |
77 cd .. | |
78 bzr branch -q source source-improve | |
79 cd source | |
80 echo more >> a | |
81 python ../helper.py 'Editing a' 100 | |
82 cd ../source-improve | |
83 echo content3 >> b | |
84 python ../helper.py 'Editing b' 200 | |
85 cd ../source | |
86 bzr merge -q ../source-improve | |
87 bzr commit -q -m 'Merged improve branch' | |
88 cd .. | |
89 hg convert --datesort source source-hg | |
90 glog -R source-hg | |
91 cd .. | |
92 | |
93 echo % symlinks and executable files | |
94 mkdir test-symlinks | |
95 cd test-symlinks | |
96 bzr init -q source | |
97 cd source | |
98 touch program | |
99 chmod +x program | |
100 ln -s program altname | |
8148
adce97d28389
convert/bzr: fix symlink handling (issue1626)
Patrick Mezard <pmezard@gmail.com>
parents:
8045
diff
changeset
|
101 mkdir d |
adce97d28389
convert/bzr: fix symlink handling (issue1626)
Patrick Mezard <pmezard@gmail.com>
parents:
8045
diff
changeset
|
102 echo a > d/a |
adce97d28389
convert/bzr: fix symlink handling (issue1626)
Patrick Mezard <pmezard@gmail.com>
parents:
8045
diff
changeset
|
103 ln -s a syma |
adce97d28389
convert/bzr: fix symlink handling (issue1626)
Patrick Mezard <pmezard@gmail.com>
parents:
8045
diff
changeset
|
104 bzr add -q altname program syma d/a |
7053 | 105 bzr commit -q -m 'Initial setup' |
106 touch newprog | |
107 chmod +x newprog | |
108 rm altname | |
109 ln -s newprog altname | |
110 chmod -x program | |
111 bzr add -q newprog | |
112 bzr commit -q -m 'Symlink changed, x bits changed' | |
113 cd .. | |
114 hg convert source source-hg | |
115 manifest source-hg 0 | |
116 manifest source-hg tip | |
8423
eb7be0e752d9
convert/bzr: fix symlinks target (issue1626/2)
Patrick Mezard <pmezard@gmail.com>
parents:
8165
diff
changeset
|
117 cd source-hg |
eb7be0e752d9
convert/bzr: fix symlinks target (issue1626/2)
Patrick Mezard <pmezard@gmail.com>
parents:
8165
diff
changeset
|
118 echo % test the symlinks can be recreated |
eb7be0e752d9
convert/bzr: fix symlinks target (issue1626/2)
Patrick Mezard <pmezard@gmail.com>
parents:
8165
diff
changeset
|
119 hg up |
eb7be0e752d9
convert/bzr: fix symlinks target (issue1626/2)
Patrick Mezard <pmezard@gmail.com>
parents:
8165
diff
changeset
|
120 hg cat syma |
eb7be0e752d9
convert/bzr: fix symlinks target (issue1626/2)
Patrick Mezard <pmezard@gmail.com>
parents:
8165
diff
changeset
|
121 cd ../.. |