Mercurial > hg
annotate tests/test-convert-hg-svn @ 12332:680fe77ab5b8
bundlerepo: use bundle objects everywhere
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Fri, 17 Sep 2010 19:24:29 -0500 |
parents | c52057614c72 |
children |
rev | line source |
---|---|
5554
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
1 #!/bin/sh |
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
2 |
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
3 "$TESTDIR/hghave" svn svn-bindings || exit 80 |
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
4 |
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
5 fix_path() |
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
6 { |
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
7 tr '\\' / |
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
8 } |
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
9 |
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
10 echo "[extensions]" >> $HGRCPATH |
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
11 echo "convert = " >> $HGRCPATH |
10051
a02d43acbc04
convert/svn: make sink recover gracefully from empty changeset
Patrick Mezard <pmezard@gmail.com>
parents:
5809
diff
changeset
|
12 echo "mq = " >> $HGRCPATH |
5554
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
13 |
5809
34c4131abdf9
test-convert-hg-svn: make it more windows friendly
Patrick Mezard <pmezard@gmail.com>
parents:
5554
diff
changeset
|
14 svnpath=`pwd | fix_path`/svn-repo |
10775
c52057614c72
Tests with spaces in paths
Mads Kiilerich <mads@kiilerich.com>
parents:
10051
diff
changeset
|
15 svnadmin create "$svnpath" |
5554
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
16 |
10775
c52057614c72
Tests with spaces in paths
Mads Kiilerich <mads@kiilerich.com>
parents:
10051
diff
changeset
|
17 cat > "$svnpath"/hooks/pre-revprop-change <<'EOF' |
5554
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
18 #!/bin/sh |
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
19 |
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
20 REPOS="$1" |
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
21 REV="$2" |
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
22 USER="$3" |
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
23 PROPNAME="$4" |
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
24 ACTION="$5" |
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
25 |
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
26 if [ "$ACTION" = "M" -a "$PROPNAME" = "svn:log" ]; then exit 0; fi |
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
27 if [ "$ACTION" = "A" -a "$PROPNAME" = "hg:convert-branch" ]; then exit 0; fi |
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
28 if [ "$ACTION" = "A" -a "$PROPNAME" = "hg:convert-rev" ]; then exit 0; fi |
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
29 |
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
30 echo "Changing prohibited revision property" >&2 |
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
31 exit 1 |
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
32 EOF |
10775
c52057614c72
Tests with spaces in paths
Mads Kiilerich <mads@kiilerich.com>
parents:
10051
diff
changeset
|
33 chmod +x "$svnpath"/hooks/pre-revprop-change |
5554
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
34 |
5809
34c4131abdf9
test-convert-hg-svn: make it more windows friendly
Patrick Mezard <pmezard@gmail.com>
parents:
5554
diff
changeset
|
35 # SVN wants all paths to start with a slash. Unfortunately, |
34c4131abdf9
test-convert-hg-svn: make it more windows friendly
Patrick Mezard <pmezard@gmail.com>
parents:
5554
diff
changeset
|
36 # Windows ones don't. Handle that. |
10775
c52057614c72
Tests with spaces in paths
Mads Kiilerich <mads@kiilerich.com>
parents:
10051
diff
changeset
|
37 svnurl="$svnpath" |
c52057614c72
Tests with spaces in paths
Mads Kiilerich <mads@kiilerich.com>
parents:
10051
diff
changeset
|
38 expr "$svnurl" : "\/" > /dev/null |
5809
34c4131abdf9
test-convert-hg-svn: make it more windows friendly
Patrick Mezard <pmezard@gmail.com>
parents:
5554
diff
changeset
|
39 if [ $? -ne 0 ]; then |
10775
c52057614c72
Tests with spaces in paths
Mads Kiilerich <mads@kiilerich.com>
parents:
10051
diff
changeset
|
40 svnurl="/$svnurl" |
5809
34c4131abdf9
test-convert-hg-svn: make it more windows friendly
Patrick Mezard <pmezard@gmail.com>
parents:
5554
diff
changeset
|
41 fi |
10775
c52057614c72
Tests with spaces in paths
Mads Kiilerich <mads@kiilerich.com>
parents:
10051
diff
changeset
|
42 svnurl="file://$svnurl" |
c52057614c72
Tests with spaces in paths
Mads Kiilerich <mads@kiilerich.com>
parents:
10051
diff
changeset
|
43 svn co "$svnurl" "$svnpath"-wc |
5554
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
44 |
10775
c52057614c72
Tests with spaces in paths
Mads Kiilerich <mads@kiilerich.com>
parents:
10051
diff
changeset
|
45 cd "$svnpath"-wc |
5554
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
46 echo a > a |
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
47 svn add a |
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
48 svn ci -m'added a' a |
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
49 |
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
50 cd .. |
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
51 |
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
52 echo % initial roundtrip |
10775
c52057614c72
Tests with spaces in paths
Mads Kiilerich <mads@kiilerich.com>
parents:
10051
diff
changeset
|
53 hg convert -s svn -d hg "$svnpath"-wc "$svnpath"-hg | grep -v initializing |
c52057614c72
Tests with spaces in paths
Mads Kiilerich <mads@kiilerich.com>
parents:
10051
diff
changeset
|
54 hg convert -s hg -d svn "$svnpath"-hg "$svnpath"-wc |
5554
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
55 |
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
56 echo % second roundtrip should do nothing |
10775
c52057614c72
Tests with spaces in paths
Mads Kiilerich <mads@kiilerich.com>
parents:
10051
diff
changeset
|
57 hg convert -s svn -d hg "$svnpath"-wc "$svnpath"-hg |
c52057614c72
Tests with spaces in paths
Mads Kiilerich <mads@kiilerich.com>
parents:
10051
diff
changeset
|
58 hg convert -s hg -d svn "$svnpath"-hg "$svnpath"-wc |
5554
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
59 |
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
60 echo % new hg rev |
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
61 |
10775
c52057614c72
Tests with spaces in paths
Mads Kiilerich <mads@kiilerich.com>
parents:
10051
diff
changeset
|
62 hg clone "$svnpath"-hg "$svnpath"-work |
c52057614c72
Tests with spaces in paths
Mads Kiilerich <mads@kiilerich.com>
parents:
10051
diff
changeset
|
63 cd "$svnpath"-work |
10051
a02d43acbc04
convert/svn: make sink recover gracefully from empty changeset
Patrick Mezard <pmezard@gmail.com>
parents:
5809
diff
changeset
|
64 echo b > b |
a02d43acbc04
convert/svn: make sink recover gracefully from empty changeset
Patrick Mezard <pmezard@gmail.com>
parents:
5809
diff
changeset
|
65 hg add b |
a02d43acbc04
convert/svn: make sink recover gracefully from empty changeset
Patrick Mezard <pmezard@gmail.com>
parents:
5809
diff
changeset
|
66 hg ci -mb |
a02d43acbc04
convert/svn: make sink recover gracefully from empty changeset
Patrick Mezard <pmezard@gmail.com>
parents:
5809
diff
changeset
|
67 echo '% adding an empty revision' |
a02d43acbc04
convert/svn: make sink recover gracefully from empty changeset
Patrick Mezard <pmezard@gmail.com>
parents:
5809
diff
changeset
|
68 hg qnew -m emtpy empty |
a02d43acbc04
convert/svn: make sink recover gracefully from empty changeset
Patrick Mezard <pmezard@gmail.com>
parents:
5809
diff
changeset
|
69 hg qfinish -a |
a02d43acbc04
convert/svn: make sink recover gracefully from empty changeset
Patrick Mezard <pmezard@gmail.com>
parents:
5809
diff
changeset
|
70 cd .. |
5554
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
71 |
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
72 echo % echo hg to svn |
10775
c52057614c72
Tests with spaces in paths
Mads Kiilerich <mads@kiilerich.com>
parents:
10051
diff
changeset
|
73 hg --cwd "$svnpath"-hg pull -q "$svnpath"-work |
c52057614c72
Tests with spaces in paths
Mads Kiilerich <mads@kiilerich.com>
parents:
10051
diff
changeset
|
74 hg convert -s hg -d svn "$svnpath"-hg "$svnpath"-wc |
5554
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
75 |
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
76 echo % svn back to hg should do nothing |
10775
c52057614c72
Tests with spaces in paths
Mads Kiilerich <mads@kiilerich.com>
parents:
10051
diff
changeset
|
77 hg convert -s svn -d hg "$svnpath"-wc "$svnpath"-hg |
5554
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
78 echo % hg back to svn should do nothing |
10775
c52057614c72
Tests with spaces in paths
Mads Kiilerich <mads@kiilerich.com>
parents:
10051
diff
changeset
|
79 hg convert -s hg -d svn "$svnpath"-hg "$svnpath"-wc |