test-convert-bzr.t
287 lines
| 6.6 KiB
| text/troff
|
Tads3Lexer
/ tests / test-convert-bzr.t
|
r26066 | #require bzr | ||
|
r12512 | $ . "$TESTDIR/bzr-definitions" | ||
create and rename on the same file in the same step | ||||
$ mkdir test-createandrename | ||||
$ cd test-createandrename | ||||
|
r48168 | $ brz init -q source | ||
|
r16061 | |||
test empty repo conversion (issue3233) | ||||
$ hg convert source source-hg | ||||
initializing destination source-hg repository | ||||
scanning source... | ||||
sorting... | ||||
converting... | ||||
back to the rename stuff | ||||
|
r12512 | $ cd source | ||
$ echo a > a | ||||
$ echo c > c | ||||
$ echo e > e | ||||
|
r48168 | $ brz add -q a c e | ||
$ brz commit -q -m 'Initial add: a, c, e' | ||||
$ brz mv a b | ||||
|
r12512 | a => b | ||
|
r48168 | $ brz mv c d | ||
|
r12512 | c => d | ||
|
r48168 | $ brz mv e f | ||
|
r12512 | e => f | ||
$ echo a2 >> a | ||||
$ mkdir e | ||||
|
r48168 | $ brz add -q a e | ||
$ brz commit -q -m 'rename a into b, create a, rename c into d' | ||||
|
r12512 | $ cd .. | ||
$ hg convert source source-hg | ||||
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 | ||||
|
r39256 | o 1@source "rename a into b, create a, rename c into d" files+: [b d f], files-: [c e], files: [a] | ||
|
r12512 | | | ||
|
r39256 | o 0@source "Initial add: a, c, e" files+: [a c e], files-: [], files: [] | ||
|
r12512 | |||
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 | ||||
|
r39256 | o 0@source "Initial add: a, c, e" files+: [a c e], files-: [], files: [] | ||
|
r12512 | |||
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 | ||||
|
r48168 | $ brz checkout --lightweight source source-light | ||
|
r16060 | $ hg convert -s bzr source-light source-light-hg | ||
|
r12512 | initializing destination source-light-hg repository | ||
warning: lightweight checkouts may cause conversion failures, try with a regular branch instead. | ||||
|
r16060 | $TESTTMP/test-createandrename/source-light does not look like a Bazaar repository | ||
abort: source-light: missing or unsupported repository | ||||
[255] | ||||
|
r12512 | |||
extract timestamps that look just like hg's {date|isodate}: | ||||
yyyy-mm-dd HH:MM zzzz (no seconds!) | ||||
compare timestamps | ||||
$ cd source | ||||
|
r48168 | $ brz log | \ | ||
|
r12512 | > 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 | ||||
|
r20598 | $ cmp bzr-timestamps hg-timestamps || diff -u bzr-timestamps hg-timestamps | ||
|
r12512 | $ cd .. | ||
merge | ||||
$ mkdir test-merge | ||||
$ cd test-merge | ||||
$ cat > helper.py <<EOF | ||||
> import sys | ||||
|
r48168 | > from breezy import workingtree | ||
> import breezy.bzr.bzrdir | ||||
|
r12512 | > wt = workingtree.WorkingTree.open('.') | ||
> | ||||
> message, stamp = sys.argv[1:] | ||||
> wt.commit(message, timestamp=int(stamp)) | ||||
> EOF | ||||
|
r48168 | $ brz init -q source | ||
|
r12512 | $ cd source | ||
$ echo content > a | ||||
$ echo content2 > b | ||||
|
r48168 | $ brz add -q a b | ||
$ brz commit -q -m 'Initial add' | ||||
|
r12512 | $ cd .. | ||
|
r48168 | $ brz branch -q source source-improve | ||
|
r12512 | $ cd source | ||
$ echo more >> a | ||||
|
r39743 | $ "$PYTHON" ../helper.py 'Editing a' 100 | ||
|
r12512 | $ cd ../source-improve | ||
$ echo content3 >> b | ||||
|
r39743 | $ "$PYTHON" ../helper.py 'Editing b' 200 | ||
|
r12512 | $ cd ../source | ||
|
r48168 | $ brz merge -q ../source-improve | ||
$ brz commit -q -m 'Merged improve branch' | ||||
|
r12512 | $ 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 | ||||
|
r42597 | o 3@source "Merged improve branch" files+: [], files-: [], files: [] | ||
|
r12512 | |\ | ||
|
r39256 | | o 2@source-improve "Editing b" files+: [], files-: [], files: [b] | ||
|
r12512 | | | | ||
|
r39256 | o | 1@source "Editing a" files+: [], files-: [], files: [a] | ||
|
r12512 | |/ | ||
|
r39256 | o 0@source "Initial add" files+: [a b], files-: [], files: [] | ||
|
r12512 | |||
$ cd .. | ||||
|
r16899 | #if symlink execbit | ||
|
r12512 | symlinks and executable files | ||
$ mkdir test-symlinks | ||||
$ cd test-symlinks | ||||
|
r48168 | $ brz init -q source | ||
|
r12512 | $ cd source | ||
$ touch program | ||||
$ chmod +x program | ||||
$ ln -s program altname | ||||
$ mkdir d | ||||
$ echo a > d/a | ||||
$ ln -s a syma | ||||
|
r48168 | $ brz add -q altname program syma d/a | ||
$ brz commit -q -m 'Initial setup' | ||||
|
r12512 | $ touch newprog | ||
$ chmod +x newprog | ||||
$ rm altname | ||||
$ ln -s newprog altname | ||||
$ chmod -x program | ||||
|
r48168 | $ brz add -q newprog | ||
$ brz commit -q -m 'Symlink changed, x bits changed' | ||||
|
r12512 | $ 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 | ||||
test the symlinks can be recreated | ||||
|
r16899 | $ cd source-hg | ||
|
r12512 | $ hg up | ||
5 files updated, 0 files merged, 0 files removed, 0 files unresolved | ||||
$ hg cat syma; echo | ||||
a | ||||
|
r16899 | $ cd ../.. | ||
#endif | ||||
|
r12512 | |||
|
r16060 | Multiple branches | ||
|
r48168 | $ brz init-repo -q --no-trees repo | ||
$ brz init -q repo/trunk | ||||
$ brz co repo/trunk repo-trunk | ||||
|
r16060 | $ cd repo-trunk | ||
$ echo a > a | ||||
|
r48168 | $ brz add -q a | ||
$ brz ci -qm adda | ||||
$ brz tag trunk-tag | ||||
|
r16062 | Created tag trunk-tag. | ||
|
r48168 | $ brz switch -b branch | ||
|
r16060 | Tree is up to date at revision 1. | ||
|
r44827 | Switched to branch*repo/branch/ (glob) | ||
|
r16060 | $ echo b > b | ||
|
r48168 | $ brz add -q b | ||
$ brz ci -qm addb | ||||
$ brz tag branch-tag | ||||
|
r16062 | Created tag branch-tag. | ||
|
r48168 | $ brz switch --force ../repo/trunk | ||
|
r16060 | Updated to revision 1. | ||
|
r44827 | Switched to branch*/repo/trunk/ (glob) | ||
|
r16060 | $ echo a >> a | ||
|
r48168 | $ brz ci -qm changea | ||
|
r16060 | $ cd .. | ||
$ hg convert --datesort repo repo-bzr | ||||
initializing destination repo-bzr repository | ||||
scanning source... | ||||
sorting... | ||||
converting... | ||||
2 adda | ||||
1 addb | ||||
0 changea | ||||
|
r16062 | updating tags | ||
|
r16060 | $ (cd repo-bzr; glog) | ||
|
r39256 | o 3@default "update tags" files+: [.hgtags], files-: [], files: [] | ||
|
r16062 | | | ||
|
r39256 | o 2@default "changea" files+: [], files-: [], files: [a] | ||
|
r16060 | | | ||
|
r39256 | | o 1@branch "addb" files+: [b], files-: [], files: [] | ||
|
r16060 | |/ | ||
|
r39256 | o 0@default "adda" files+: [a], files-: [], files: [] | ||
|
r16060 | |||
|
r16062 | |||
Test tags (converted identifiers are not stable because bzr ones are | ||||
not and get incorporated in extra fields). | ||||
$ hg -R repo-bzr tags | ||||
tip 3:* (glob) | ||||
branch-tag 1:* (glob) | ||||
trunk-tag 0:* (glob) | ||||
|
r16099 | |||
Nested repositories (issue3254) | ||||
|
r48168 | $ brz init-repo -q --no-trees repo/inner | ||
$ brz init -q repo/inner/trunk | ||||
$ brz co repo/inner/trunk inner-trunk | ||||
|
r16099 | $ cd inner-trunk | ||
$ echo b > b | ||||
|
r48168 | $ brz add -q b | ||
$ brz ci -qm addb | ||||
|
r16099 | $ cd .. | ||
$ hg convert --datesort repo noinner-bzr | ||||
initializing destination noinner-bzr repository | ||||
scanning source... | ||||
sorting... | ||||
converting... | ||||
2 adda | ||||
1 addb | ||||
0 changea | ||||
updating tags | ||||