Mercurial > hg
annotate tests/test-convert-svn-startrev @ 6422:3ee6f1fce94a
copies: fix silly precedence bug
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sat, 29 Mar 2008 12:39:47 -0500 |
parents | 963000ed8cac |
children | c1b47c0fd2b6 |
rev | line source |
---|---|
6173
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
1 #!/bin/sh |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
2 |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
3 "$TESTDIR/hghave" svn svn-bindings || exit 80 |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
4 |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
5 fix_path() |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
6 { |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
7 tr '\\' / |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
8 } |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
9 |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
10 echo "[extensions]" >> $HGRCPATH |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
11 echo "convert = " >> $HGRCPATH |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
12 echo "hgext.graphlog =" >> $HGRCPATH |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
13 |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
14 svnadmin create svn-repo |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
15 |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
16 svnpath=`pwd | fix_path` |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
17 # SVN wants all paths to start with a slash. Unfortunately, |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
18 # Windows ones don't. Handle that. |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
19 expr $svnpath : "\/" > /dev/null |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
20 if [ $? -ne 0 ]; then |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
21 svnpath='/'$svnpath |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
22 fi |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
23 |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
24 echo % initial svn import |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
25 mkdir projA |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
26 cd projA |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
27 mkdir trunk |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
28 mkdir branches |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
29 mkdir tags |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
30 cd .. |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
31 |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
32 svnurl=file://$svnpath/svn-repo/projA |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
33 svn import -m "init projA" projA $svnurl | fix_path |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
34 |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
35 echo % update svn repository |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
36 svn co $svnurl A | fix_path |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
37 cd A |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
38 echo a > trunk/a |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
39 echo b > trunk/b |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
40 svn add trunk/a trunk/b |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
41 svn ci -m createab |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
42 svn rm trunk/b |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
43 svn ci -m removeb |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
44 svn up |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
45 echo a >> trunk/a |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
46 svn ci -m changeaa |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
47 |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
48 echo % branch |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
49 svn up |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
50 svn copy trunk branches/branch1 |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
51 echo a >> branches/branch1/a |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
52 svn ci -m "branch, changeaaa" |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
53 |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
54 echo a >> branches/branch1/a |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
55 echo c > branches/branch1/c |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
56 svn add branches/branch1/c |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
57 svn ci -m "addc,changeaaaa" |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
58 svn up |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
59 cd .. |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
60 |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
61 convert() |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
62 { |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
63 startrev=$1 |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
64 repopath=A-r$startrev-hg |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
65 hg convert --config convert.svn.startrev=$startrev \ |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
66 --config convert.svn.trunk=branches/branch1 \ |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
67 --config convert.svn.branches=" " \ |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
68 --config convert.svn.tags= \ |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
69 --datesort $svnurl $repopath |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
70 hg -R $repopath glog --template '#rev# #desc|firstline# files: #files#\n' |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
71 echo |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
72 } |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
73 |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
74 echo % convert before branching point |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
75 convert 3 |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
76 echo % convert before branching point |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
77 convert 4 |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
78 echo % convert at branching point |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
79 convert 5 |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
80 echo % convert last revision only |
963000ed8cac
convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
81 convert 6 |