Show More
@@ -0,0 +1,25 | |||||
|
1 | #!/usr/bin/env python | |||
|
2 | ||||
|
3 | __doc__ = """Same as `echo a >> b`, but ensures a changed mtime of b. | |||
|
4 | Without this svn will not detect workspace changes.""" | |||
|
5 | ||||
|
6 | import sys, os | |||
|
7 | ||||
|
8 | text = sys.argv[1] | |||
|
9 | fname = sys.argv[2] | |||
|
10 | ||||
|
11 | f = open(fname, "ab") | |||
|
12 | try: | |||
|
13 | before = os.fstat(f.fileno()).st_mtime | |||
|
14 | f.write(text) | |||
|
15 | f.write("\n") | |||
|
16 | finally: | |||
|
17 | f.close() | |||
|
18 | inc = 1 | |||
|
19 | now = os.stat(fname).st_mtime | |||
|
20 | while now == before: | |||
|
21 | t = now + inc | |||
|
22 | inc += 1 | |||
|
23 | os.utime(fname, (t, t)) | |||
|
24 | now = os.stat(fname).st_mtime | |||
|
25 |
@@ -1,89 +1,89 | |||||
1 | #!/bin/sh |
|
1 | #!/bin/sh | |
2 |
|
2 | |||
3 | "$TESTDIR/hghave" svn svn-bindings || exit 80 |
|
3 | "$TESTDIR/hghave" svn svn-bindings || exit 80 | |
4 |
|
4 | |||
5 | fix_path() |
|
5 | fix_path() | |
6 | { |
|
6 | { | |
7 | tr '\\' / |
|
7 | tr '\\' / | |
8 | } |
|
8 | } | |
9 |
|
9 | |||
10 | echo "[extensions]" >> $HGRCPATH |
|
10 | echo "[extensions]" >> $HGRCPATH | |
11 | echo "convert = " >> $HGRCPATH |
|
11 | echo "convert = " >> $HGRCPATH | |
12 | echo "hgext.graphlog =" >> $HGRCPATH |
|
12 | echo "hgext.graphlog =" >> $HGRCPATH | |
13 |
|
13 | |||
14 | svnadmin create svn-repo |
|
14 | svnadmin create svn-repo | |
15 |
|
15 | |||
16 | svnpath=`pwd | fix_path` |
|
16 | svnpath=`pwd | fix_path` | |
17 | # SVN wants all paths to start with a slash. Unfortunately, |
|
17 | # SVN wants all paths to start with a slash. Unfortunately, | |
18 | # Windows ones don't. Handle that. |
|
18 | # Windows ones don't. Handle that. | |
19 | expr $svnpath : "\/" > /dev/null |
|
19 | expr $svnpath : "\/" > /dev/null | |
20 | if [ $? -ne 0 ]; then |
|
20 | if [ $? -ne 0 ]; then | |
21 | svnpath='/'$svnpath |
|
21 | svnpath='/'$svnpath | |
22 | fi |
|
22 | fi | |
23 |
|
23 | |||
24 | echo % initial svn import |
|
24 | echo % initial svn import | |
25 | mkdir projA |
|
25 | mkdir projA | |
26 | cd projA |
|
26 | cd projA | |
27 | mkdir trunk |
|
27 | mkdir trunk | |
28 | mkdir branches |
|
28 | mkdir branches | |
29 | mkdir tags |
|
29 | mkdir tags | |
30 | cd .. |
|
30 | cd .. | |
31 |
|
31 | |||
32 | svnurl=file://$svnpath/svn-repo/projA |
|
32 | svnurl=file://$svnpath/svn-repo/projA | |
33 | svn import -m "init projA" projA $svnurl | fix_path |
|
33 | svn import -m "init projA" projA $svnurl | fix_path | |
34 |
|
34 | |||
35 | echo % update svn repository |
|
35 | echo % update svn repository | |
36 | svn co $svnurl A | fix_path |
|
36 | svn co $svnurl A | fix_path | |
37 | cd A |
|
37 | cd A | |
38 | echo hello > trunk/letter.txt |
|
38 | echo hello > trunk/letter.txt | |
39 | echo hey > trunk/letter2.txt |
|
39 | echo hey > trunk/letter2.txt | |
40 | echo ho > trunk/letter3.txt |
|
40 | echo ho > trunk/letter3.txt | |
41 | svn add trunk/letter.txt trunk/letter2.txt trunk/letter3.txt |
|
41 | svn add trunk/letter.txt trunk/letter2.txt trunk/letter3.txt | |
42 | svn ci -m hello |
|
42 | svn ci -m hello | |
43 |
|
43 | |||
44 | echo % branch to old letters |
|
44 | echo % branch to old letters | |
45 | svn copy trunk branches/old |
|
45 | svn copy trunk branches/old | |
46 | svn rm branches/old/letter3.txt |
|
46 | svn rm branches/old/letter3.txt | |
47 | svn ci -m "branch trunk, remove letter3" |
|
47 | svn ci -m "branch trunk, remove letter3" | |
48 | svn up |
|
48 | svn up | |
49 |
|
49 | |||
50 | echo % update trunk |
|
50 | echo % update trunk | |
51 |
|
|
51 | "$TESTDIR/svn-safe-append.py" "what can I say ?" trunk/letter.txt | |
52 | svn ci -m "change letter" |
|
52 | svn ci -m "change letter" | |
53 |
|
53 | |||
54 | echo % update old branch |
|
54 | echo % update old branch | |
55 |
|
|
55 | "$TESTDIR/svn-safe-append.py" "what's up ?" branches/old/letter2.txt | |
56 | svn ci -m "change letter2" |
|
56 | svn ci -m "change letter2" | |
57 |
|
57 | |||
58 | echo % create a cross-branch revision |
|
58 | echo % create a cross-branch revision | |
59 | svn move -m "move letter2" trunk/letter2.txt \ |
|
59 | svn move -m "move letter2" trunk/letter2.txt \ | |
60 | branches/old/letter3.txt |
|
60 | branches/old/letter3.txt | |
61 |
|
|
61 | "$TESTDIR/svn-safe-append.py" "I am fine" branches/old/letter3.txt | |
62 | svn ci -m "move and update letter3.txt" |
|
62 | svn ci -m "move and update letter3.txt" | |
63 |
|
63 | |||
64 | echo % update old branch again |
|
64 | echo % update old branch again | |
65 |
|
|
65 | "$TESTDIR/svn-safe-append.py" "bye" branches/old/letter2.txt | |
66 | svn ci -m "change letter2 again" |
|
66 | svn ci -m "change letter2 again" | |
67 |
|
67 | |||
68 | echo % update trunk again |
|
68 | echo % update trunk again | |
69 |
|
|
69 | "$TESTDIR/svn-safe-append.py" "how are you ?" trunk/letter.txt | |
70 | svn ci -m "last change to letter" |
|
70 | svn ci -m "last change to letter" | |
71 | cd .. |
|
71 | cd .. | |
72 |
|
72 | |||
73 | echo % convert trunk and branches |
|
73 | echo % convert trunk and branches | |
74 | hg convert --datesort $svnurl A-hg |
|
74 | hg convert --datesort $svnurl A-hg | |
75 |
|
75 | |||
76 | echo % branch again from a converted revision |
|
76 | echo % branch again from a converted revision | |
77 | cd A |
|
77 | cd A | |
78 | svn copy -r 1 $svnurl/trunk branches/old2 |
|
78 | svn copy -r 1 $svnurl/trunk branches/old2 | |
79 | svn ci -m "branch trunk@1 into old2" |
|
79 | svn ci -m "branch trunk@1 into old2" | |
80 | cd .. |
|
80 | cd .. | |
81 |
|
81 | |||
82 | echo % convert again |
|
82 | echo % convert again | |
83 | hg convert --datesort $svnurl A-hg |
|
83 | hg convert --datesort $svnurl A-hg | |
84 |
|
84 | |||
85 | cd A-hg |
|
85 | cd A-hg | |
86 | hg glog --template '#rev# #desc|firstline# files: #files#\n' |
|
86 | hg glog --template '#rev# #desc|firstline# files: #files#\n' | |
87 | hg branches | sed 's/:.*/:/' |
|
87 | hg branches | sed 's/:.*/:/' | |
88 | hg tags -q |
|
88 | hg tags -q | |
89 | cd .. |
|
89 | cd .. |
@@ -1,65 +1,65 | |||||
1 | #!/bin/sh |
|
1 | #!/bin/sh | |
2 |
|
2 | |||
3 | "$TESTDIR/hghave" svn svn-bindings || exit 80 |
|
3 | "$TESTDIR/hghave" svn svn-bindings || exit 80 | |
4 |
|
4 | |||
5 | fix_path() |
|
5 | fix_path() | |
6 | { |
|
6 | { | |
7 | tr '\\' / |
|
7 | tr '\\' / | |
8 | } |
|
8 | } | |
9 |
|
9 | |||
10 | echo "[extensions]" >> $HGRCPATH |
|
10 | echo "[extensions]" >> $HGRCPATH | |
11 | echo "convert = " >> $HGRCPATH |
|
11 | echo "convert = " >> $HGRCPATH | |
12 | echo "hgext.graphlog =" >> $HGRCPATH |
|
12 | echo "hgext.graphlog =" >> $HGRCPATH | |
13 |
|
13 | |||
14 | svnadmin create svn-repo |
|
14 | svnadmin create svn-repo | |
15 |
|
15 | |||
16 | svnpath=`pwd | fix_path` |
|
16 | svnpath=`pwd | fix_path` | |
17 | # SVN wants all paths to start with a slash. Unfortunately, |
|
17 | # SVN wants all paths to start with a slash. Unfortunately, | |
18 | # Windows ones don't. Handle that. |
|
18 | # Windows ones don't. Handle that. | |
19 | expr $svnpath : "\/" > /dev/null |
|
19 | expr $svnpath : "\/" > /dev/null | |
20 | if [ $? -ne 0 ]; then |
|
20 | if [ $? -ne 0 ]; then | |
21 | svnpath='/'$svnpath |
|
21 | svnpath='/'$svnpath | |
22 | fi |
|
22 | fi | |
23 |
|
23 | |||
24 | echo % initial svn import |
|
24 | echo % initial svn import | |
25 | mkdir projA |
|
25 | mkdir projA | |
26 | cd projA |
|
26 | cd projA | |
27 | mkdir trunk |
|
27 | mkdir trunk | |
28 | echo a > trunk/a |
|
28 | echo a > trunk/a | |
29 | mkdir trunk/d1 |
|
29 | mkdir trunk/d1 | |
30 | echo b > trunk/d1/b |
|
30 | echo b > trunk/d1/b | |
31 | echo c > trunk/d1/c |
|
31 | echo c > trunk/d1/c | |
32 | cd .. |
|
32 | cd .. | |
33 |
|
33 | |||
34 | svnurl=file://$svnpath/svn-repo/projA |
|
34 | svnurl=file://$svnpath/svn-repo/projA | |
35 | svn import -m "init projA" projA $svnurl | fix_path |
|
35 | svn import -m "init projA" projA $svnurl | fix_path | |
36 |
|
36 | |||
37 | # Build a module renaming chain which used to confuse the converter. |
|
37 | # Build a module renaming chain which used to confuse the converter. | |
38 | echo % update svn repository |
|
38 | echo % update svn repository | |
39 | svn co $svnurl A | fix_path |
|
39 | svn co $svnurl A | fix_path | |
40 | cd A |
|
40 | cd A | |
41 | echo a >> trunk/a |
|
41 | "$TESTDIR/svn-safe-append.py" a trunk/a | |
42 | echo c >> trunk/d1/c |
|
42 | "$TESTDIR/svn-safe-append.py" c trunk/d1/c | |
43 | svn ci -m commitbeforemove |
|
43 | svn ci -m commitbeforemove | |
44 | svn mv $svnurl/trunk $svnurl/subproject -m movedtrunk |
|
44 | svn mv $svnurl/trunk $svnurl/subproject -m movedtrunk | |
45 | svn up |
|
45 | svn up | |
46 | mkdir subproject/trunk |
|
46 | mkdir subproject/trunk | |
47 | svn add subproject/trunk |
|
47 | svn add subproject/trunk | |
48 | svn ci -m createtrunk |
|
48 | svn ci -m createtrunk | |
49 | mkdir subproject/branches |
|
49 | mkdir subproject/branches | |
50 | svn add subproject/branches |
|
50 | svn add subproject/branches | |
51 | svn ci -m createbranches |
|
51 | svn ci -m createbranches | |
52 | svn mv $svnurl/subproject/d1 $svnurl/subproject/trunk/d1 -m moved1 |
|
52 | svn mv $svnurl/subproject/d1 $svnurl/subproject/trunk/d1 -m moved1 | |
53 | svn up |
|
53 | svn up | |
54 | echo b >> subproject/trunk/d1/b |
|
54 | "$TESTDIR/svn-safe-append.py" b subproject/trunk/d1/b | |
55 | svn ci -m changeb |
|
55 | svn ci -m changeb | |
56 | svn mv $svnurl/subproject/trunk/d1 $svnurl/subproject/branches/d1 -m moved1again |
|
56 | svn mv $svnurl/subproject/trunk/d1 $svnurl/subproject/branches/d1 -m moved1again | |
57 | cd .. |
|
57 | cd .. | |
58 |
|
58 | |||
59 | echo % convert trunk and branches |
|
59 | echo % convert trunk and branches | |
60 | hg convert --datesort $svnurl/subproject A-hg |
|
60 | hg convert --datesort $svnurl/subproject A-hg | |
61 |
|
61 | |||
62 | cd A-hg |
|
62 | cd A-hg | |
63 | hg glog --template '#rev# #desc|firstline# files: #files#\n' |
|
63 | hg glog --template '#rev# #desc|firstline# files: #files#\n' | |
64 | hg branches | sed 's/:.*/:/' |
|
64 | hg branches | sed 's/:.*/:/' | |
65 | cd .. |
|
65 | cd .. |
@@ -1,135 +1,135 | |||||
1 | #!/bin/sh |
|
1 | #!/bin/sh | |
2 |
|
2 | |||
3 | "$TESTDIR/hghave" svn svn-bindings || exit 80 |
|
3 | "$TESTDIR/hghave" svn svn-bindings || exit 80 | |
4 |
|
4 | |||
5 | fixpath() |
|
5 | fixpath() | |
6 | { |
|
6 | { | |
7 | tr '\\' / |
|
7 | tr '\\' / | |
8 | } |
|
8 | } | |
9 |
|
9 | |||
10 | svnupanddisplay() |
|
10 | svnupanddisplay() | |
11 | { |
|
11 | { | |
12 | ( |
|
12 | ( | |
13 | cd $1; |
|
13 | cd $1; | |
14 | svn up; |
|
14 | svn up; | |
15 | svn st -v | fixpath |
|
15 | svn st -v | fixpath | |
16 | limit='' |
|
16 | limit='' | |
17 | if [ $2 -gt 0 ]; then |
|
17 | if [ $2 -gt 0 ]; then | |
18 | limit="--limit=$2" |
|
18 | limit="--limit=$2" | |
19 | fi |
|
19 | fi | |
20 | svn log --xml -v $limit | fixpath | sed 's,<date>.*,<date/>,' |
|
20 | svn log --xml -v $limit | fixpath | sed 's,<date>.*,<date/>,' | |
21 | ) |
|
21 | ) | |
22 | } |
|
22 | } | |
23 |
|
23 | |||
24 | echo "[extensions]" >> $HGRCPATH |
|
24 | echo "[extensions]" >> $HGRCPATH | |
25 | echo "convert = " >> $HGRCPATH |
|
25 | echo "convert = " >> $HGRCPATH | |
26 |
|
26 | |||
27 | hg init a |
|
27 | hg init a | |
28 |
|
28 | |||
29 | echo a > a/a |
|
29 | echo a > a/a | |
30 | mkdir -p a/d1/d2 |
|
30 | mkdir -p a/d1/d2 | |
31 | echo b > a/d1/d2/b |
|
31 | echo b > a/d1/d2/b | |
32 | echo % add |
|
32 | echo % add | |
33 | hg --cwd a ci -d '0 0' -A -m 'add a file' |
|
33 | hg --cwd a ci -d '0 0' -A -m 'add a file' | |
34 |
|
34 | |||
35 | echo a >> a/a |
|
35 | "$TESTDIR/svn-safe-append.py" a a/a | |
36 | echo % modify |
|
36 | echo % modify | |
37 | hg --cwd a ci -d '1 0' -m 'modify a file' |
|
37 | hg --cwd a ci -d '1 0' -m 'modify a file' | |
38 | hg --cwd a tip -q |
|
38 | hg --cwd a tip -q | |
39 |
|
39 | |||
40 | hg convert -d svn a |
|
40 | hg convert -d svn a | |
41 | svnupanddisplay a-hg-wc 2 |
|
41 | svnupanddisplay a-hg-wc 2 | |
42 | ls a a-hg-wc |
|
42 | ls a a-hg-wc | |
43 | cmp a/a a-hg-wc/a && echo same || echo different |
|
43 | cmp a/a a-hg-wc/a && echo same || echo different | |
44 |
|
44 | |||
45 | hg --cwd a mv a b |
|
45 | hg --cwd a mv a b | |
46 | echo % rename |
|
46 | echo % rename | |
47 | hg --cwd a ci -d '2 0' -m 'rename a file' |
|
47 | hg --cwd a ci -d '2 0' -m 'rename a file' | |
48 | hg --cwd a tip -q |
|
48 | hg --cwd a tip -q | |
49 |
|
49 | |||
50 | hg convert -d svn a |
|
50 | hg convert -d svn a | |
51 | svnupanddisplay a-hg-wc 1 |
|
51 | svnupanddisplay a-hg-wc 1 | |
52 | ls a a-hg-wc |
|
52 | ls a a-hg-wc | |
53 |
|
53 | |||
54 | hg --cwd a cp b c |
|
54 | hg --cwd a cp b c | |
55 | echo % copy |
|
55 | echo % copy | |
56 | hg --cwd a ci -d '3 0' -m 'copy a file' |
|
56 | hg --cwd a ci -d '3 0' -m 'copy a file' | |
57 | hg --cwd a tip -q |
|
57 | hg --cwd a tip -q | |
58 |
|
58 | |||
59 | hg convert -d svn a |
|
59 | hg convert -d svn a | |
60 | svnupanddisplay a-hg-wc 1 |
|
60 | svnupanddisplay a-hg-wc 1 | |
61 | ls a a-hg-wc |
|
61 | ls a a-hg-wc | |
62 |
|
62 | |||
63 | hg --cwd a rm b |
|
63 | hg --cwd a rm b | |
64 | echo % remove |
|
64 | echo % remove | |
65 | hg --cwd a ci -d '4 0' -m 'remove a file' |
|
65 | hg --cwd a ci -d '4 0' -m 'remove a file' | |
66 | hg --cwd a tip -q |
|
66 | hg --cwd a tip -q | |
67 |
|
67 | |||
68 | hg convert -d svn a |
|
68 | hg convert -d svn a | |
69 | svnupanddisplay a-hg-wc 1 |
|
69 | svnupanddisplay a-hg-wc 1 | |
70 | ls a a-hg-wc |
|
70 | ls a a-hg-wc | |
71 |
|
71 | |||
72 | chmod +x a/c |
|
72 | chmod +x a/c | |
73 | echo % executable |
|
73 | echo % executable | |
74 | hg --cwd a ci -d '5 0' -m 'make a file executable' |
|
74 | hg --cwd a ci -d '5 0' -m 'make a file executable' | |
75 | hg --cwd a tip -q |
|
75 | hg --cwd a tip -q | |
76 |
|
76 | |||
77 | hg convert -d svn a |
|
77 | hg convert -d svn a | |
78 | svnupanddisplay a-hg-wc 1 |
|
78 | svnupanddisplay a-hg-wc 1 | |
79 | test -x a-hg-wc/c && echo executable || echo not executable |
|
79 | test -x a-hg-wc/c && echo executable || echo not executable | |
80 |
|
80 | |||
81 | echo % executable in new directory |
|
81 | echo % executable in new directory | |
82 |
|
82 | |||
83 | rm -rf a a-hg a-hg-wc |
|
83 | rm -rf a a-hg a-hg-wc | |
84 | hg init a |
|
84 | hg init a | |
85 |
|
85 | |||
86 | mkdir a/d1 |
|
86 | mkdir a/d1 | |
87 | echo a > a/d1/a |
|
87 | echo a > a/d1/a | |
88 | chmod +x a/d1/a |
|
88 | chmod +x a/d1/a | |
89 | hg --cwd a ci -d '0 0' -A -m 'add executable file in new directory' |
|
89 | hg --cwd a ci -d '0 0' -A -m 'add executable file in new directory' | |
90 |
|
90 | |||
91 | hg convert -d svn a |
|
91 | hg convert -d svn a | |
92 | svnupanddisplay a-hg-wc 1 |
|
92 | svnupanddisplay a-hg-wc 1 | |
93 | test -x a-hg-wc/d1/a && echo executable || echo not executable |
|
93 | test -x a-hg-wc/d1/a && echo executable || echo not executable | |
94 |
|
94 | |||
95 | echo % copy to new directory |
|
95 | echo % copy to new directory | |
96 |
|
96 | |||
97 | mkdir a/d2 |
|
97 | mkdir a/d2 | |
98 | hg --cwd a cp d1/a d2/a |
|
98 | hg --cwd a cp d1/a d2/a | |
99 | hg --cwd a ci -d '1 0' -A -m 'copy file to new directory' |
|
99 | hg --cwd a ci -d '1 0' -A -m 'copy file to new directory' | |
100 |
|
100 | |||
101 | hg convert -d svn a |
|
101 | hg convert -d svn a | |
102 | svnupanddisplay a-hg-wc 1 |
|
102 | svnupanddisplay a-hg-wc 1 | |
103 |
|
103 | |||
104 | echo % branchy history |
|
104 | echo % branchy history | |
105 |
|
105 | |||
106 | hg init b |
|
106 | hg init b | |
107 | echo base > b/b |
|
107 | echo base > b/b | |
108 | hg --cwd b ci -d '0 0' -Ambase |
|
108 | hg --cwd b ci -d '0 0' -Ambase | |
109 |
|
109 | |||
110 | echo left-1 >> b/b |
|
110 | "$TESTDIR/svn-safe-append.py" left-1 b/b | |
111 | echo left-1 > b/left-1 |
|
111 | echo left-1 > b/left-1 | |
112 | hg --cwd b ci -d '1 0' -Amleft-1 |
|
112 | hg --cwd b ci -d '1 0' -Amleft-1 | |
113 |
|
113 | |||
114 | echo left-2 >> b/b |
|
114 | "$TESTDIR/svn-safe-append.py" left-2 b/b | |
115 | echo left-2 > b/left-2 |
|
115 | echo left-2 > b/left-2 | |
116 | hg --cwd b ci -d '2 0' -Amleft-2 |
|
116 | hg --cwd b ci -d '2 0' -Amleft-2 | |
117 |
|
117 | |||
118 | hg --cwd b up 0 |
|
118 | hg --cwd b up 0 | |
119 |
|
119 | |||
120 | echo right-1 >> b/b |
|
120 | "$TESTDIR/svn-safe-append.py" right-1 b/b | |
121 | echo right-1 > b/right-1 |
|
121 | echo right-1 > b/right-1 | |
122 | hg --cwd b ci -d '3 0' -Amright-1 |
|
122 | hg --cwd b ci -d '3 0' -Amright-1 | |
123 |
|
123 | |||
124 | echo right-2 >> b/b |
|
124 | "$TESTDIR/svn-safe-append.py" right-2 b/b | |
125 | echo right-2 > b/right-2 |
|
125 | echo right-2 > b/right-2 | |
126 | hg --cwd b ci -d '4 0' -Amright-2 |
|
126 | hg --cwd b ci -d '4 0' -Amright-2 | |
127 |
|
127 | |||
128 | hg --cwd b up -C 2 |
|
128 | hg --cwd b up -C 2 | |
129 | hg --cwd b merge |
|
129 | hg --cwd b merge | |
130 | hg --cwd b revert -r 2 b |
|
130 | hg --cwd b revert -r 2 b | |
131 | hg --cwd b ci -d '5 0' -m 'merge' |
|
131 | hg --cwd b ci -d '5 0' -m 'merge' | |
132 |
|
132 | |||
133 | hg convert -d svn b |
|
133 | hg convert -d svn b | |
134 | echo % expect 4 changes |
|
134 | echo % expect 4 changes | |
135 | svnupanddisplay b-hg-wc 0 |
|
135 | svnupanddisplay b-hg-wc 0 |
@@ -1,89 +1,89 | |||||
1 | #!/bin/sh |
|
1 | #!/bin/sh | |
2 |
|
2 | |||
3 | "$TESTDIR/hghave" svn svn-bindings || exit 80 |
|
3 | "$TESTDIR/hghave" svn svn-bindings || exit 80 | |
4 |
|
4 | |||
5 | fix_path() |
|
5 | fix_path() | |
6 | { |
|
6 | { | |
7 | tr '\\' / |
|
7 | tr '\\' / | |
8 | } |
|
8 | } | |
9 |
|
9 | |||
10 | echo "[extensions]" >> $HGRCPATH |
|
10 | echo "[extensions]" >> $HGRCPATH | |
11 | echo "convert = " >> $HGRCPATH |
|
11 | echo "convert = " >> $HGRCPATH | |
12 | echo 'hgext.graphlog =' >> $HGRCPATH |
|
12 | echo 'hgext.graphlog =' >> $HGRCPATH | |
13 |
|
13 | |||
14 | svnadmin create svn-repo |
|
14 | svnadmin create svn-repo | |
15 |
|
15 | |||
16 | svnpath=`pwd | fix_path` |
|
16 | svnpath=`pwd | fix_path` | |
17 | # SVN wants all paths to start with a slash. Unfortunately, |
|
17 | # SVN wants all paths to start with a slash. Unfortunately, | |
18 | # Windows ones don't. Handle that. |
|
18 | # Windows ones don't. Handle that. | |
19 | expr $svnpath : "\/" > /dev/null |
|
19 | expr $svnpath : "\/" > /dev/null | |
20 | if [ $? -ne 0 ]; then |
|
20 | if [ $? -ne 0 ]; then | |
21 | svnpath='/'$svnpath |
|
21 | svnpath='/'$svnpath | |
22 | fi |
|
22 | fi | |
23 |
|
23 | |||
24 | echo "# now tests that it works with trunk/tags layout, but no branches yet" |
|
24 | echo "# now tests that it works with trunk/tags layout, but no branches yet" | |
25 | echo |
|
25 | echo | |
26 | echo % initial svn import |
|
26 | echo % initial svn import | |
27 | mkdir projB |
|
27 | mkdir projB | |
28 | cd projB |
|
28 | cd projB | |
29 | mkdir trunk |
|
29 | mkdir trunk | |
30 | mkdir tags |
|
30 | mkdir tags | |
31 | cd .. |
|
31 | cd .. | |
32 |
|
32 | |||
33 | svnurl=file://$svnpath/svn-repo/projB |
|
33 | svnurl=file://$svnpath/svn-repo/projB | |
34 | svn import -m "init projB" projB $svnurl | fix_path |
|
34 | svn import -m "init projB" projB $svnurl | fix_path | |
35 |
|
35 | |||
36 |
|
36 | |||
37 | echo % update svn repository |
|
37 | echo % update svn repository | |
38 | svn co $svnurl/trunk B | fix_path |
|
38 | svn co $svnurl/trunk B | fix_path | |
39 | cd B |
|
39 | cd B | |
40 | echo hello > letter.txt |
|
40 | echo hello > letter.txt | |
41 | svn add letter.txt |
|
41 | svn add letter.txt | |
42 | svn ci -m hello |
|
42 | svn ci -m hello | |
43 |
|
43 | |||
44 | echo world >> letter.txt |
|
44 | "$TESTDIR/svn-safe-append.py" world letter.txt | |
45 | svn ci -m world |
|
45 | svn ci -m world | |
46 |
|
46 | |||
47 | svn copy -m "tag v0.1" $svnurl/trunk $svnurl/tags/v0.1 |
|
47 | svn copy -m "tag v0.1" $svnurl/trunk $svnurl/tags/v0.1 | |
48 |
|
48 | |||
49 |
|
|
49 | "$TESTDIR/svn-safe-append.py" 'nice day today!' letter.txt | |
50 | svn ci -m "nice day" |
|
50 | svn ci -m "nice day" | |
51 | cd .. |
|
51 | cd .. | |
52 |
|
52 | |||
53 | echo % convert to hg once |
|
53 | echo % convert to hg once | |
54 | hg convert $svnurl B-hg |
|
54 | hg convert $svnurl B-hg | |
55 |
|
55 | |||
56 | echo % update svn repository again |
|
56 | echo % update svn repository again | |
57 | cd B |
|
57 | cd B | |
58 |
|
|
58 | "$TESTDIR/svn-safe-append.py" "see second letter" letter.txt | |
59 | echo "nice to meet you" > letter2.txt |
|
59 | echo "nice to meet you" > letter2.txt | |
60 | svn add letter2.txt |
|
60 | svn add letter2.txt | |
61 | svn ci -m "second letter" |
|
61 | svn ci -m "second letter" | |
62 |
|
62 | |||
63 | svn copy -m "tag v0.2" $svnurl/trunk $svnurl/tags/v0.2 |
|
63 | svn copy -m "tag v0.2" $svnurl/trunk $svnurl/tags/v0.2 | |
64 |
|
64 | |||
65 |
|
|
65 | "$TESTDIR/svn-safe-append.py" "blah-blah-blah" letter2.txt | |
66 | svn ci -m "work in progress" |
|
66 | svn ci -m "work in progress" | |
67 | cd .. |
|
67 | cd .. | |
68 |
|
68 | |||
69 | ######################################## |
|
69 | ######################################## | |
70 |
|
70 | |||
71 | echo % test incremental conversion |
|
71 | echo % test incremental conversion | |
72 | hg convert $svnurl B-hg |
|
72 | hg convert $svnurl B-hg | |
73 |
|
73 | |||
74 | cd B-hg |
|
74 | cd B-hg | |
75 | hg glog --template '#rev# #desc|firstline# files: #files#\n' |
|
75 | hg glog --template '#rev# #desc|firstline# files: #files#\n' | |
76 | hg tags -q |
|
76 | hg tags -q | |
77 | cd .. |
|
77 | cd .. | |
78 |
|
78 | |||
79 | echo % test filemap |
|
79 | echo % test filemap | |
80 | echo 'include letter2.txt' > filemap |
|
80 | echo 'include letter2.txt' > filemap | |
81 | hg convert --filemap filemap $svnurl/trunk fmap |
|
81 | hg convert --filemap filemap $svnurl/trunk fmap | |
82 | hg glog -R fmap --template '#rev# #desc|firstline# files: #files#\n' |
|
82 | hg glog -R fmap --template '#rev# #desc|firstline# files: #files#\n' | |
83 |
|
83 | |||
84 | echo % test stop revision |
|
84 | echo % test stop revision | |
85 | hg convert --rev 1 $svnurl/trunk stoprev |
|
85 | hg convert --rev 1 $svnurl/trunk stoprev | |
86 | # Check convert_revision extra-records. |
|
86 | # Check convert_revision extra-records. | |
87 | # This is also the only place testing more than one extra field |
|
87 | # This is also the only place testing more than one extra field | |
88 | # in a revision. |
|
88 | # in a revision. | |
89 | hg --cwd stoprev tip --debug | grep extra | sed 's/=.*/=/' |
|
89 | hg --cwd stoprev tip --debug | grep extra | sed 's/=.*/=/' |
@@ -1,81 +1,81 | |||||
1 | #!/bin/sh |
|
1 | #!/bin/sh | |
2 |
|
2 | |||
3 | "$TESTDIR/hghave" svn svn-bindings || exit 80 |
|
3 | "$TESTDIR/hghave" svn svn-bindings || exit 80 | |
4 |
|
4 | |||
5 | fix_path() |
|
5 | fix_path() | |
6 | { |
|
6 | { | |
7 | tr '\\' / |
|
7 | tr '\\' / | |
8 | } |
|
8 | } | |
9 |
|
9 | |||
10 | echo "[extensions]" >> $HGRCPATH |
|
10 | echo "[extensions]" >> $HGRCPATH | |
11 | echo "convert = " >> $HGRCPATH |
|
11 | echo "convert = " >> $HGRCPATH | |
12 | echo "hgext.graphlog =" >> $HGRCPATH |
|
12 | echo "hgext.graphlog =" >> $HGRCPATH | |
13 |
|
13 | |||
14 | svnadmin create svn-repo |
|
14 | svnadmin create svn-repo | |
15 |
|
15 | |||
16 | svnpath=`pwd | fix_path` |
|
16 | svnpath=`pwd | fix_path` | |
17 | # SVN wants all paths to start with a slash. Unfortunately, |
|
17 | # SVN wants all paths to start with a slash. Unfortunately, | |
18 | # Windows ones don't. Handle that. |
|
18 | # Windows ones don't. Handle that. | |
19 | expr $svnpath : "\/" > /dev/null |
|
19 | expr $svnpath : "\/" > /dev/null | |
20 | if [ $? -ne 0 ]; then |
|
20 | if [ $? -ne 0 ]; then | |
21 | svnpath='/'$svnpath |
|
21 | svnpath='/'$svnpath | |
22 | fi |
|
22 | fi | |
23 |
|
23 | |||
24 | echo % initial svn import |
|
24 | echo % initial svn import | |
25 | mkdir projA |
|
25 | mkdir projA | |
26 | cd projA |
|
26 | cd projA | |
27 | mkdir trunk |
|
27 | mkdir trunk | |
28 | mkdir branches |
|
28 | mkdir branches | |
29 | mkdir tags |
|
29 | mkdir tags | |
30 | cd .. |
|
30 | cd .. | |
31 |
|
31 | |||
32 | svnurl=file://$svnpath/svn-repo/projA |
|
32 | svnurl=file://$svnpath/svn-repo/projA | |
33 | svn import -m "init projA" projA $svnurl | fix_path |
|
33 | svn import -m "init projA" projA $svnurl | fix_path | |
34 |
|
34 | |||
35 | echo % update svn repository |
|
35 | echo % update svn repository | |
36 | svn co $svnurl A | fix_path |
|
36 | svn co $svnurl A | fix_path | |
37 | cd A |
|
37 | cd A | |
38 | echo a > trunk/a |
|
38 | echo a > trunk/a | |
39 | echo b > trunk/b |
|
39 | echo b > trunk/b | |
40 | svn add trunk/a trunk/b |
|
40 | svn add trunk/a trunk/b | |
41 | svn ci -m createab |
|
41 | svn ci -m createab | |
42 | svn rm trunk/b |
|
42 | svn rm trunk/b | |
43 | svn ci -m removeb |
|
43 | svn ci -m removeb | |
44 | svn up |
|
44 | svn up | |
45 | echo a >> trunk/a |
|
45 | "$TESTDIR/svn-safe-append.py" a trunk/a | |
46 | svn ci -m changeaa |
|
46 | svn ci -m changeaa | |
47 |
|
47 | |||
48 | echo % branch |
|
48 | echo % branch | |
49 | svn up |
|
49 | svn up | |
50 | svn copy trunk branches/branch1 |
|
50 | svn copy trunk branches/branch1 | |
51 | echo a >> branches/branch1/a |
|
51 | "$TESTDIR/svn-safe-append.py" a branches/branch1/a | |
52 | svn ci -m "branch, changeaaa" |
|
52 | svn ci -m "branch, changeaaa" | |
53 |
|
53 | |||
54 | echo a >> branches/branch1/a |
|
54 | "$TESTDIR/svn-safe-append.py" a branches/branch1/a | |
55 | echo c > branches/branch1/c |
|
55 | echo c > branches/branch1/c | |
56 | svn add branches/branch1/c |
|
56 | svn add branches/branch1/c | |
57 | svn ci -m "addc,changeaaaa" |
|
57 | svn ci -m "addc,changeaaaa" | |
58 | svn up |
|
58 | svn up | |
59 | cd .. |
|
59 | cd .. | |
60 |
|
60 | |||
61 | convert() |
|
61 | convert() | |
62 | { |
|
62 | { | |
63 | startrev=$1 |
|
63 | startrev=$1 | |
64 | repopath=A-r$startrev-hg |
|
64 | repopath=A-r$startrev-hg | |
65 | hg convert --config convert.svn.startrev=$startrev \ |
|
65 | hg convert --config convert.svn.startrev=$startrev \ | |
66 | --config convert.svn.trunk=branches/branch1 \ |
|
66 | --config convert.svn.trunk=branches/branch1 \ | |
67 | --config convert.svn.branches=" " \ |
|
67 | --config convert.svn.branches=" " \ | |
68 | --config convert.svn.tags= \ |
|
68 | --config convert.svn.tags= \ | |
69 | --datesort $svnurl $repopath |
|
69 | --datesort $svnurl $repopath | |
70 | hg -R $repopath glog --template '#rev# #desc|firstline# files: #files#\n' |
|
70 | hg -R $repopath glog --template '#rev# #desc|firstline# files: #files#\n' | |
71 | echo |
|
71 | echo | |
72 | } |
|
72 | } | |
73 |
|
73 | |||
74 | echo % convert before branching point |
|
74 | echo % convert before branching point | |
75 | convert 3 |
|
75 | convert 3 | |
76 | echo % convert before branching point |
|
76 | echo % convert before branching point | |
77 | convert 4 |
|
77 | convert 4 | |
78 | echo % convert at branching point |
|
78 | echo % convert at branching point | |
79 | convert 5 |
|
79 | convert 5 | |
80 | echo % convert last revision only |
|
80 | echo % convert last revision only | |
81 | convert 6 |
|
81 | convert 6 |
@@ -1,76 +1,76 | |||||
1 | #!/bin/sh |
|
1 | #!/bin/sh | |
2 |
|
2 | |||
3 | "$TESTDIR/hghave" svn svn-bindings || exit 80 |
|
3 | "$TESTDIR/hghave" svn svn-bindings || exit 80 | |
4 |
|
4 | |||
5 | fix_path() |
|
5 | fix_path() | |
6 | { |
|
6 | { | |
7 | tr '\\' / |
|
7 | tr '\\' / | |
8 | } |
|
8 | } | |
9 |
|
9 | |||
10 | echo "[extensions]" >> $HGRCPATH |
|
10 | echo "[extensions]" >> $HGRCPATH | |
11 | echo "convert = " >> $HGRCPATH |
|
11 | echo "convert = " >> $HGRCPATH | |
12 | echo "hgext.graphlog =" >> $HGRCPATH |
|
12 | echo "hgext.graphlog =" >> $HGRCPATH | |
13 |
|
13 | |||
14 | svnadmin create svn-repo |
|
14 | svnadmin create svn-repo | |
15 |
|
15 | |||
16 | svnpath=`pwd | fix_path` |
|
16 | svnpath=`pwd | fix_path` | |
17 | # SVN wants all paths to start with a slash. Unfortunately, |
|
17 | # SVN wants all paths to start with a slash. Unfortunately, | |
18 | # Windows ones don't. Handle that. |
|
18 | # Windows ones don't. Handle that. | |
19 | expr $svnpath : "\/" > /dev/null |
|
19 | expr $svnpath : "\/" > /dev/null | |
20 | if [ $? -ne 0 ]; then |
|
20 | if [ $? -ne 0 ]; then | |
21 | svnpath='/'$svnpath |
|
21 | svnpath='/'$svnpath | |
22 | fi |
|
22 | fi | |
23 |
|
23 | |||
24 | echo % initial svn import |
|
24 | echo % initial svn import | |
25 | mkdir projA |
|
25 | mkdir projA | |
26 | cd projA |
|
26 | cd projA | |
27 | mkdir trunk |
|
27 | mkdir trunk | |
28 | mkdir branches |
|
28 | mkdir branches | |
29 | mkdir tags |
|
29 | mkdir tags | |
30 | mkdir unrelated |
|
30 | mkdir unrelated | |
31 | cd .. |
|
31 | cd .. | |
32 |
|
32 | |||
33 | svnurl=file://$svnpath/svn-repo/projA |
|
33 | svnurl=file://$svnpath/svn-repo/projA | |
34 | svn import -m "init projA" projA $svnurl | fix_path |
|
34 | svn import -m "init projA" projA $svnurl | fix_path | |
35 |
|
35 | |||
36 | echo % update svn repository |
|
36 | echo % update svn repository | |
37 | svn co $svnurl A | fix_path |
|
37 | svn co $svnurl A | fix_path | |
38 | cd A |
|
38 | cd A | |
39 | echo a > trunk/a |
|
39 | echo a > trunk/a | |
40 | svn add trunk/a |
|
40 | svn add trunk/a | |
41 | svn ci -m adda |
|
41 | svn ci -m adda | |
42 | echo a >> trunk/a |
|
42 | "$TESTDIR/svn-safe-append.py" a trunk/a | |
43 | svn ci -m changea |
|
43 | svn ci -m changea | |
44 | echo a >> trunk/a |
|
44 | "$TESTDIR/svn-safe-append.py" a trunk/a | |
45 | svn ci -m changea2 |
|
45 | svn ci -m changea2 | |
46 | # Add an unrelated commit to test that tags are bound to the |
|
46 | # Add an unrelated commit to test that tags are bound to the | |
47 | # correct "from" revision and not a dummy one |
|
47 | # correct "from" revision and not a dummy one | |
48 | echo a >> unrelated/dummy |
|
48 | "$TESTDIR/svn-safe-append.py" a unrelated/dummy | |
49 | svn add unrelated/dummy |
|
49 | svn add unrelated/dummy | |
50 | svn ci -m unrelatedchange |
|
50 | svn ci -m unrelatedchange | |
51 | echo % tag current revision |
|
51 | echo % tag current revision | |
52 | svn up |
|
52 | svn up | |
53 | svn copy trunk tags/trunk.v1 |
|
53 | svn copy trunk tags/trunk.v1 | |
54 | svn copy trunk tags/trunk.badtag |
|
54 | svn copy trunk tags/trunk.badtag | |
55 | svn ci -m "tagging trunk.v1 trunk.badtag" |
|
55 | svn ci -m "tagging trunk.v1 trunk.badtag" | |
56 | echo a >> trunk/a |
|
56 | "$TESTDIR/svn-safe-append.py" a trunk/a | |
57 | svn ci -m changea3 |
|
57 | svn ci -m changea3 | |
58 | echo % fix the bad tag |
|
58 | echo % fix the bad tag | |
59 | # trunk.badtag should not show in converted tags |
|
59 | # trunk.badtag should not show in converted tags | |
60 | svn up |
|
60 | svn up | |
61 | svn mv tags/trunk.badtag tags/trunk.goodtag |
|
61 | svn mv tags/trunk.badtag tags/trunk.goodtag | |
62 | svn ci -m "fix trunk.badtag" |
|
62 | svn ci -m "fix trunk.badtag" | |
63 | cd .. |
|
63 | cd .. | |
64 |
|
64 | |||
65 | echo % convert |
|
65 | echo % convert | |
66 | hg convert --datesort $svnurl A-hg |
|
66 | hg convert --datesort $svnurl A-hg | |
67 |
|
67 | |||
68 | cd A-hg |
|
68 | cd A-hg | |
69 | hg glog --template '#rev# #desc|firstline# tags: #tags#\n' |
|
69 | hg glog --template '#rev# #desc|firstline# tags: #tags#\n' | |
70 | hg tags -q |
|
70 | hg tags -q | |
71 | cd .. |
|
71 | cd .. | |
72 |
|
72 | |||
73 | echo % convert without tags |
|
73 | echo % convert without tags | |
74 | hg convert --datesort --config convert.svn.tags= $svnurl A-notags-hg |
|
74 | hg convert --datesort --config convert.svn.tags= $svnurl A-notags-hg | |
75 | hg -R A-notags-hg tags -q |
|
75 | hg -R A-notags-hg tags -q | |
76 |
|
76 |
General Comments 0
You need to be logged in to leave comments.
Login now