Mercurial > hg
annotate tests/test-convert-hg-svn @ 10190:9c2c94934f0d
mq: upgrade to git patch when necessary (issue767)
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Fri, 01 Jan 2010 21:21:34 +0100 |
parents | a02d43acbc04 |
children | c52057614c72 |
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 |
5554
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
15 svnadmin create $svnpath |
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
16 |
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
17 cat > $svnpath/hooks/pre-revprop-change <<'EOF' |
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 |
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
33 chmod +x $svnpath/hooks/pre-revprop-change |
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. |
34c4131abdf9
test-convert-hg-svn: make it more windows friendly
Patrick Mezard <pmezard@gmail.com>
parents:
5554
diff
changeset
|
37 svnurl=$svnpath |
34c4131abdf9
test-convert-hg-svn: make it more windows friendly
Patrick Mezard <pmezard@gmail.com>
parents:
5554
diff
changeset
|
38 expr $svnurl : "\/" > /dev/null |
34c4131abdf9
test-convert-hg-svn: make it more windows friendly
Patrick Mezard <pmezard@gmail.com>
parents:
5554
diff
changeset
|
39 if [ $? -ne 0 ]; then |
34c4131abdf9
test-convert-hg-svn: make it more windows friendly
Patrick Mezard <pmezard@gmail.com>
parents:
5554
diff
changeset
|
40 svnurl='/'$svnurl |
34c4131abdf9
test-convert-hg-svn: make it more windows friendly
Patrick Mezard <pmezard@gmail.com>
parents:
5554
diff
changeset
|
41 fi |
34c4131abdf9
test-convert-hg-svn: make it more windows friendly
Patrick Mezard <pmezard@gmail.com>
parents:
5554
diff
changeset
|
42 svnurl=file://$svnurl |
5554
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
43 svn co $svnurl $svnpath-wc |
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
44 |
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
45 cd $svnpath-wc |
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 |
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
53 hg convert -s svn -d hg $svnpath-wc $svnpath-hg | grep -v initializing |
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
54 hg convert -s hg -d svn $svnpath-hg $svnpath-wc |
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 |
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
57 hg convert -s svn -d hg $svnpath-wc $svnpath-hg |
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
58 hg convert -s hg -d svn $svnpath-hg $svnpath-wc |
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 |
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
62 hg clone $svnpath-hg $svnpath-work |
10051
a02d43acbc04
convert/svn: make sink recover gracefully from empty changeset
Patrick Mezard <pmezard@gmail.com>
parents:
5809
diff
changeset
|
63 cd $svnpath-work |
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 |
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
73 hg --cwd $svnpath-hg pull -q $svnpath-work |
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
74 hg convert -s hg -d svn $svnpath-hg $svnpath-wc |
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 |
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
77 hg convert -s svn -d hg $svnpath-wc $svnpath-hg |
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 |
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
79 hg convert -s hg -d svn $svnpath-hg $svnpath-wc |