tests: unify test-convert-svn-*

This commit is contained in:
Dan Villiom Podlaski Christiansen 2010-09-21 18:40:33 +02:00
parent c3d38bfaec
commit 9c066c24dc
21 changed files with 1307 additions and 1173 deletions

View File

@ -1,29 +0,0 @@
#!/bin/sh
"$TESTDIR/hghave" svn svn-bindings || exit 80
echo "[extensions]" >> $HGRCPATH
echo "convert = " >> $HGRCPATH
echo "graphlog =" >> $HGRCPATH
svnadmin create svn-repo
cat "$TESTDIR/svn/branches.svndump" | svnadmin load svn-repo > /dev/null
echo % convert trunk and branches
cat >branchmap <<EOF
old3 newbranch
EOF
hg convert --branchmap=branchmap --datesort -r 10 svn-repo A-hg
echo % convert again
hg convert --branchmap=branchmap --datesort svn-repo A-hg
cd A-hg
hg glog --template 'branch={branches} {rev} {desc|firstline} files: {files}\n'
hg branches | sed 's/:.*/:/'
hg tags -q
cd ..
echo '% test hg failing to call itself'
HG=foobar hg convert svn-repo B-hg 2>&1 | grep itself

View File

@ -1,52 +0,0 @@
% convert trunk and branches
initializing destination A-hg repository
scanning source...
sorting...
converting...
10 init projA
9 hello
8 branch trunk, remove c and dir
7 change a
6 change b
5 move and update c
4 move and update c
3 change b again
2 move to old2
1 move back to old
0 last change to a
% convert again
scanning source...
sorting...
converting...
0 branch trunk@1 into old3
o branch=newbranch 11 branch trunk@1 into old3 files:
|
| o branch= 10 last change to a files: a
| |
| | o branch=old 9 move back to old files:
| | |
| | o branch=old2 8 move to old2 files:
| | |
| | o branch=old 7 change b again files: b
| | |
| o | branch= 6 move and update c files: b
| | |
| | o branch=old 5 move and update c files: c
| | |
| | o branch=old 4 change b files: b
| | |
| o | branch= 3 change a files: a
| | |
| | o branch=old 2 branch trunk, remove c and dir files: c
| |/
| o branch= 1 hello files: a b c dir/e
|/
o branch= 0 init projA files:
newbranch 11:
default 10:
old 9:
old2 8:
tip
% test hg failing to call itself
abort: Mercurial failed to run itself, check hg executable is in PATH

View File

@ -0,0 +1,86 @@
$ "$TESTDIR/hghave" svn svn-bindings || exit 80
$ cat > $HGRCPATH <<EOF
> [extensions]
> convert =
> graphlog =
> EOF
$ svnadmin create svn-repo
$ svnadmin load -q svn-repo < "$TESTDIR/svn/branches.svndump"
Convert trunk and branches
$ cat > branchmap <<EOF
> old3 newbranch
> EOF
$ hg convert --branchmap=branchmap --datesort -r 10 svn-repo A-hg
initializing destination A-hg repository
scanning source...
sorting...
converting...
10 init projA
9 hello
8 branch trunk, remove c and dir
7 change a
6 change b
5 move and update c
4 move and update c
3 change b again
2 move to old2
1 move back to old
0 last change to a
Convert again
$ hg convert --branchmap=branchmap --datesort svn-repo A-hg
scanning source...
sorting...
converting...
0 branch trunk@1 into old3
$ cd A-hg
$ hg glog --template 'branch={branches} {rev} {desc|firstline} files: {files}\n'
o branch=newbranch 11 branch trunk@1 into old3 files:
|
| o branch= 10 last change to a files: a
| |
| | o branch=old 9 move back to old files:
| | |
| | o branch=old2 8 move to old2 files:
| | |
| | o branch=old 7 change b again files: b
| | |
| o | branch= 6 move and update c files: b
| | |
| | o branch=old 5 move and update c files: c
| | |
| | o branch=old 4 change b files: b
| | |
| o | branch= 3 change a files: a
| | |
| | o branch=old 2 branch trunk, remove c and dir files: c
| |/
| o branch= 1 hello files: a b c dir/e
|/
o branch= 0 init projA files:
$ hg branches
newbranch 11:08fca3ff8634
default 10:098988aa63ba
old 9:b308f345079b
old2 8:49f2336c7b8b (inactive)
$ hg tags -q
tip
$ cd ..
Test hg failing to call itself
$ HG=foobar hg convert svn-repo B-hg
.*
initializing destination B-hg repository
abort: Mercurial failed to run itself, check hg executable is in PATH
[255]

View File

@ -1,17 +0,0 @@
#!/bin/sh
"$TESTDIR/hghave" svn svn-bindings || exit 80
echo "[extensions]" >> $HGRCPATH
echo "convert = " >> $HGRCPATH
svnadmin create svn-repo
cat "$TESTDIR/svn/encoding.svndump" | svnadmin load svn-repo > /dev/null
echo '% convert while testing all possible outputs'
hg --debug convert svn-repo A-hg > /dev/null
cd A-hg
hg up
echo '% check tags are in UTF-8'
python -c "print '\n'.join([('%r' % l) for l in file('.hgtags', 'rb').readlines()])"
cd ..

View File

@ -1,5 +0,0 @@
% convert while testing all possible outputs
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
% check tags are in UTF-8
'221c3fdaf24df5f14c0a64c597581e2eacfb47bb branch\xc3\xa9e\n'
'7a40952c2db29cf00d9e31df3749e98d8a4bdcbf branch\xc3\xa9\n'

View File

@ -0,0 +1,135 @@
$ "$TESTDIR/hghave" svn svn-bindings || exit 80
$ cat > $HGRCPATH <<EOF
> [extensions]
> convert =
> graphlog =
> EOF
$ svnadmin create svn-repo
$ svnadmin load -q svn-repo < "$TESTDIR/svn/encoding.svndump"
Convert while testing all possible outputs
$ hg --debug convert svn-repo A-hg
initializing destination A-hg repository
reparent to file://.*/test-convert-svn-encoding.t/svn-repo
run hg sink pre-conversion action
scanning source...
found trunk at 'trunk'
found tags at 'tags'
found branches at 'branches'
found branch branché at 5
found branch branchée at 6
scanning: 1 revisions
reparent to file://.*/test-convert-svn-encoding.t/svn-repo/trunk
fetching revision log for "/trunk" from 4 to 0
parsing revision 4 (2 changes)
parsing revision 3 (4 changes)
parsing revision 2 (3 changes)
parsing revision 1 (3 changes)
no copyfrom path, don't know what to do.
'/branches' is not under '/trunk', ignoring
'/tags' is not under '/trunk', ignoring
scanning: 2 revisions
reparent to file://.*/test-convert-svn-encoding.t/svn-repo/branches/branch%C3%A9
fetching revision log for "/branches/branché" from 5 to 0
parsing revision 5 (1 changes)
reparent to file://.*/test-convert-svn-encoding.t/svn-repo
reparent to file://.*/test-convert-svn-encoding.t/svn-repo/branches/branch%C3%A9
found parent of branch /branches/branché at 4: /trunk
scanning: 3 revisions
reparent to file://.*/test-convert-svn-encoding.t/svn-repo/branches/branch%C3%A9e
fetching revision log for "/branches/branchée" from 6 to 0
parsing revision 6 (1 changes)
reparent to file://.*/test-convert-svn-encoding.t/svn-repo
reparent to file://.*/test-convert-svn-encoding.t/svn-repo/branches/branch%C3%A9e
found parent of branch /branches/branchée at 5: /branches/branché
scanning: 4 revisions
scanning: 5 revisions
scanning: 6 revisions
sorting...
converting...
5 init projA
source: svn:afeb9c47-92ff-4c0c-9f72-e1f6eb8ac9af/trunk@1
converting: 0/6 revisions (0.00%)
4 hello
source: svn:afeb9c47-92ff-4c0c-9f72-e1f6eb8ac9af/trunk@2
converting: 1/6 revisions (16.67%)
reparent to file://.*/test-convert-svn-encoding.t/svn-repo/trunk
scanning paths: /trunk/à 0/3 (0.00%)
scanning paths: /trunk/à/é 1/3 (33.33%)
scanning paths: /trunk/é 2/3 (66.67%)
à/
getting files: à/é 1/2 (50.00%)
é
getting files: é 2/2 (100.00%)
3 copy files
source: svn:afeb9c47-92ff-4c0c-9f72-e1f6eb8ac9af/trunk@3
converting: 2/6 revisions (33.33%)
scanning paths: /trunk/à 0/4 (0.00%)
gone from -1
reparent to file://.*/test-convert-svn-encoding.t/svn-repo
reparent to file://.*/test-convert-svn-encoding.t/svn-repo/trunk
scanning paths: /trunk/è 1/4 (25.00%)
copied to è from é@2
scanning paths: /trunk/é 2/4 (50.00%)
gone from -1
reparent to file://.*/test-convert-svn-encoding.t/svn-repo
reparent to file://.*/test-convert-svn-encoding.t/svn-repo/trunk
scanning paths: /trunk/ù 3/4 (75.00%)
mark /trunk/ù came from à:2
à/
getting files: à/é 1/4 (25.00%)
è
getting files: è 2/4 (50.00%)
è: copy é:6b67ccefd5ce6de77e7ead4f5292843a0255329f
é
getting files: é 3/4 (75.00%)
ù/
getting files: ù/é 4/4 (100.00%)
ù/é: copy à/é:a9092a3d84a37b9993b5c73576f6de29b7ea50f6
2 remove files
source: svn:afeb9c47-92ff-4c0c-9f72-e1f6eb8ac9af/trunk@4
converting: 3/6 revisions (50.00%)
scanning paths: /trunk/è 0/2 (0.00%)
gone from -1
reparent to file://.*/test-convert-svn-encoding.t/svn-repo
reparent to file://.*/test-convert-svn-encoding.t/svn-repo/trunk
scanning paths: /trunk/ù 1/2 (50.00%)
gone from -1
reparent to file://.*/test-convert-svn-encoding.t/svn-repo
reparent to file://.*/test-convert-svn-encoding.t/svn-repo/trunk
è
getting files: è 1/2 (50.00%)
ù/
getting files: ù/é 2/2 (100.00%)
1 branch to branch?
source: svn:afeb9c47-92ff-4c0c-9f72-e1f6eb8ac9af/branches/branch?@5
converting: 4/6 revisions (66.67%)
reparent to file://.*/test-convert-svn-encoding.t/svn-repo/branches/branch%C3%A9
scanning paths: /branches/branché 0/1 (0.00%)
0 branch to branch?e
source: svn:afeb9c47-92ff-4c0c-9f72-e1f6eb8ac9af/branches/branch?e@6
converting: 5/6 revisions (83.33%)
reparent to file://.*/test-convert-svn-encoding.t/svn-repo/branches/branch%C3%A9e
scanning paths: /branches/branchée 0/1 (0.00%)
reparent to file://.*/test-convert-svn-encoding.t/svn-repo
reparent to file://.*/test-convert-svn-encoding.t/svn-repo/branches/branch%C3%A9e
reparent to file://.*/test-convert-svn-encoding.t/svn-repo
reparent to file://.*/test-convert-svn-encoding.t/svn-repo/branches/branch%C3%A9e
updating tags
.hgtags
run hg sink post-conversion action
$ cd A-hg
$ hg up
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
Check tags are in UTF-8
$ python -c "print '\n'.join([('%r' % l) for l in file('.hgtags', 'rb').readlines()])"
'221c3fdaf24df5f14c0a64c597581e2eacfb47bb branch\xc3\xa9e\n'
'7a40952c2db29cf00d9e31df3749e98d8a4bdcbf branch\xc3\xa9\n'
$ cd ..

View File

@ -1,70 +0,0 @@
#!/bin/sh
"$TESTDIR/hghave" svn svn-bindings || exit 80
fix_path()
{
tr '\\' /
}
echo "[extensions]" >> $HGRCPATH
echo "convert = " >> $HGRCPATH
echo "hgext.graphlog =" >> $HGRCPATH
svnadmin create svn-repo
cat "$TESTDIR/svn/move.svndump" | svnadmin load svn-repo > /dev/null
svnpath=`pwd | fix_path`
# SVN wants all paths to start with a slash. Unfortunately,
# Windows ones don't. Handle that.
expr "$svnpath" : "\/" > /dev/null
if [ $? -ne 0 ]; then
svnpath="/$svnpath"
fi
svnurl="file://$svnpath/svn-repo"
echo % convert trunk and branches
hg convert --datesort "$svnurl"/subproject A-hg
cd A-hg
hg glog --template '{rev} {desc|firstline} files: {files}\n'
echo '% check move copy records'
hg st --rev 12:13 --copies
echo '% check branches'
hg branches | sed 's/:.*/:/'
cd ..
mkdir test-replace
cd test-replace
svnadmin create svn-repo
cat "$TESTDIR/svn/replace.svndump" | svnadmin load svn-repo > /dev/null
echo '% convert files being replaced by directories'
hg convert svn-repo hg-repo
cd hg-repo
echo '% manifest before'
hg -v manifest -r 1
echo '% manifest after clobber1'
hg -v manifest -r 2
echo '% manifest after clobber2'
hg -v manifest -r 3
echo '% try updating'
hg up -qC default
cd ..
echo '% test convert progress bar'
echo "progress=" >> $HGRCPATH
echo "[progress]" >> $HGRCPATH
echo "assume-tty=1" >> $HGRCPATH
echo "delay=0" >> $HGRCPATH
echo "refresh=0" >> $HGRCPATH
cat > filtercr.py <<EOF
import sys, re
for line in sys.stdin:
line = re.sub(r'\r+[^\n]', lambda m: '\n' + m.group()[-1:], line)
sys.stdout.write(line)
EOF
hg convert svn-repo hg-progress 2>&1 | python filtercr.py

View File

@ -1,123 +0,0 @@
% convert trunk and branches
initializing destination A-hg repository
scanning source...
sorting...
converting...
13 createtrunk
12 moved1
11 moved1
10 moved2
9 changeb and rm d2
8 changeb and rm d2
7 moved1again
6 moved1again
5 copyfilefrompast
4 copydirfrompast
3 add d3
2 copy dir and remove subdir
1 add d4old
0 rename d4old into d4new
o 13 rename d4old into d4new files: d4new/g d4old/g
|
o 12 add d4old files: d4old/g
|
o 11 copy dir and remove subdir files: d3/d31/e d4/d31/e d4/f
|
o 10 add d3 files: d3/d31/e d3/f
|
o 9 copydirfrompast files: d2/d
|
o 8 copyfilefrompast files: d
|
o 7 moved1again files: d1/b d1/c
|
| o 6 moved1again files:
| |
o | 5 changeb and rm d2 files: d1/b d2/d
| |
| o 4 changeb and rm d2 files: b
| |
o | 3 moved2 files: d2/d
| |
o | 2 moved1 files: d1/b d1/c
| |
| o 1 moved1 files: b c
|
o 0 createtrunk files:
% check move copy records
A d4new/g
d4old/g
R d4old/g
% check branches
default 13:
d1 6:
% convert files being replaced by directories
initializing destination hg-repo repository
scanning source...
sorting...
converting...
3 initial
2 clobber symlink
1 clobber1
0 clobber2
% manifest before
644 a
644 d/b
644 @ dlink
644 @ dlink2
644 dlink3
% manifest after clobber1
644 a/b
644 d/b
644 dlink/b
644 @ dlink2
644 dlink3
% manifest after clobber2
644 a/b
644 d/b
644 dlink/b
644 @ dlink2
644 @ dlink3
% try updating
% test convert progress bar
scanning [ <=> ] 1
scanning [ <=> ] 2
scanning [ <=> ] 3
scanning [ <=> ] 4
converting [ ] 0/4
getting files [==========> ] 1/5
getting files [======================> ] 2/5
getting files [==================================> ] 3/5
getting files [==============================================> ] 4/5
getting files [==========================================================>] 5/5
converting [==============> ] 1/4
scanning paths [ ] 0/1
getting files [==========================================================>] 1/1
converting [==============================> ] 2/4
scanning paths [ ] 0/2
scanning paths [============================> ] 1/2
getting files [=============> ] 1/4
getting files [============================> ] 2/4
getting files [===========================================> ] 3/4
getting files [==========================================================>] 4/4
converting [=============================================> ] 3/4
scanning paths [ ] 0/1
getting files [==========================================================>] 1/1
initializing destination hg-progress repository
scanning source...
sorting...
converting...
3 initial
2 clobber symlink
1 clobber1
0 clobber2

View File

@ -0,0 +1,202 @@
$ "$TESTDIR/hghave" svn svn-bindings || exit 80
$ fixpath()
> {
> tr '\\' /
> }
$ cat > $HGRCPATH <<EOF
> [extensions]
> convert =
> graphlog =
> EOF
$ svnadmin create svn-repo
$ svnadmin load -q svn-repo < "$TESTDIR/svn/move.svndump"
$ svnpath=`pwd | fixpath`
SVN wants all paths to start with a slash. Unfortunately,
Windows ones don't. Handle that.
$ expr "$svnpath" : "\/" > /dev/null
> if [ $? -ne 0 ]; then
> svnpath="/$svnpath"
> fi
> svnurl="file://$svnpath/svn-repo"
Convert trunk and branches
$ hg convert --datesort "$svnurl"/subproject A-hg
initializing destination A-hg repository
scanning source...
sorting...
converting...
13 createtrunk
12 moved1
11 moved1
10 moved2
9 changeb and rm d2
8 changeb and rm d2
7 moved1again
6 moved1again
5 copyfilefrompast
4 copydirfrompast
3 add d3
2 copy dir and remove subdir
1 add d4old
0 rename d4old into d4new
$ cd A-hg
$ hg glog --template '{rev} {desc|firstline} files: {files}\n'
o 13 rename d4old into d4new files: d4new/g d4old/g
|
o 12 add d4old files: d4old/g
|
o 11 copy dir and remove subdir files: d3/d31/e d4/d31/e d4/f
|
o 10 add d3 files: d3/d31/e d3/f
|
o 9 copydirfrompast files: d2/d
|
o 8 copyfilefrompast files: d
|
o 7 moved1again files: d1/b d1/c
|
| o 6 moved1again files:
| |
o | 5 changeb and rm d2 files: d1/b d2/d
| |
| o 4 changeb and rm d2 files: b
| |
o | 3 moved2 files: d2/d
| |
o | 2 moved1 files: d1/b d1/c
| |
| o 1 moved1 files: b c
|
o 0 createtrunk files:
Check move copy records
$ hg st --rev 12:13 --copies
A d4new/g
d4old/g
R d4old/g
Check branches
$ hg branches
default 13:.*
d1 6:.*
$ cd ..
$ mkdir test-replace
$ cd test-replace
$ svnadmin create svn-repo
$ svnadmin load -q svn-repo < "$TESTDIR/svn/replace.svndump"
Convert files being replaced by directories
$ hg convert svn-repo hg-repo
initializing destination hg-repo repository
scanning source...
sorting...
converting...
3 initial
2 clobber symlink
1 clobber1
0 clobber2
$ cd hg-repo
Manifest before
$ hg -v manifest -r 1
644 a
644 d/b
644 @ dlink
644 @ dlink2
644 dlink3
Manifest after clobber1
$ hg -v manifest -r 2
644 a/b
644 d/b
644 dlink/b
644 @ dlink2
644 dlink3
Manifest after clobber2
$ hg -v manifest -r 3
644 a/b
644 d/b
644 dlink/b
644 @ dlink2
644 @ dlink3
Try updating
$ hg up -qC default
$ cd ..
Test convert progress bar'
$ cat >> $HGRCPATH <<EOF
> [extensions]
> progress =
> [progress]
> assume-tty = 1
> delay = 0
> refresh = 0
> EOF
$ cat > filtercr.py <<EOF
> import sys, re
> for line in sys.stdin:
> line = re.sub(r'\r+[^\n]', lambda m: '\n' + m.group()[-1:], line)
> sys.stdout.write(line)
> EOF
$ hg convert svn-repo hg-progress 2>&1 | python filtercr.py
scanning [ <=> ] 1
scanning [ <=> ] 2
scanning [ <=> ] 3
scanning [ <=> ] 4
converting [ ] 0/4
getting files [==========> ] 1/5
getting files [======================> ] 2/5
getting files [==================================> ] 3/5
getting files [==============================================> ] 4/5
getting files [==========================================================>] 5/5
converting [==============> ] 1/4
scanning paths [ ] 0/1
getting files [==========================================================>] 1/1
converting [==============================> ] 2/4
scanning paths [ ] 0/2
scanning paths [============================> ] 1/2
getting files [=============> ] 1/4
getting files [============================> ] 2/4
getting files [===========================================> ] 3/4
getting files [==========================================================>] 4/4
converting [=============================================> ] 3/4
scanning paths [ ] 0/1
getting files [==========================================================>] 1/1
initializing destination hg-progress repository
scanning source...
sorting...
converting...
3 initial
2 clobber symlink
1 clobber1
0 clobber2

View File

@ -1,150 +0,0 @@
#!/bin/sh
"$TESTDIR/hghave" svn svn-bindings no-outer-repo || exit 80
fixpath()
{
tr '\\' /
}
svnupanddisplay()
{
(
cd $1;
svn up;
svn st -v | fixpath | sed 's/ */ /g'
limit=''
if [ $2 -gt 0 ]; then
limit="--limit=$2"
fi
svn log --xml -v $limit | fixpath | sed 's,<date>.*,<date/>,' | grep -v 'kind="'
)
}
echo "[extensions]" >> $HGRCPATH
echo "convert = " >> $HGRCPATH
hg init a
echo a > a/a
mkdir -p a/d1/d2
echo b > a/d1/d2/b
ln -s a/missing a/link
echo % add
hg --cwd a ci -d '0 0' -A -m 'add a file'
"$TESTDIR/svn-safe-append.py" a a/a
echo % modify
hg --cwd a ci -d '1 0' -m 'modify a file'
hg --cwd a tip -q
hg convert -d svn a
svnupanddisplay a-hg-wc 2
ls a a-hg-wc
cmp a/a a-hg-wc/a && echo same || echo different
hg --cwd a mv a b
hg --cwd a mv link newlink
echo % rename
hg --cwd a ci -d '2 0' -m 'rename a file'
hg --cwd a tip -q
hg convert -d svn a
svnupanddisplay a-hg-wc 1
ls a a-hg-wc
hg --cwd a cp b c
echo % copy
hg --cwd a ci -d '3 0' -m 'copy a file'
hg --cwd a tip -q
hg convert -d svn a
svnupanddisplay a-hg-wc 1
ls a a-hg-wc
hg --cwd a rm b
echo % remove
hg --cwd a ci -d '4 0' -m 'remove a file'
hg --cwd a tip -q
hg convert -d svn a
svnupanddisplay a-hg-wc 1
ls a a-hg-wc
chmod +x a/c
echo % executable
hg --cwd a ci -d '5 0' -m 'make a file executable'
hg --cwd a tip -q
hg convert -d svn a
svnupanddisplay a-hg-wc 1
test -x a-hg-wc/c && echo executable || echo not executable
echo % executable in new directory
rm -rf a a-hg a-hg-wc
hg init a
mkdir a/d1
echo a > a/d1/a
chmod +x a/d1/a
hg --cwd a ci -d '0 0' -A -m 'add executable file in new directory'
hg convert -d svn a
svnupanddisplay a-hg-wc 1
test -x a-hg-wc/d1/a && echo executable || echo not executable
echo % copy to new directory
mkdir a/d2
hg --cwd a cp d1/a d2/a
hg --cwd a ci -d '1 0' -A -m 'copy file to new directory'
hg convert -d svn a
svnupanddisplay a-hg-wc 1
echo % branchy history
hg init b
echo base > b/b
hg --cwd b ci -d '0 0' -Ambase
"$TESTDIR/svn-safe-append.py" left-1 b/b
echo left-1 > b/left-1
hg --cwd b ci -d '1 0' -Amleft-1
"$TESTDIR/svn-safe-append.py" left-2 b/b
echo left-2 > b/left-2
hg --cwd b ci -d '2 0' -Amleft-2
hg --cwd b up 0
"$TESTDIR/svn-safe-append.py" right-1 b/b
echo right-1 > b/right-1
hg --cwd b ci -d '3 0' -Amright-1
"$TESTDIR/svn-safe-append.py" right-2 b/b
echo right-2 > b/right-2
hg --cwd b ci -d '4 0' -Amright-2
hg --cwd b up -C 2
hg --cwd b merge
hg --cwd b revert -r 2 b
hg resolve -m b
hg --cwd b ci -d '5 0' -m 'merge'
hg convert -d svn b
echo % expect 4 changes
svnupanddisplay b-hg-wc 0
echo % tags are not supported, but must not break conversion
rm -rf a a-hg a-hg-wc
hg init a
echo a > a/a
hg --cwd a ci -d '0 0' -A -m 'Add file a'
hg --cwd a tag -d '1 0' -m 'Tagged as v1.0' v1.0
hg convert -d svn a
svnupanddisplay a-hg-wc 2
rm -rf a a-hg a-hg-wc

View File

@ -1,397 +0,0 @@
% add
adding a
adding d1/d2/b
adding link
% modify
1:8231f652da37
assuming destination a-hg
initializing svn repository 'a-hg'
initializing svn working copy 'a-hg-wc'
scanning source...
sorting...
converting...
1 add a file
0 modify a file
At revision 2.
2 2 test .
2 2 test a
2 1 test d1
2 1 test d1/d2
2 1 test d1/d2/b
2 1 test link
<?xml version="1.0"?>
<log>
<logentry
revision="2">
<author>test</author>
<date/>
<paths>
<path
action="M">/a</path>
</paths>
<msg>modify a file</msg>
</logentry>
<logentry
revision="1">
<author>test</author>
<date/>
<paths>
<path
action="A">/a</path>
<path
action="A">/d1</path>
<path
action="A">/d1/d2</path>
<path
action="A">/d1/d2/b</path>
<path
action="A">/link</path>
</paths>
<msg>add a file</msg>
</logentry>
</log>
a:
a
d1
link
a-hg-wc:
a
d1
link
same
% rename
2:a67e26ccec09
assuming destination a-hg
initializing svn working copy 'a-hg-wc'
scanning source...
sorting...
converting...
0 rename a file
At revision 3.
3 3 test .
3 3 test b
3 1 test d1
3 1 test d1/d2
3 1 test d1/d2/b
3 3 test newlink
<?xml version="1.0"?>
<log>
<logentry
revision="3">
<author>test</author>
<date/>
<paths>
<path
action="D">/a</path>
<path
copyfrom-path="/a"
copyfrom-rev="2"
action="A">/b</path>
<path
copyfrom-path="/link"
copyfrom-rev="2"
action="A">/newlink</path>
<path
action="D">/link</path>
</paths>
<msg>rename a file</msg>
</logentry>
</log>
a:
b
d1
newlink
a-hg-wc:
b
d1
newlink
% copy
3:0cf087b9ab02
assuming destination a-hg
initializing svn working copy 'a-hg-wc'
scanning source...
sorting...
converting...
0 copy a file
At revision 4.
4 4 test .
4 3 test b
4 4 test c
4 1 test d1
4 1 test d1/d2
4 1 test d1/d2/b
4 3 test newlink
<?xml version="1.0"?>
<log>
<logentry
revision="4">
<author>test</author>
<date/>
<paths>
<path
copyfrom-path="/b"
copyfrom-rev="3"
action="A">/c</path>
</paths>
<msg>copy a file</msg>
</logentry>
</log>
a:
b
c
d1
newlink
a-hg-wc:
b
c
d1
newlink
% remove
4:07b2e34a5b17
assuming destination a-hg
initializing svn working copy 'a-hg-wc'
scanning source...
sorting...
converting...
0 remove a file
At revision 5.
5 5 test .
5 4 test c
5 1 test d1
5 1 test d1/d2
5 1 test d1/d2/b
5 3 test newlink
<?xml version="1.0"?>
<log>
<logentry
revision="5">
<author>test</author>
<date/>
<paths>
<path
action="D">/b</path>
</paths>
<msg>remove a file</msg>
</logentry>
</log>
a:
c
d1
newlink
a-hg-wc:
c
d1
newlink
% executable
5:31093672760b
assuming destination a-hg
initializing svn working copy 'a-hg-wc'
scanning source...
sorting...
converting...
0 make a file executable
At revision 6.
6 6 test .
6 6 test c
6 1 test d1
6 1 test d1/d2
6 1 test d1/d2/b
6 3 test newlink
<?xml version="1.0"?>
<log>
<logentry
revision="6">
<author>test</author>
<date/>
<paths>
<path
action="M">/c</path>
</paths>
<msg>make a file executable</msg>
</logentry>
</log>
executable
% executable in new directory
adding d1/a
assuming destination a-hg
initializing svn repository 'a-hg'
initializing svn working copy 'a-hg-wc'
scanning source...
sorting...
converting...
0 add executable file in new directory
At revision 1.
1 1 test .
1 1 test d1
1 1 test d1/a
<?xml version="1.0"?>
<log>
<logentry
revision="1">
<author>test</author>
<date/>
<paths>
<path
action="A">/d1</path>
<path
action="A">/d1/a</path>
</paths>
<msg>add executable file in new directory</msg>
</logentry>
</log>
executable
% copy to new directory
assuming destination a-hg
initializing svn working copy 'a-hg-wc'
scanning source...
sorting...
converting...
0 copy file to new directory
At revision 2.
2 2 test .
2 1 test d1
2 1 test d1/a
2 2 test d2
2 2 test d2/a
<?xml version="1.0"?>
<log>
<logentry
revision="2">
<author>test</author>
<date/>
<paths>
<path
action="A">/d2</path>
<path
copyfrom-path="/d1/a"
copyfrom-rev="1"
action="A">/d2/a</path>
</paths>
<msg>copy file to new directory</msg>
</logentry>
</log>
% branchy history
adding b
adding left-1
adding left-2
1 files updated, 0 files merged, 2 files removed, 0 files unresolved
adding right-1
created new head
adding right-2
3 files updated, 0 files merged, 2 files removed, 0 files unresolved
merging b
warning: conflicts during merge.
merging b failed!
2 files updated, 0 files merged, 0 files removed, 1 files unresolved
use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
assuming destination b-hg
initializing svn repository 'b-hg'
initializing svn working copy 'b-hg-wc'
scanning source...
sorting...
converting...
5 base
4 left-1
3 left-2
2 right-1
1 right-2
0 merge
% expect 4 changes
At revision 4.
4 4 test .
4 3 test b
4 2 test left-1
4 3 test left-2
4 4 test right-1
4 4 test right-2
<?xml version="1.0"?>
<log>
<logentry
revision="4">
<author>test</author>
<date/>
<paths>
<path
action="A">/right-1</path>
<path
action="A">/right-2</path>
</paths>
<msg>merge</msg>
</logentry>
<logentry
revision="3">
<author>test</author>
<date/>
<paths>
<path
action="M">/b</path>
<path
action="A">/left-2</path>
</paths>
<msg>left-2</msg>
</logentry>
<logentry
revision="2">
<author>test</author>
<date/>
<paths>
<path
action="M">/b</path>
<path
action="A">/left-1</path>
</paths>
<msg>left-1</msg>
</logentry>
<logentry
revision="1">
<author>test</author>
<date/>
<paths>
<path
action="A">/b</path>
</paths>
<msg>base</msg>
</logentry>
</log>
% tags are not supported, but must not break conversion
adding a
assuming destination a-hg
initializing svn repository 'a-hg'
initializing svn working copy 'a-hg-wc'
scanning source...
sorting...
converting...
1 Add file a
0 Tagged as v1.0
writing Subversion tags is not yet implemented
At revision 2.
2 2 test .
2 1 test a
2 2 test .hgtags
<?xml version="1.0"?>
<log>
<logentry
revision="2">
<author>test</author>
<date/>
<paths>
<path
action="A">/.hgtags</path>
</paths>
<msg>Tagged as v1.0</msg>
</logentry>
<logentry
revision="1">
<author>test</author>
<date/>
<paths>
<path
action="A">/a</path>
</paths>
<msg>Add file a</msg>
</logentry>
</log>

View File

@ -0,0 +1,548 @@
$ "$TESTDIR/hghave" svn svn-bindings no-outer-repo || exit 80
$ fixpath()
> {
> tr '\\' /
> }
$ svnupanddisplay()
> {
> (
> cd $1;
> svn up;
> svn st -v | fixpath | sed 's/ */ /g'
> limit=''
> if [ $2 -gt 0 ]; then
> limit="--limit=$2"
> fi
> svn log --xml -v $limit \
> | fixpath \
> | sed 's,<date>.*,<date/>,' \
> | grep -v 'kind="'
> )
> }
$ cat > $HGRCPATH <<EOF
> [extensions]
> convert =
> graphlog =
> EOF
$ hg init a
Add
$ echo a > a/a
$ mkdir -p a/d1/d2
$ echo b > a/d1/d2/b
$ ln -s a/missing a/link
$ hg --cwd a ci -d '0 0' -A -m 'add a file'
adding a
adding d1/d2/b
adding link
Modify
$ "$TESTDIR/svn-safe-append.py" a a/a
$ hg --cwd a ci -d '1 0' -m 'modify a file'
$ hg --cwd a tip -q
1:8231f652da37
$ hg convert -d svn a
assuming destination a-hg
initializing svn repository 'a-hg'
initializing svn working copy 'a-hg-wc'
scanning source...
sorting...
converting...
1 add a file
0 modify a file
$ svnupanddisplay a-hg-wc 2
At revision 2.
2 2 test .
2 2 test a
2 1 test d1
2 1 test d1/d2
2 1 test d1/d2/b
2 1 test link
<?xml version="1.0"?>
<log>
<logentry
revision="2">
<author>test</author>
<date/>
<paths>
<path
action="M">/a</path>
</paths>
<msg>modify a file</msg>
</logentry>
<logentry
revision="1">
<author>test</author>
<date/>
<paths>
<path
action="A">/a</path>
<path
action="A">/d1</path>
<path
action="A">/d1/d2</path>
<path
action="A">/d1/d2/b</path>
<path
action="A">/link</path>
</paths>
<msg>add a file</msg>
</logentry>
</log>
$ ls a a-hg-wc
a:
a
d1
link
a-hg-wc:
a
d1
link
$ cmp a/a a-hg-wc/a
Rename
$ hg --cwd a mv a b
$ hg --cwd a mv link newlink
$ hg --cwd a ci -d '2 0' -m 'rename a file'
$ hg --cwd a tip -q
2:a67e26ccec09
$ hg convert -d svn a
assuming destination a-hg
initializing svn working copy 'a-hg-wc'
scanning source...
sorting...
converting...
0 rename a file
$ svnupanddisplay a-hg-wc 1
At revision 3.
3 3 test .
3 3 test b
3 1 test d1
3 1 test d1/d2
3 1 test d1/d2/b
3 3 test newlink
<?xml version="1.0"?>
<log>
<logentry
revision="3">
<author>test</author>
<date/>
<paths>
<path
action="D">/a</path>
<path
copyfrom-path="/a"
copyfrom-rev="2"
action="A">/b</path>
<path
copyfrom-path="/link"
copyfrom-rev="2"
action="A">/newlink</path>
<path
action="D">/link</path>
</paths>
<msg>rename a file</msg>
</logentry>
</log>
$ ls a a-hg-wc
a:
b
d1
newlink
a-hg-wc:
b
d1
newlink
Copy
$ hg --cwd a cp b c
$ hg --cwd a ci -d '3 0' -m 'copy a file'
$ hg --cwd a tip -q
3:0cf087b9ab02
$ hg convert -d svn a
assuming destination a-hg
initializing svn working copy 'a-hg-wc'
scanning source...
sorting...
converting...
0 copy a file
$ svnupanddisplay a-hg-wc 1
At revision 4.
4 4 test .
4 3 test b
4 4 test c
4 1 test d1
4 1 test d1/d2
4 1 test d1/d2/b
4 3 test newlink
<?xml version="1.0"?>
<log>
<logentry
revision="4">
<author>test</author>
<date/>
<paths>
<path
copyfrom-path="/b"
copyfrom-rev="3"
action="A">/c</path>
</paths>
<msg>copy a file</msg>
</logentry>
</log>
$ ls a a-hg-wc
a:
b
c
d1
newlink
a-hg-wc:
b
c
d1
newlink
$ hg --cwd a rm b
$ echo % remove
% remove
$ hg --cwd a ci -d '4 0' -m 'remove a file'
$ hg --cwd a tip -q
4:07b2e34a5b17
$ hg convert -d svn a
assuming destination a-hg
initializing svn working copy 'a-hg-wc'
scanning source...
sorting...
converting...
0 remove a file
$ svnupanddisplay a-hg-wc 1
At revision 5.
5 5 test .
5 4 test c
5 1 test d1
5 1 test d1/d2
5 1 test d1/d2/b
5 3 test newlink
<?xml version="1.0"?>
<log>
<logentry
revision="5">
<author>test</author>
<date/>
<paths>
<path
action="D">/b</path>
</paths>
<msg>remove a file</msg>
</logentry>
</log>
$ ls a a-hg-wc
a:
c
d1
newlink
a-hg-wc:
c
d1
newlink
Exectutable
$ chmod +x a/c
$ hg --cwd a ci -d '5 0' -m 'make a file executable'
$ hg --cwd a tip -q
5:31093672760b
$ hg convert -d svn a
assuming destination a-hg
initializing svn working copy 'a-hg-wc'
scanning source...
sorting...
converting...
0 make a file executable
$ svnupanddisplay a-hg-wc 1
At revision 6.
6 6 test .
6 6 test c
6 1 test d1
6 1 test d1/d2
6 1 test d1/d2/b
6 3 test newlink
<?xml version="1.0"?>
<log>
<logentry
revision="6">
<author>test</author>
<date/>
<paths>
<path
action="M">/c</path>
</paths>
<msg>make a file executable</msg>
</logentry>
</log>
$ test -x a-hg-wc/c
Executable in new directory
$ rm -rf a a-hg a-hg-wc
$ hg init a
$ mkdir a/d1
$ echo a > a/d1/a
$ chmod +x a/d1/a
$ hg --cwd a ci -d '0 0' -A -m 'add executable file in new directory'
adding d1/a
$ hg convert -d svn a
assuming destination a-hg
initializing svn repository 'a-hg'
initializing svn working copy 'a-hg-wc'
scanning source...
sorting...
converting...
0 add executable file in new directory
$ svnupanddisplay a-hg-wc 1
At revision 1.
1 1 test .
1 1 test d1
1 1 test d1/a
<?xml version="1.0"?>
<log>
<logentry
revision="1">
<author>test</author>
<date/>
<paths>
<path
action="A">/d1</path>
<path
action="A">/d1/a</path>
</paths>
<msg>add executable file in new directory</msg>
</logentry>
</log>
$ test -x a-hg-wc/d1/a
Copy to new directory
$ mkdir a/d2
$ hg --cwd a cp d1/a d2/a
$ hg --cwd a ci -d '1 0' -A -m 'copy file to new directory'
$ hg convert -d svn a
assuming destination a-hg
initializing svn working copy 'a-hg-wc'
scanning source...
sorting...
converting...
0 copy file to new directory
$ svnupanddisplay a-hg-wc 1
At revision 2.
2 2 test .
2 1 test d1
2 1 test d1/a
2 2 test d2
2 2 test d2/a
<?xml version="1.0"?>
<log>
<logentry
revision="2">
<author>test</author>
<date/>
<paths>
<path
action="A">/d2</path>
<path
copyfrom-path="/d1/a"
copyfrom-rev="1"
action="A">/d2/a</path>
</paths>
<msg>copy file to new directory</msg>
</logentry>
</log>
Branchy history
$ hg init b
$ echo base > b/b
$ hg --cwd b ci -d '0 0' -Ambase
adding b
$ "$TESTDIR/svn-safe-append.py" left-1 b/b
$ echo left-1 > b/left-1
$ hg --cwd b ci -d '1 0' -Amleft-1
adding left-1
$ "$TESTDIR/svn-safe-append.py" left-2 b/b
$ echo left-2 > b/left-2
$ hg --cwd b ci -d '2 0' -Amleft-2
adding left-2
$ hg --cwd b up 0
1 files updated, 0 files merged, 2 files removed, 0 files unresolved
$ "$TESTDIR/svn-safe-append.py" right-1 b/b
$ echo right-1 > b/right-1
$ hg --cwd b ci -d '3 0' -Amright-1
adding right-1
created new head
$ "$TESTDIR/svn-safe-append.py" right-2 b/b
$ echo right-2 > b/right-2
$ hg --cwd b ci -d '4 0' -Amright-2
adding right-2
$ hg --cwd b up -C 2
3 files updated, 0 files merged, 2 files removed, 0 files unresolved
$ hg --cwd b merge
merging b
warning: conflicts during merge.
merging b failed!
2 files updated, 0 files merged, 0 files removed, 1 files unresolved
use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
[1]
$ hg --cwd b revert -r 2 b
$ hg resolve -m b
$ hg --cwd b ci -d '5 0' -m 'merge'
Expect 4 changes
$ hg convert -d svn b
assuming destination b-hg
initializing svn repository 'b-hg'
initializing svn working copy 'b-hg-wc'
scanning source...
sorting...
converting...
5 base
4 left-1
3 left-2
2 right-1
1 right-2
0 merge
$ svnupanddisplay b-hg-wc 0
At revision 4.
4 4 test .
4 3 test b
4 2 test left-1
4 3 test left-2
4 4 test right-1
4 4 test right-2
<?xml version="1.0"?>
<log>
<logentry
revision="4">
<author>test</author>
<date/>
<paths>
<path
action="A">/right-1</path>
<path
action="A">/right-2</path>
</paths>
<msg>merge</msg>
</logentry>
<logentry
revision="3">
<author>test</author>
<date/>
<paths>
<path
action="M">/b</path>
<path
action="A">/left-2</path>
</paths>
<msg>left-2</msg>
</logentry>
<logentry
revision="2">
<author>test</author>
<date/>
<paths>
<path
action="M">/b</path>
<path
action="A">/left-1</path>
</paths>
<msg>left-1</msg>
</logentry>
<logentry
revision="1">
<author>test</author>
<date/>
<paths>
<path
action="A">/b</path>
</paths>
<msg>base</msg>
</logentry>
</log>
Tags are not supported, but must not break conversion
$ rm -rf a a-hg a-hg-wc
$ hg init a
$ echo a > a/a
$ hg --cwd a ci -d '0 0' -A -m 'Add file a'
adding a
$ hg --cwd a tag -d '1 0' -m 'Tagged as v1.0' v1.0
$ hg convert -d svn a
assuming destination a-hg
initializing svn repository 'a-hg'
initializing svn working copy 'a-hg-wc'
scanning source...
sorting...
converting...
1 Add file a
0 Tagged as v1.0
writing Subversion tags is not yet implemented
$ svnupanddisplay a-hg-wc 2
At revision 2.
2 2 test .
2 1 test a
2 2 test .hgtags
<?xml version="1.0"?>
<log>
<logentry
revision="2">
<author>test</author>
<date/>
<paths>
<path
action="A">/.hgtags</path>
</paths>
<msg>Tagged as v1.0</msg>
</logentry>
<logentry
revision="1">
<author>test</author>
<date/>
<paths>
<path
action="A">/a</path>
</paths>
<msg>Add file a</msg>
</logentry>
</log>
$ rm -rf a a-hg a-hg-wc

View File

@ -1,89 +0,0 @@
#!/bin/sh
"$TESTDIR/hghave" svn svn-bindings || exit 80
fix_path()
{
tr '\\' /
}
echo "[extensions]" >> $HGRCPATH
echo "convert = " >> $HGRCPATH
echo 'graphlog =' >> $HGRCPATH
svnadmin create svn-repo
svnpath=`pwd | fix_path`
# SVN wants all paths to start with a slash. Unfortunately,
# Windows ones don't. Handle that.
expr "$svnpath" : "\/" > /dev/null
if [ $? -ne 0 ]; then
svnpath="/$svnpath"
fi
echo "# now tests that it works with trunk/tags layout, but no branches yet"
echo
echo % initial svn import
mkdir projB
cd projB
mkdir trunk
mkdir tags
cd ..
svnurl="file://$svnpath/svn-repo/proj%20B"
svn import -m "init projB" projB "$svnurl" | fix_path
echo % update svn repository
svn co "$svnurl"/trunk B | fix_path
cd B
echo hello > 'letter .txt'
svn add 'letter .txt'
svn ci -m hello
"$TESTDIR/svn-safe-append.py" world 'letter .txt'
svn ci -m world
svn copy -m "tag v0.1" "$svnurl"/trunk "$svnurl"/tags/v0.1
"$TESTDIR/svn-safe-append.py" 'nice day today!' 'letter .txt'
svn ci -m "nice day"
cd ..
echo % convert to hg once
hg convert "$svnurl" B-hg
echo % update svn repository again
cd B
"$TESTDIR/svn-safe-append.py" "see second letter" 'letter .txt'
echo "nice to meet you" > letter2.txt
svn add letter2.txt
svn ci -m "second letter"
svn copy -m "tag v0.2" "$svnurl"/trunk "$svnurl"/tags/v0.2
"$TESTDIR/svn-safe-append.py" "blah-blah-blah" letter2.txt
svn ci -m "work in progress"
cd ..
########################################
echo % test incremental conversion
hg convert "$svnurl" B-hg
cd B-hg
hg glog --template '{rev} {desc|firstline} files: {files}\n'
hg tags -q
cd ..
echo % test filemap
echo 'include letter2.txt' > filemap
hg convert --filemap filemap "$svnurl"/trunk fmap
hg glog -R fmap --template '{rev} {desc|firstline} files: {files}\n'
echo % test stop revision
hg convert --rev 1 "$svnurl"/trunk stoprev
# Check convert_revision extra-records.
# This is also the only place testing more than one extra field
# in a revision.
hg --cwd stoprev tip --debug | grep extra | sed 's/=.*/=/'

View File

@ -1,91 +0,0 @@
# now tests that it works with trunk/tags layout, but no branches yet
% initial svn import
Adding projB/trunk
Adding projB/tags
Committed revision 1.
% update svn repository
Checked out revision 1.
A letter .txt
Adding letter .txt
Transmitting file data .
Committed revision 2.
Sending letter .txt
Transmitting file data .
Committed revision 3.
Committed revision 4.
Sending letter .txt
Transmitting file data .
Committed revision 5.
% convert to hg once
initializing destination B-hg repository
scanning source...
sorting...
converting...
3 init projB
2 hello
1 world
0 nice day
updating tags
% update svn repository again
A letter2.txt
Sending letter .txt
Adding letter2.txt
Transmitting file data ..
Committed revision 6.
Committed revision 7.
Sending letter2.txt
Transmitting file data .
Committed revision 8.
% test incremental conversion
scanning source...
sorting...
converting...
1 second letter
0 work in progress
updating tags
o 7 update tags files: .hgtags
|
o 6 work in progress files: letter2.txt
|
o 5 second letter files: letter .txt letter2.txt
|
o 4 update tags files: .hgtags
|
o 3 nice day files: letter .txt
|
o 2 world files: letter .txt
|
o 1 hello files: letter .txt
|
o 0 init projB files:
tip
v0.2
v0.1
% test filemap
initializing destination fmap repository
scanning source...
sorting...
converting...
5 init projB
4 hello
3 world
2 nice day
1 second letter
0 work in progress
o 1 work in progress files: letter2.txt
|
o 0 second letter files: letter2.txt
% test stop revision
initializing destination stoprev repository
scanning source...
sorting...
converting...
0 init projB
extra: branch=
extra: convert_revision=

View File

@ -0,0 +1,179 @@
$ "$TESTDIR/hghave" svn svn-bindings || exit 80
$ fixpath()
> {
> tr '\\' /
> }
$ cat > $HGRCPATH <<EOF
> [extensions]
> convert =
> graphlog =
> EOF
$ svnadmin create svn-repo
$ svnadmin setuuid svn-repo 00000000-0000-0000-0000-000000000000
$ svnpath=`pwd | fixpath`
$ expr "$svnpath" : "\/" > /dev/null
> if [ $? -ne 0 ]; then
> svnpath="/$svnpath"
> fi
> svnurl="file://$svnpath/svn-repo"
Now test that it works with trunk/tags layout, but no branches yet.
Initial svn import
$ mkdir projB
$ cd projB
$ mkdir trunk
$ mkdir tags
$ cd ..
$ svnurl="file://$svnpath/svn-repo/proj%20B"
$ svn import -m "init projB" projB "$svnurl" | fixpath
Adding projB/trunk
Adding projB/tags
Committed revision 1.
Update svn repository
$ svn co "$svnurl"/trunk B | fixpath
Checked out revision 1.
$ cd B
$ echo hello > 'letter .txt'
$ svn add 'letter .txt'
A letter .txt
$ svn ci -m hello
Adding letter .txt
Transmitting file data .
Committed revision 2.
$ "$TESTDIR/svn-safe-append.py" world 'letter .txt'
$ svn ci -m world
Sending letter .txt
Transmitting file data .
Committed revision 3.
$ svn copy -m "tag v0.1" "$svnurl"/trunk "$svnurl"/tags/v0.1
Committed revision 4.
$ "$TESTDIR/svn-safe-append.py" 'nice day today!' 'letter .txt'
$ svn ci -m "nice day"
Sending letter .txt
Transmitting file data .
Committed revision 5.
$ cd ..
Convert to hg once
$ hg convert "$svnurl" B-hg
initializing destination B-hg repository
scanning source...
sorting...
converting...
3 init projB
2 hello
1 world
0 nice day
updating tags
Update svn repository again
$ cd B
$ "$TESTDIR/svn-safe-append.py" "see second letter" 'letter .txt'
$ echo "nice to meet you" > letter2.txt
$ svn add letter2.txt
A letter2.txt
$ svn ci -m "second letter"
Sending letter .txt
Adding letter2.txt
Transmitting file data ..
Committed revision 6.
$ svn copy -m "tag v0.2" "$svnurl"/trunk "$svnurl"/tags/v0.2
Committed revision 7.
$ "$TESTDIR/svn-safe-append.py" "blah-blah-blah" letter2.txt
$ svn ci -m "work in progress"
Sending letter2.txt
Transmitting file data .
Committed revision 8.
$ cd ..
########################################
Test incremental conversion
$ hg convert "$svnurl" B-hg
scanning source...
sorting...
converting...
1 second letter
0 work in progress
updating tags
$ cd B-hg
$ hg glog --template '{rev} {desc|firstline} files: {files}\n'
o 7 update tags files: .hgtags
|
o 6 work in progress files: letter2.txt
|
o 5 second letter files: letter .txt letter2.txt
|
o 4 update tags files: .hgtags
|
o 3 nice day files: letter .txt
|
o 2 world files: letter .txt
|
o 1 hello files: letter .txt
|
o 0 init projB files:
$ hg tags -q
tip
v0.2
v0.1
$ cd ..
Test filemap
$ echo 'include letter2.txt' > filemap
$ hg convert --filemap filemap "$svnurl"/trunk fmap
initializing destination fmap repository
scanning source...
sorting...
converting...
5 init projB
4 hello
3 world
2 nice day
1 second letter
0 work in progress
$ hg glog -R fmap --template '{rev} {desc|firstline} files: {files}\n'
o 1 work in progress files: letter2.txt
|
o 0 second letter files: letter2.txt
Test stop revision
$ hg convert --rev 1 "$svnurl"/trunk stoprev
initializing destination stoprev repository
scanning source...
sorting...
converting...
0 init projB
Check convert_revision extra-records.
This is also the only place testing more than one extra field in a revision.
$ cd stoprev
$ hg tip --debug | grep extra
extra: branch=default
extra: convert_revision=svn:00000000-0000-0000-0000-000000000000/proj B/trunk@1
$ cd ..

View File

@ -1,32 +0,0 @@
#!/bin/sh
"$TESTDIR/hghave" svn svn-bindings || exit 80
echo "[extensions]" >> $HGRCPATH
echo "convert = " >> $HGRCPATH
echo "graphlog =" >> $HGRCPATH
svnadmin create svn-repo
cat "$TESTDIR/svn/startrev.svndump" | svnadmin load svn-repo > /dev/null
convert()
{
startrev=$1
repopath=A-r$startrev-hg
hg convert --config convert.svn.startrev=$startrev \
--config convert.svn.trunk=branches/branch1 \
--config convert.svn.branches=" " \
--config convert.svn.tags= \
--datesort svn-repo $repopath
hg -R $repopath glog --template '{rev} {desc|firstline} files: {files}\n'
echo
}
echo % convert before branching point
convert 3
echo % convert before branching point
convert 4
echo % convert at branching point
convert 5
echo % convert last revision only
convert 6

View File

@ -1,54 +0,0 @@
% convert before branching point
initializing destination A-r3-hg repository
scanning source...
sorting...
converting...
3 removeb
2 changeaa
1 branch, changeaaa
0 addc,changeaaaa
o 3 addc,changeaaaa files: a c
|
o 2 branch, changeaaa files: a
|
o 1 changeaa files: a
|
o 0 removeb files: a
% convert before branching point
initializing destination A-r4-hg repository
scanning source...
sorting...
converting...
2 changeaa
1 branch, changeaaa
0 addc,changeaaaa
o 2 addc,changeaaaa files: a c
|
o 1 branch, changeaaa files: a
|
o 0 changeaa files: a
% convert at branching point
initializing destination A-r5-hg repository
scanning source...
sorting...
converting...
1 branch, changeaaa
0 addc,changeaaaa
o 1 addc,changeaaaa files: a c
|
o 0 branch, changeaaa files: a
% convert last revision only
initializing destination A-r6-hg repository
scanning source...
sorting...
converting...
0 addc,changeaaaa
o 0 addc,changeaaaa files: a c

View File

@ -0,0 +1,90 @@
$ "$TESTDIR/hghave" svn svn-bindings || exit 80
$ cat > $HGRCPATH <<EOF
> [extensions]
> convert =
> graphlog =
> EOF
$ convert()
> {
> startrev=$1
> repopath=A-r$startrev-hg
> hg convert --config convert.svn.startrev=$startrev \
> --config convert.svn.trunk=branches/branch1 \
> --config convert.svn.branches=" " \
> --config convert.svn.tags= \
> --datesort svn-repo $repopath
> hg -R $repopath glog \
> --template '{rev} {desc|firstline} files: {files}\n'
> echo
> }
$ svnadmin create svn-repo
$ svnadmin load -q svn-repo < "$TESTDIR/svn/startrev.svndump"
Convert before branching point
$ convert 3
initializing destination A-r3-hg repository
scanning source...
sorting...
converting...
3 removeb
2 changeaa
1 branch, changeaaa
0 addc,changeaaaa
o 3 addc,changeaaaa files: a c
|
o 2 branch, changeaaa files: a
|
o 1 changeaa files: a
|
o 0 removeb files: a
Convert before branching point
$ convert 4
initializing destination A-r4-hg repository
scanning source...
sorting...
converting...
2 changeaa
1 branch, changeaaa
0 addc,changeaaaa
o 2 addc,changeaaaa files: a c
|
o 1 branch, changeaaa files: a
|
o 0 changeaa files: a
Convert at branching point
$ convert 5
initializing destination A-r5-hg repository
scanning source...
sorting...
converting...
1 branch, changeaaa
0 addc,changeaaaa
o 1 addc,changeaaaa files: a c
|
o 0 branch, changeaaa files: a
Convert last revision only
$ convert 6
initializing destination A-r6-hg repository
scanning source...
sorting...
converting...
0 addc,changeaaaa
o 0 addc,changeaaaa files: a c

View File

@ -1,23 +0,0 @@
#!/bin/sh
"$TESTDIR/hghave" svn svn-bindings || exit 80
echo "[extensions]" >> $HGRCPATH
echo "convert = " >> $HGRCPATH
echo "graphlog =" >> $HGRCPATH
svnadmin create svn-repo
cat "$TESTDIR/svn/tags.svndump" | svnadmin load svn-repo > /dev/null
echo % convert
hg convert --datesort svn-repo A-hg
cd A-hg
hg glog --template '{rev} {desc|firstline} tags: {tags}\n'
hg tags | sed 's/:.*/:/'
cd ..
echo % convert without tags
hg convert --datesort --config convert.svn.tags= svn-repo A-notags-hg
hg -R A-notags-hg tags -q

View File

@ -1,41 +0,0 @@
% convert
initializing destination A-hg repository
scanning source...
sorting...
converting...
5 init projA
4 adda
3 changea
2 changea2
1 changea3
0 changea
updating tags
o 6 update tags tags: tip
|
o 5 changea tags: trunk.goodtag
|
o 4 changea3 tags:
|
o 3 changea2 tags: trunk.v1
|
o 2 changea tags:
|
o 1 adda tags:
|
o 0 init projA tags:
tip 6:
trunk.goodtag 5:
trunk.v1 3:
% convert without tags
initializing destination A-notags-hg repository
scanning source...
sorting...
converting...
5 init projA
4 adda
3 changea
2 changea2
1 changea3
0 changea
tip

View File

@ -0,0 +1,67 @@
$ "$TESTDIR/hghave" svn svn-bindings || exit 80
$ cat > $HGRCPATH <<EOF
> [extensions]
> convert =
> graphlog =
> EOF
$ svnadmin create svn-repo
$ svnadmin load -q svn-repo < "$TESTDIR/svn/tags.svndump"
Convert
$ hg convert --datesort svn-repo A-hg
initializing destination A-hg repository
scanning source...
sorting...
converting...
5 init projA
4 adda
3 changea
2 changea2
1 changea3
0 changea
updating tags
$ cd A-hg
$ hg glog --template '{rev} {desc|firstline} tags: {tags}\n'
o 6 update tags tags: tip
|
o 5 changea tags: trunk.goodtag
|
o 4 changea3 tags:
|
o 3 changea2 tags: trunk.v1
|
o 2 changea tags:
|
o 1 adda tags:
|
o 0 init projA tags:
$ hg tags -q
tip
trunk.goodtag
trunk.v1
$ cd ..
Convert without tags
$ hg convert --datesort --config convert.svn.tags= svn-repo A-notags-hg
initializing destination A-notags-hg repository
scanning source...
sorting...
converting...
5 init projA
4 adda
3 changea
2 changea2
1 changea3
0 changea
$ hg -R A-notags-hg tags -q
tip