Mercurial > hg
annotate tests/test-convert-hg-svn.t @ 16502:8298d220cbf9 stable
doc: add description about re-opening closed heads to 'Head, closed branch' in glossary
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Mon, 23 Apr 2012 00:33:09 +0900 |
parents | 9a0528fd9172 |
children | 0413f68da85c |
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 |
12527
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
2 $ "$TESTDIR/hghave" svn svn-bindings || exit 80 |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
3 $ fix_path() |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
4 > { |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
5 > tr '\\' / |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
6 > } |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
7 $ echo "[extensions]" >> $HGRCPATH |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
8 $ echo "convert = " >> $HGRCPATH |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
9 $ echo "mq = " >> $HGRCPATH |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
10 $ svnpath=`pwd | fix_path`/svn-repo |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
11 $ svnadmin create "$svnpath" |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
12 $ cat > "$svnpath"/hooks/pre-revprop-change <<EOF |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
13 > #!/bin/sh |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
14 > |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
15 > REPOS="$1" |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
16 > REV="$2" |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
17 > USER="$3" |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
18 > PROPNAME="$4" |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
19 > ACTION="$5" |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
20 > |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
21 > if [ "$ACTION" = "M" -a "$PROPNAME" = "svn:log" ]; then exit 0; fi |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
22 > if [ "$ACTION" = "A" -a "$PROPNAME" = "hg:convert-branch" ]; then exit 0; fi |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
23 > if [ "$ACTION" = "A" -a "$PROPNAME" = "hg:convert-rev" ]; then exit 0; fi |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
24 > |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
25 > echo "Changing prohibited revision property" >&2 |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
26 > exit 1 |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
27 > EOF |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
28 $ chmod +x "$svnpath"/hooks/pre-revprop-change |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
29 $ |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
30 $ # SVN wants all paths to start with a slash. Unfortunately, |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
31 $ # Windows ones don't. Handle that. |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
32 $ svnurl="$svnpath" |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
33 $ expr "$svnurl" : "\/" > /dev/null || svnurl="/$svnurl" |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
34 $ svnurl="file://$svnurl" |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
35 $ svn co "$svnurl" "$svnpath"-wc |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
36 Checked out revision 0. |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
37 $ cd "$svnpath"-wc |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
38 $ echo a > a |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
39 $ svn add a |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
40 A a |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
41 $ svn ci -m'added a' a |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
42 Adding a |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
43 Transmitting file data . |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
44 Committed revision 1. |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
45 $ cd .. |
5554
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
46 |
12527
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
47 initial roundtrip |
5554
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
48 |
12527
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
49 $ hg convert -s svn -d hg "$svnpath"-wc "$svnpath"-hg | grep -v initializing |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
50 scanning source... |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
51 sorting... |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
52 converting... |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
53 0 added a |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
54 $ hg convert -s hg -d svn "$svnpath"-hg "$svnpath"-wc |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
55 scanning source... |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
56 sorting... |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
57 converting... |
5554
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
58 |
12527
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
59 second roundtrip should do nothing |
5554
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
60 |
12527
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
61 $ hg convert -s svn -d hg "$svnpath"-wc "$svnpath"-hg |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
62 scanning source... |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
63 sorting... |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
64 converting... |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
65 $ hg convert -s hg -d svn "$svnpath"-hg "$svnpath"-wc |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
66 scanning source... |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
67 sorting... |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
68 converting... |
5554
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
69 |
12527
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
70 new hg rev |
5554
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
71 |
12527
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
72 $ hg clone "$svnpath"-hg "$svnpath"-work |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
73 updating to branch default |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
74 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
75 $ cd "$svnpath"-work |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
76 $ echo b > b |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
77 $ hg add b |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
78 $ hg ci -mb |
5554
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
79 |
12527
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
80 adding an empty revision |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
81 |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
82 $ hg qnew -m emtpy empty |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
83 $ hg qfinish -a |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
84 $ cd .. |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
85 |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
86 echo hg to svn |
5554
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
87 |
12527
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
88 $ hg --cwd "$svnpath"-hg pull -q "$svnpath"-work |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
89 $ hg convert -s hg -d svn "$svnpath"-hg "$svnpath"-wc |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
90 scanning source... |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
91 sorting... |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
92 converting... |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
93 1 b |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
94 0 emtpy |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
95 |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
96 svn back to hg should do nothing |
5554
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
97 |
12527
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
98 $ hg convert -s svn -d hg "$svnpath"-wc "$svnpath"-hg |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
99 scanning source... |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
100 sorting... |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
101 converting... |
5554
2147a734dcf9
convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
102 |
12527
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
103 hg back to svn should do nothing |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
104 |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
105 $ hg convert -s hg -d svn "$svnpath"-hg "$svnpath"-wc |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
106 scanning source... |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
107 sorting... |
9a0528fd9172
tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
108 converting... |