Mercurial > hg
annotate tests/test-update-branches.t @ 16451:9c431cfdca12
merge with stable
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Mon, 16 Apr 2012 16:50:25 -0500 |
parents | 610873cf064a |
children | bfe89d65d651 |
rev | line source |
---|---|
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 | |
18 $ hg ci -qAm0 | |
19 $ echo one > a ; hg ci -m1 | |
20 $ echo two > a ; hg ci -m2 | |
21 $ hg up -q 1 | |
22 $ echo three > a ; hg ci -qm3 | |
23 $ hg up -q 0 | |
24 $ hg branch -q b1 | |
25 $ echo four > a ; hg ci -qm4 | |
26 $ 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
|
27 |
12279 | 28 Initial repo state: |
9716
ea8c207a0f78
update: add comments and test cases for updating across branches
Stuart W Marks <smarks@smarks.org>
parents:
diff
changeset
|
29 |
12279 | 30 $ hg --config 'extensions.graphlog=' \ |
31 > glog --template '{rev}:{node|short} {parents} {branches}\n' | |
32 @ 5:e1bb631146ca b1 | |
33 | | |
34 o 4:a4fdb3b883c4 0:b608b9236435 b1 | |
35 | | |
36 | o 3:4b57d2520816 1:44592833ba9f | |
37 | | | |
38 | | o 2:063f31070f65 | |
39 | |/ | |
40 | o 1:44592833ba9f | |
41 |/ | |
42 o 0:b608b9236435 | |
43 | |
44 | |
45 Test helper functions: | |
9716
ea8c207a0f78
update: add comments and test cases for updating across branches
Stuart W Marks <smarks@smarks.org>
parents:
diff
changeset
|
46 |
12279 | 47 $ revtest () { |
48 > msg=$1 | |
49 > dirtyflag=$2 # 'clean' or 'dirty' | |
50 > startrev=$3 | |
51 > targetrev=$4 | |
52 > opt=$5 | |
53 > hg up -qC $startrev | |
54 > test $dirtyflag = dirty && echo dirty > foo | |
55 > hg up $opt $targetrev | |
56 > hg parent --template 'parent={rev}\n' | |
57 > hg stat | |
58 > } | |
59 | |
60 $ norevtest () { | |
61 > msg=$1 | |
62 > dirtyflag=$2 # 'clean' or 'dirty' | |
63 > startrev=$3 | |
64 > opt=$4 | |
65 > hg up -qC $startrev | |
66 > test $dirtyflag = dirty && echo dirty > foo | |
67 > hg up $opt | |
68 > hg parent --template 'parent={rev}\n' | |
69 > hg stat | |
70 > } | |
9716
ea8c207a0f78
update: add comments and test cases for updating across branches
Stuart W Marks <smarks@smarks.org>
parents:
diff
changeset
|
71 |
12328
b63f6422d2a7
tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12279
diff
changeset
|
72 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
|
73 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
|
74 |
12279 | 75 $ norevtest 'none clean linear' clean 4 |
76 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
77 parent=5 | |
78 | |
79 $ norevtest 'none clean same' clean 2 | |
14485
610873cf064a
Make pull -u behave like pull && update
Brendan Cully <brendan@kublai.com>
parents:
12681
diff
changeset
|
80 abort: crosses branches (merge branches or update --check to force update) |
12279 | 81 parent=2 |
82 | |
83 | |
84 $ revtest 'none clean linear' clean 1 2 | |
85 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
86 parent=2 | |
9716
ea8c207a0f78
update: add comments and test cases for updating across branches
Stuart W Marks <smarks@smarks.org>
parents:
diff
changeset
|
87 |
12279 | 88 $ revtest 'none clean same' clean 2 3 |
89 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
90 parent=3 | |
91 | |
92 $ revtest 'none clean cross' clean 3 4 | |
93 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
94 parent=4 | |
95 | |
96 | |
97 $ revtest 'none dirty linear' dirty 1 2 | |
98 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
99 parent=2 | |
100 M foo | |
9716
ea8c207a0f78
update: add comments and test cases for updating across branches
Stuart W Marks <smarks@smarks.org>
parents:
diff
changeset
|
101 |
12279 | 102 $ 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
|
103 abort: crosses branches (merge branches or use --clean to discard changes) |
12279 | 104 parent=2 |
105 M foo | |
106 | |
107 $ 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
|
108 abort: crosses branches (merge branches or use --clean to discard changes) |
12279 | 109 parent=3 |
110 M foo | |
111 | |
112 | |
113 $ revtest '-C dirty linear' dirty 1 2 -C | |
114 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
115 parent=2 | |
9716
ea8c207a0f78
update: add comments and test cases for updating across branches
Stuart W Marks <smarks@smarks.org>
parents:
diff
changeset
|
116 |
12279 | 117 $ revtest '-c dirty linear' dirty 1 2 -c |
118 abort: uncommitted local changes | |
119 parent=1 | |
120 M foo | |
121 | |
122 $ norevtest '-c clean same' clean 2 -c | |
123 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
124 parent=3 | |
125 | |
126 $ revtest '-cC dirty linear' dirty 1 2 -cC | |
127 abort: cannot specify both -c/--check and -C/--clean | |
128 parent=1 | |
129 M foo | |
130 |