author | Mads Kiilerich <mads@kiilerich.com> |
Tue, 21 Aug 2012 02:41:20 +0200 | |
changeset 17426 | 9724f8f8850b |
parent 17347 | 2da47de36b6f |
child 17773 | 434e5bd615fc |
permissions | -rw-r--r-- |
9716
ea8c207a0f78
update: add comments and test cases for updating across branches
Stuart W Marks <smarks@smarks.org>
parents:
diff
changeset
|
1 |
# Construct the following history tree: |
ea8c207a0f78
update: add comments and test cases for updating across branches
Stuart W Marks <smarks@smarks.org>
parents:
diff
changeset
|
2 |
# |
ea8c207a0f78
update: add comments and test cases for updating across branches
Stuart W Marks <smarks@smarks.org>
parents:
diff
changeset
|
3 |
# @ 5:e1bb631146ca b1 |
ea8c207a0f78
update: add comments and test cases for updating across branches
Stuart W Marks <smarks@smarks.org>
parents:
diff
changeset
|
4 |
# | |
ea8c207a0f78
update: add comments and test cases for updating across branches
Stuart W Marks <smarks@smarks.org>
parents:
diff
changeset
|
5 |
# o 4:a4fdb3b883c4 0:b608b9236435 b1 |
ea8c207a0f78
update: add comments and test cases for updating across branches
Stuart W Marks <smarks@smarks.org>
parents:
diff
changeset
|
6 |
# | |
ea8c207a0f78
update: add comments and test cases for updating across branches
Stuart W Marks <smarks@smarks.org>
parents:
diff
changeset
|
7 |
# | o 3:4b57d2520816 1:44592833ba9f |
ea8c207a0f78
update: add comments and test cases for updating across branches
Stuart W Marks <smarks@smarks.org>
parents:
diff
changeset
|
8 |
# | | |
ea8c207a0f78
update: add comments and test cases for updating across branches
Stuart W Marks <smarks@smarks.org>
parents:
diff
changeset
|
9 |
# | | o 2:063f31070f65 |
ea8c207a0f78
update: add comments and test cases for updating across branches
Stuart W Marks <smarks@smarks.org>
parents:
diff
changeset
|
10 |
# | |/ |
ea8c207a0f78
update: add comments and test cases for updating across branches
Stuart W Marks <smarks@smarks.org>
parents:
diff
changeset
|
11 |
# | o 1:44592833ba9f |
ea8c207a0f78
update: add comments and test cases for updating across branches
Stuart W Marks <smarks@smarks.org>
parents:
diff
changeset
|
12 |
# |/ |
ea8c207a0f78
update: add comments and test cases for updating across branches
Stuart W Marks <smarks@smarks.org>
parents:
diff
changeset
|
13 |
# o 0:b608b9236435 |
ea8c207a0f78
update: add comments and test cases for updating across branches
Stuart W Marks <smarks@smarks.org>
parents:
diff
changeset
|
14 |
|
12279 | 15 |
$ hg init |
16 |
$ echo foo > foo |
|
17 |
$ echo zero > a |
|
16491
bfe89d65d651
update: make --check abort with dirty subrepos
Patrick Mezard <patrick@mezard.eu>
parents:
14485
diff
changeset
|
18 |
$ hg init sub |
bfe89d65d651
update: make --check abort with dirty subrepos
Patrick Mezard <patrick@mezard.eu>
parents:
14485
diff
changeset
|
19 |
$ echo suba > sub/suba |
bfe89d65d651
update: make --check abort with dirty subrepos
Patrick Mezard <patrick@mezard.eu>
parents:
14485
diff
changeset
|
20 |
$ hg --cwd sub ci -Am addsuba |
bfe89d65d651
update: make --check abort with dirty subrepos
Patrick Mezard <patrick@mezard.eu>
parents:
14485
diff
changeset
|
21 |
adding suba |
bfe89d65d651
update: make --check abort with dirty subrepos
Patrick Mezard <patrick@mezard.eu>
parents:
14485
diff
changeset
|
22 |
$ echo 'sub = sub' > .hgsub |
12279 | 23 |
$ hg ci -qAm0 |
24 |
$ echo one > a ; hg ci -m1 |
|
25 |
$ echo two > a ; hg ci -m2 |
|
26 |
$ hg up -q 1 |
|
27 |
$ echo three > a ; hg ci -qm3 |
|
28 |
$ hg up -q 0 |
|
29 |
$ hg branch -q b1 |
|
30 |
$ echo four > a ; hg ci -qm4 |
|
31 |
$ echo five > a ; hg ci -qm5 |
|
9716
ea8c207a0f78
update: add comments and test cases for updating across branches
Stuart W Marks <smarks@smarks.org>
parents:
diff
changeset
|
32 |
|
12279 | 33 |
Initial repo state: |
9716
ea8c207a0f78
update: add comments and test cases for updating across branches
Stuart W Marks <smarks@smarks.org>
parents:
diff
changeset
|
34 |
|
12279 | 35 |
$ hg --config 'extensions.graphlog=' \ |
36 |
> glog --template '{rev}:{node|short} {parents} {branches}\n' |
|
16491
bfe89d65d651
update: make --check abort with dirty subrepos
Patrick Mezard <patrick@mezard.eu>
parents:
14485
diff
changeset
|
37 |
@ 5:ff252e8273df b1 |
12279 | 38 |
| |
16491
bfe89d65d651
update: make --check abort with dirty subrepos
Patrick Mezard <patrick@mezard.eu>
parents:
14485
diff
changeset
|
39 |
o 4:d047485b3896 0:60829823a42a b1 |
12279 | 40 |
| |
16491
bfe89d65d651
update: make --check abort with dirty subrepos
Patrick Mezard <patrick@mezard.eu>
parents:
14485
diff
changeset
|
41 |
| o 3:6efa171f091b 1:0786582aa4b1 |
12279 | 42 |
| | |
16491
bfe89d65d651
update: make --check abort with dirty subrepos
Patrick Mezard <patrick@mezard.eu>
parents:
14485
diff
changeset
|
43 |
| | o 2:bd10386d478c |
12279 | 44 |
| |/ |
16491
bfe89d65d651
update: make --check abort with dirty subrepos
Patrick Mezard <patrick@mezard.eu>
parents:
14485
diff
changeset
|
45 |
| o 1:0786582aa4b1 |
12279 | 46 |
|/ |
16491
bfe89d65d651
update: make --check abort with dirty subrepos
Patrick Mezard <patrick@mezard.eu>
parents:
14485
diff
changeset
|
47 |
o 0:60829823a42a |
12279 | 48 |
|
49 |
||
50 |
Test helper functions: |
|
9716
ea8c207a0f78
update: add comments and test cases for updating across branches
Stuart W Marks <smarks@smarks.org>
parents:
diff
changeset
|
51 |
|
12279 | 52 |
$ revtest () { |
53 |
> msg=$1 |
|
16491
bfe89d65d651
update: make --check abort with dirty subrepos
Patrick Mezard <patrick@mezard.eu>
parents:
14485
diff
changeset
|
54 |
> dirtyflag=$2 # 'clean', 'dirty' or 'dirtysub' |
12279 | 55 |
> startrev=$3 |
56 |
> targetrev=$4 |
|
57 |
> opt=$5 |
|
58 |
> hg up -qC $startrev |
|
59 |
> test $dirtyflag = dirty && echo dirty > foo |
|
16491
bfe89d65d651
update: make --check abort with dirty subrepos
Patrick Mezard <patrick@mezard.eu>
parents:
14485
diff
changeset
|
60 |
> test $dirtyflag = dirtysub && echo dirty > sub/suba |
12279 | 61 |
> hg up $opt $targetrev |
62 |
> hg parent --template 'parent={rev}\n' |
|
16491
bfe89d65d651
update: make --check abort with dirty subrepos
Patrick Mezard <patrick@mezard.eu>
parents:
14485
diff
changeset
|
63 |
> hg stat -S |
17347
2da47de36b6f
check-code: fix check for trailing whitespace on continued lines too
Mads Kiilerich <mads@kiilerich.com>
parents:
16491
diff
changeset
|
64 |
> } |
12279 | 65 |
|
66 |
$ norevtest () { |
|
67 |
> msg=$1 |
|
16491
bfe89d65d651
update: make --check abort with dirty subrepos
Patrick Mezard <patrick@mezard.eu>
parents:
14485
diff
changeset
|
68 |
> dirtyflag=$2 # 'clean', 'dirty' or 'dirtysub' |
12279 | 69 |
> startrev=$3 |
70 |
> opt=$4 |
|
71 |
> hg up -qC $startrev |
|
72 |
> test $dirtyflag = dirty && echo dirty > foo |
|
16491
bfe89d65d651
update: make --check abort with dirty subrepos
Patrick Mezard <patrick@mezard.eu>
parents:
14485
diff
changeset
|
73 |
> test $dirtyflag = dirtysub && echo dirty > sub/suba |
12279 | 74 |
> hg up $opt |
75 |
> hg parent --template 'parent={rev}\n' |
|
16491
bfe89d65d651
update: make --check abort with dirty subrepos
Patrick Mezard <patrick@mezard.eu>
parents:
14485
diff
changeset
|
76 |
> hg stat -S |
17347
2da47de36b6f
check-code: fix check for trailing whitespace on continued lines too
Mads Kiilerich <mads@kiilerich.com>
parents:
16491
diff
changeset
|
77 |
> } |
9716
ea8c207a0f78
update: add comments and test cases for updating across branches
Stuart W Marks <smarks@smarks.org>
parents:
diff
changeset
|
78 |
|
12328
b63f6422d2a7
tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12279
diff
changeset
|
79 |
Test cases are documented in a table in the update function of merge.py. |
b63f6422d2a7
tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12279
diff
changeset
|
80 |
Cases are run as shown in that table, row by row. |
9716
ea8c207a0f78
update: add comments and test cases for updating across branches
Stuart W Marks <smarks@smarks.org>
parents:
diff
changeset
|
81 |
|
12279 | 82 |
$ norevtest 'none clean linear' clean 4 |
83 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
84 |
parent=5 |
|
85 |
||
86 |
$ norevtest 'none clean same' clean 2 |
|
14485
610873cf064a
Make pull -u behave like pull && update
Brendan Cully <brendan@kublai.com>
parents:
12681
diff
changeset
|
87 |
abort: crosses branches (merge branches or update --check to force update) |
12279 | 88 |
parent=2 |
89 |
||
90 |
||
91 |
$ revtest 'none clean linear' clean 1 2 |
|
92 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
93 |
parent=2 |
|
9716
ea8c207a0f78
update: add comments and test cases for updating across branches
Stuart W Marks <smarks@smarks.org>
parents:
diff
changeset
|
94 |
|
12279 | 95 |
$ revtest 'none clean same' clean 2 3 |
96 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
97 |
parent=3 |
|
98 |
||
99 |
$ revtest 'none clean cross' clean 3 4 |
|
100 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
101 |
parent=4 |
|
102 |
||
103 |
||
104 |
$ revtest 'none dirty linear' dirty 1 2 |
|
105 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
106 |
parent=2 |
|
107 |
M foo |
|
9716
ea8c207a0f78
update: add comments and test cases for updating across branches
Stuart W Marks <smarks@smarks.org>
parents:
diff
changeset
|
108 |
|
16491
bfe89d65d651
update: make --check abort with dirty subrepos
Patrick Mezard <patrick@mezard.eu>
parents:
14485
diff
changeset
|
109 |
$ revtest 'none dirtysub linear' dirtysub 1 2 |
bfe89d65d651
update: make --check abort with dirty subrepos
Patrick Mezard <patrick@mezard.eu>
parents:
14485
diff
changeset
|
110 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
bfe89d65d651
update: make --check abort with dirty subrepos
Patrick Mezard <patrick@mezard.eu>
parents:
14485
diff
changeset
|
111 |
parent=2 |
bfe89d65d651
update: make --check abort with dirty subrepos
Patrick Mezard <patrick@mezard.eu>
parents:
14485
diff
changeset
|
112 |
M sub/suba |
bfe89d65d651
update: make --check abort with dirty subrepos
Patrick Mezard <patrick@mezard.eu>
parents:
14485
diff
changeset
|
113 |
|
12279 | 114 |
$ revtest 'none dirty same' dirty 2 3 |
12681
bc13e17067d9
update: use higher level wording for "crosses branches" error
Brodie Rao <brodie@bitheap.org>
parents:
12328
diff
changeset
|
115 |
abort: crosses branches (merge branches or use --clean to discard changes) |
12279 | 116 |
parent=2 |
117 |
M foo |
|
118 |
||
16491
bfe89d65d651
update: make --check abort with dirty subrepos
Patrick Mezard <patrick@mezard.eu>
parents:
14485
diff
changeset
|
119 |
$ revtest 'none dirtysub same' dirtysub 2 3 |
bfe89d65d651
update: make --check abort with dirty subrepos
Patrick Mezard <patrick@mezard.eu>
parents:
14485
diff
changeset
|
120 |
abort: crosses branches (merge branches or use --clean to discard changes) |
bfe89d65d651
update: make --check abort with dirty subrepos
Patrick Mezard <patrick@mezard.eu>
parents:
14485
diff
changeset
|
121 |
parent=2 |
bfe89d65d651
update: make --check abort with dirty subrepos
Patrick Mezard <patrick@mezard.eu>
parents:
14485
diff
changeset
|
122 |
M sub/suba |
bfe89d65d651
update: make --check abort with dirty subrepos
Patrick Mezard <patrick@mezard.eu>
parents:
14485
diff
changeset
|
123 |
|
12279 | 124 |
$ revtest 'none dirty cross' dirty 3 4 |
12681
bc13e17067d9
update: use higher level wording for "crosses branches" error
Brodie Rao <brodie@bitheap.org>
parents:
12328
diff
changeset
|
125 |
abort: crosses branches (merge branches or use --clean to discard changes) |
12279 | 126 |
parent=3 |
127 |
M foo |
|
128 |
||
16491
bfe89d65d651
update: make --check abort with dirty subrepos
Patrick Mezard <patrick@mezard.eu>
parents:
14485
diff
changeset
|
129 |
$ revtest 'none dirtysub cross' dirtysub 3 4 |
bfe89d65d651
update: make --check abort with dirty subrepos
Patrick Mezard <patrick@mezard.eu>
parents:
14485
diff
changeset
|
130 |
abort: crosses branches (merge branches or use --clean to discard changes) |
bfe89d65d651
update: make --check abort with dirty subrepos
Patrick Mezard <patrick@mezard.eu>
parents:
14485
diff
changeset
|
131 |
parent=3 |
bfe89d65d651
update: make --check abort with dirty subrepos
Patrick Mezard <patrick@mezard.eu>
parents:
14485
diff
changeset
|
132 |
M sub/suba |
12279 | 133 |
|
134 |
$ revtest '-C dirty linear' dirty 1 2 -C |
|
135 |
2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
136 |
parent=2 |
|
9716
ea8c207a0f78
update: add comments and test cases for updating across branches
Stuart W Marks <smarks@smarks.org>
parents:
diff
changeset
|
137 |
|
12279 | 138 |
$ revtest '-c dirty linear' dirty 1 2 -c |
139 |
abort: uncommitted local changes |
|
140 |
parent=1 |
|
141 |
M foo |
|
142 |
||
16491
bfe89d65d651
update: make --check abort with dirty subrepos
Patrick Mezard <patrick@mezard.eu>
parents:
14485
diff
changeset
|
143 |
$ revtest '-c dirtysub linear' dirtysub 1 2 -c |
bfe89d65d651
update: make --check abort with dirty subrepos
Patrick Mezard <patrick@mezard.eu>
parents:
14485
diff
changeset
|
144 |
abort: uncommitted local changes |
bfe89d65d651
update: make --check abort with dirty subrepos
Patrick Mezard <patrick@mezard.eu>
parents:
14485
diff
changeset
|
145 |
parent=1 |
bfe89d65d651
update: make --check abort with dirty subrepos
Patrick Mezard <patrick@mezard.eu>
parents:
14485
diff
changeset
|
146 |
M sub/suba |
bfe89d65d651
update: make --check abort with dirty subrepos
Patrick Mezard <patrick@mezard.eu>
parents:
14485
diff
changeset
|
147 |
|
12279 | 148 |
$ norevtest '-c clean same' clean 2 -c |
149 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
150 |
parent=3 |
|
151 |
||
152 |
$ revtest '-cC dirty linear' dirty 1 2 -cC |
|
153 |
abort: cannot specify both -c/--check and -C/--clean |
|
154 |
parent=1 |
|
155 |
M foo |
|
156 |