Mercurial > hg
comparison tests/test-convert-hg-svn @ 6042:2da5b19a6460
Merge with crew
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Wed, 06 Feb 2008 19:57:52 -0800 |
parents | 34c4131abdf9 |
children | a02d43acbc04 |
comparison
equal
deleted
inserted
replaced
6041:dd714452c26e | 6042:2da5b19a6460 |
---|---|
1 #!/bin/sh | |
2 | |
3 "$TESTDIR/hghave" svn svn-bindings || exit 80 | |
4 | |
5 fix_path() | |
6 { | |
7 tr '\\' / | |
8 } | |
9 | |
10 echo "[extensions]" >> $HGRCPATH | |
11 echo "convert = " >> $HGRCPATH | |
12 | |
13 svnpath=`pwd | fix_path`/svn-repo | |
14 svnadmin create $svnpath | |
15 | |
16 cat > $svnpath/hooks/pre-revprop-change <<'EOF' | |
17 #!/bin/sh | |
18 | |
19 REPOS="$1" | |
20 REV="$2" | |
21 USER="$3" | |
22 PROPNAME="$4" | |
23 ACTION="$5" | |
24 | |
25 if [ "$ACTION" = "M" -a "$PROPNAME" = "svn:log" ]; then exit 0; fi | |
26 if [ "$ACTION" = "A" -a "$PROPNAME" = "hg:convert-branch" ]; then exit 0; fi | |
27 if [ "$ACTION" = "A" -a "$PROPNAME" = "hg:convert-rev" ]; then exit 0; fi | |
28 | |
29 echo "Changing prohibited revision property" >&2 | |
30 exit 1 | |
31 EOF | |
32 chmod +x $svnpath/hooks/pre-revprop-change | |
33 | |
34 # SVN wants all paths to start with a slash. Unfortunately, | |
35 # Windows ones don't. Handle that. | |
36 svnurl=$svnpath | |
37 expr $svnurl : "\/" > /dev/null | |
38 if [ $? -ne 0 ]; then | |
39 svnurl='/'$svnurl | |
40 fi | |
41 svnurl=file://$svnurl | |
42 svn co $svnurl $svnpath-wc | |
43 | |
44 cd $svnpath-wc | |
45 echo a > a | |
46 svn add a | |
47 svn ci -m'added a' a | |
48 | |
49 cd .. | |
50 | |
51 echo % initial roundtrip | |
52 hg convert -s svn -d hg $svnpath-wc $svnpath-hg | grep -v initializing | |
53 hg convert -s hg -d svn $svnpath-hg $svnpath-wc | |
54 | |
55 echo % second roundtrip should do nothing | |
56 hg convert -s svn -d hg $svnpath-wc $svnpath-hg | |
57 hg convert -s hg -d svn $svnpath-hg $svnpath-wc | |
58 | |
59 echo % new hg rev | |
60 | |
61 hg clone $svnpath-hg $svnpath-work | |
62 echo b > $svnpath-work/b | |
63 hg --cwd $svnpath-work add b | |
64 hg --cwd $svnpath-work ci -mb | |
65 | |
66 echo % echo hg to svn | |
67 hg --cwd $svnpath-hg pull -q $svnpath-work | |
68 hg convert -s hg -d svn $svnpath-hg $svnpath-wc | |
69 | |
70 echo % svn back to hg should do nothing | |
71 hg convert -s svn -d hg $svnpath-wc $svnpath-hg | |
72 echo % hg back to svn should do nothing | |
73 hg convert -s hg -d svn $svnpath-hg $svnpath-wc |