##// END OF EJS Templates
tests: test rebase of merge of target ancestors
Mads Kiilerich -
r23408:36dcd3db default
parent child Browse files
Show More
@@ -1,258 +1,306 b''
1 1 $ cat >> $HGRCPATH <<EOF
2 2 > [extensions]
3 3 > rebase=
4 4 >
5 5 > [alias]
6 6 > tglog = log -G --template "{rev}: '{desc}' {branches}\n"
7 7 > EOF
8 8
9 9 $ hg init repo
10 10 $ cd repo
11 11
12 12 $ echo A > a
13 13 $ echo >> a
14 14 $ hg ci -Am A
15 15 adding a
16 16
17 17 $ echo B > a
18 18 $ echo >> a
19 19 $ hg ci -m B
20 20
21 21 $ echo C > a
22 22 $ echo >> a
23 23 $ hg ci -m C
24 24
25 25 $ hg up -q -C 0
26 26
27 27 $ echo D >> a
28 28 $ hg ci -Am AD
29 29 created new head
30 30
31 31 $ hg tglog
32 32 @ 3: 'AD'
33 33 |
34 34 | o 2: 'C'
35 35 | |
36 36 | o 1: 'B'
37 37 |/
38 38 o 0: 'A'
39 39
40 40 $ hg rebase -s 1 -d 3
41 41 merging a
42 42 merging a
43 43 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-backup.hg (glob)
44 44
45 45 $ hg tglog
46 46 o 3: 'C'
47 47 |
48 48 o 2: 'B'
49 49 |
50 50 @ 1: 'AD'
51 51 |
52 52 o 0: 'A'
53 53
54 54
55 55 $ cd ..
56 56
57 57
58 58 Test rebasing of merges with ancestors of the rebase destination - a situation
59 59 that often happens when trying to recover from repeated merging with a mainline
60 60 branch.
61 61
62 62 The test case creates a dev branch that contains a couple of merges from the
63 63 default branch. When rebasing to the default branch, these merges would be
64 64 merges with ancestors on the same branch. The merges _could_ contain some
65 65 interesting conflict resolutions or additional changes in the merge commit, but
66 66 that is mixed up with the actual merge stuff and there is in general no way to
67 67 separate them.
68 68
69 69 Note: The dev branch contains _no_ changes to f-default. It might be unclear
70 70 how rebasing of ancestor merges should be handled, but the current behavior
71 71 with spurious prompts for conflicts in files that didn't change seems very
72 72 wrong.
73 73
74 74 $ hg init ancestor-merge
75 75 $ cd ancestor-merge
76 76
77 77 $ touch f-default
78 78 $ hg ci -Aqm 'default: create f-default'
79 79
80 80 $ hg branch -q dev
81 81 $ hg ci -qm 'dev: create branch'
82 82
83 83 $ echo stuff > f-dev
84 84 $ hg ci -Aqm 'dev: f-dev stuff'
85 85
86 86 $ hg up -q default
87 87 $ echo stuff > f-default
88 88 $ hg ci -m 'default: f-default stuff'
89 89
90 90 $ hg up -q dev
91 91 $ hg merge -q default
92 92 $ hg ci -m 'dev: merge default'
93 93
94 94 $ hg up -q default
95 95 $ hg rm f-default
96 96 $ hg ci -m 'default: remove f-default'
97 97
98 98 $ hg up -q dev
99 99 $ hg merge -q default
100 100 $ hg ci -m 'dev: merge default'
101 101
102 102 $ hg up -q default
103 103 $ echo stuff > f-other
104 104 $ hg ci -Aqm 'default: f-other stuff'
105 105
106 106 $ hg tglog
107 107 @ 7: 'default: f-other stuff'
108 108 |
109 109 | o 6: 'dev: merge default' dev
110 110 |/|
111 111 o | 5: 'default: remove f-default'
112 112 | |
113 113 | o 4: 'dev: merge default' dev
114 114 |/|
115 115 o | 3: 'default: f-default stuff'
116 116 | |
117 117 | o 2: 'dev: f-dev stuff' dev
118 118 | |
119 119 | o 1: 'dev: create branch' dev
120 120 |/
121 121 o 0: 'default: create f-default'
122 122
123 123 $ hg clone -qU . ../ancestor-merge-2
124 124
125 125 Full rebase all the way back from branching point:
126 126
127 127 $ hg rebase -r 'only(dev,default)' -d default
128 128 remote changed f-default which local deleted
129 129 use (c)hanged version or leave (d)eleted? c
130 130 local changed f-default which remote deleted
131 131 use (c)hanged version or (d)elete? c
132 132 saved backup bundle to $TESTTMP/ancestor-merge/.hg/strip-backup/1d1a643d390e-backup.hg (glob)
133 133 $ hg tglog
134 134 o 5: 'dev: merge default'
135 135 |
136 136 o 4: 'dev: f-dev stuff'
137 137 |
138 138 @ 3: 'default: f-other stuff'
139 139 |
140 140 o 2: 'default: remove f-default'
141 141 |
142 142 o 1: 'default: f-default stuff'
143 143 |
144 144 o 0: 'default: create f-default'
145 145
146 146 Grafty cherry picking rebasing:
147 147
148 148 $ cd ../ancestor-merge-2
149 149
150 150 $ hg phase -fdr0:
151 151 $ hg rebase -r 'children(only(dev,default))' -d default
152 152 remote changed f-default which local deleted
153 153 use (c)hanged version or leave (d)eleted? c
154 154 local changed f-default which remote deleted
155 155 use (c)hanged version or (d)elete? c
156 156 saved backup bundle to $TESTTMP/ancestor-merge-2/.hg/strip-backup/ec2c14fb2984-backup.hg (glob)
157 157 $ hg tglog
158 158 o 6: 'dev: merge default'
159 159 |
160 160 o 5: 'dev: f-dev stuff'
161 161 |
162 162 o 4: 'default: f-other stuff'
163 163 |
164 164 o 3: 'default: remove f-default'
165 165 |
166 166 o 2: 'default: f-default stuff'
167 167 |
168 168 | o 1: 'dev: create branch' dev
169 169 |/
170 170 o 0: 'default: create f-default'
171 171
172 172 $ cd ..
173 173
174 174
175 175 Test order of parents of rebased merged with un-rebased changes as p1.
176 176
177 177 $ hg init parentorder
178 178 $ cd parentorder
179 179 $ touch f
180 180 $ hg ci -Aqm common
181 181 $ touch change
182 182 $ hg ci -Aqm change
183 183 $ touch target
184 184 $ hg ci -Aqm target
185 185 $ hg up -qr 0
186 186 $ touch outside
187 187 $ hg ci -Aqm outside
188 188 $ hg merge -qr 1
189 189 $ hg ci -m 'merge p1 3=outside p2 1=ancestor'
190 190 $ hg par
191 191 changeset: 4:6990226659be
192 192 tag: tip
193 193 parent: 3:f59da8fc0fcf
194 194 parent: 1:dd40c13f7a6f
195 195 user: test
196 196 date: Thu Jan 01 00:00:00 1970 +0000
197 197 summary: merge p1 3=outside p2 1=ancestor
198 198
199 199 $ hg up -qr 1
200 200 $ hg merge -qr 3
201 201 $ hg ci -qm 'merge p1 1=ancestor p2 3=outside'
202 202 $ hg par
203 203 changeset: 5:a57575f79074
204 204 tag: tip
205 205 parent: 1:dd40c13f7a6f
206 206 parent: 3:f59da8fc0fcf
207 207 user: test
208 208 date: Thu Jan 01 00:00:00 1970 +0000
209 209 summary: merge p1 1=ancestor p2 3=outside
210 210
211 211 $ hg tglog
212 212 @ 5: 'merge p1 1=ancestor p2 3=outside'
213 213 |\
214 214 +---o 4: 'merge p1 3=outside p2 1=ancestor'
215 215 | |/
216 216 | o 3: 'outside'
217 217 | |
218 218 +---o 2: 'target'
219 219 | |
220 220 o | 1: 'change'
221 221 |/
222 222 o 0: 'common'
223 223
224 224 $ hg rebase -r 4 -d 2
225 225 saved backup bundle to $TESTTMP/parentorder/.hg/strip-backup/6990226659be-backup.hg (glob)
226 226 $ hg tip
227 227 changeset: 5:cca50676b1c5
228 228 tag: tip
229 229 parent: 2:a60552eb93fb
230 230 parent: 3:f59da8fc0fcf
231 231 user: test
232 232 date: Thu Jan 01 00:00:00 1970 +0000
233 233 summary: merge p1 3=outside p2 1=ancestor
234 234
235 235 $ hg rebase -r 4 -d 2
236 236 saved backup bundle to $TESTTMP/parentorder/.hg/strip-backup/a57575f79074-backup.hg (glob)
237 237 $ hg tip
238 238 changeset: 5:f9daf77ffe76
239 239 tag: tip
240 240 parent: 2:a60552eb93fb
241 241 parent: 3:f59da8fc0fcf
242 242 user: test
243 243 date: Thu Jan 01 00:00:00 1970 +0000
244 244 summary: merge p1 1=ancestor p2 3=outside
245 245
246 246 $ hg tglog
247 247 @ 5: 'merge p1 1=ancestor p2 3=outside'
248 248 |\
249 249 +---o 4: 'merge p1 3=outside p2 1=ancestor'
250 250 | |/
251 251 | o 3: 'outside'
252 252 | |
253 253 o | 2: 'target'
254 254 | |
255 255 o | 1: 'change'
256 256 |/
257 257 o 0: 'common'
258 258
259 rebase of merge of ancestors
260
261 $ hg up -qr 2
262 $ hg merge -qr 3
263 $ echo 'other change while merging future "rebase ancestors"' > other
264 $ hg ci -Aqm 'merge rebase ancestors'
265 $ hg rebase -d 5 -v
266 resolving manifests
267 removing other
268 note: merging f9daf77ffe76+ and 4c5f12f25ebe using bids from ancestors a60552eb93fb and f59da8fc0fcf
269
270 calculating bids for ancestor a60552eb93fb
271 resolving manifests
272
273 calculating bids for ancestor f59da8fc0fcf
274 resolving manifests
275
276 auction for merging merge bids
277 other: consensus for g
278 end of auction
279
280 getting other
281 other
282 rebase merging completed
283 1 changesets found
284 saved backup bundle to $TESTTMP/parentorder/.hg/strip-backup/4c5f12f25ebe-backup.hg (glob)
285 1 changesets found
286 adding branch
287 adding changesets
288 adding manifests
289 adding file changes
290 added 1 changesets with 1 changes to 1 files
291 rebase completed
292 $ hg tglog
293 @ 6: 'merge rebase ancestors'
294 |
295 o 5: 'merge p1 1=ancestor p2 3=outside'
296 |\
297 +---o 4: 'merge p1 3=outside p2 1=ancestor'
298 | |/
299 | o 3: 'outside'
300 | |
301 o | 2: 'target'
302 | |
303 o | 1: 'change'
304 |/
305 o 0: 'common'
306
General Comments 0
You need to be logged in to leave comments. Login now