Show More
1 | NO CONTENT: new file 100644, binary diff hidden |
|
NO CONTENT: new file 100644, binary diff hidden |
@@ -447,9 +447,44 b' def rebasenode(repo, rev, p1, state, col' | |||||
447 | repo.ui.debug(" already in target\n") |
|
447 | repo.ui.debug(" already in target\n") | |
448 | repo.dirstate.write() |
|
448 | repo.dirstate.write() | |
449 | repo.ui.debug(" merge against %d:%s\n" % (repo[rev].rev(), repo[rev])) |
|
449 | repo.ui.debug(" merge against %d:%s\n" % (repo[rev].rev(), repo[rev])) | |
450 | base = None |
|
450 | if repo[rev].rev() == repo[min(state)].rev(): | |
451 | if repo[rev].rev() != repo[min(state)].rev(): |
|
451 | # Case (1) initial changeset of a non-detaching rebase. | |
|
452 | # Let the merge mechanism find the base itself. | |||
|
453 | base = None | |||
|
454 | elif not repo[rev].p2(): | |||
|
455 | # Case (2) detaching the node with a single parent, use this parent | |||
452 | base = repo[rev].p1().node() |
|
456 | base = repo[rev].p1().node() | |
|
457 | else: | |||
|
458 | # In case of merge, we need to pick the right parent as merge base. | |||
|
459 | # | |||
|
460 | # Imagine we have: | |||
|
461 | # - M: currently rebase revision in this step | |||
|
462 | # - A: one parent of M | |||
|
463 | # - B: second parent of M | |||
|
464 | # - D: destination of this merge step (p1 var) | |||
|
465 | # | |||
|
466 | # If we are rebasing on D, D is the successors of A or B. The right | |||
|
467 | # merge base is the one D succeed to. We pretend it is B for the rest | |||
|
468 | # of this comment | |||
|
469 | # | |||
|
470 | # If we pick B as the base, the merge involves: | |||
|
471 | # - changes from B to M (actual changeset payload) | |||
|
472 | # - changes from B to D (induced by rebase) as D is a rebased | |||
|
473 | # version of B) | |||
|
474 | # Which exactly represent the rebase operation. | |||
|
475 | # | |||
|
476 | # If we pick the A as the base, the merge involves | |||
|
477 | # - changes from A to M (actual changeset payload) | |||
|
478 | # - changes from A to D (with include changes between unrelated A and B | |||
|
479 | # plus changes induced by rebase) | |||
|
480 | # Which does not represent anything sensible and creates a lot of | |||
|
481 | # conflicts. | |||
|
482 | for p in repo[rev].parents(): | |||
|
483 | if state.get(p.rev()) == repo[p1].rev(): | |||
|
484 | base = p.node() | |||
|
485 | break | |||
|
486 | if base is not None: | |||
|
487 | repo.ui.debug(" detach base %d:%s\n" % (repo[base].rev(), repo[base])) | |||
453 | # When collapsing in-place, the parent is the common ancestor, we |
|
488 | # When collapsing in-place, the parent is the common ancestor, we | |
454 | # have to allow merging with it. |
|
489 | # have to allow merging with it. | |
455 | return merge.update(repo, rev, True, True, False, base, collapse) |
|
490 | return merge.update(repo, rev, True, True, False, base, collapse) |
@@ -124,3 +124,184 b' Bookmark stays active after --continue' | |||||
124 | * mybook 5:d67b21408fc0 |
|
124 | * mybook 5:d67b21408fc0 | |
125 |
|
125 | |||
126 | $ cd .. |
|
126 | $ cd .. | |
|
127 | ||||
|
128 | Check that the right ancestors is used while rebasing a merge (issue4041) | |||
|
129 | ||||
|
130 | $ hg clone "$TESTDIR/bundles/issue4041.hg" issue4041 | |||
|
131 | requesting all changes | |||
|
132 | adding changesets | |||
|
133 | adding manifests | |||
|
134 | adding file changes | |||
|
135 | added 11 changesets with 8 changes to 3 files (+1 heads) | |||
|
136 | updating to branch default | |||
|
137 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
138 | $ cd issue4041 | |||
|
139 | $ hg phase --draft --force 9 | |||
|
140 | $ hg log -G | |||
|
141 | o changeset: 10:2f2496ddf49d | |||
|
142 | |\ branch: f1 | |||
|
143 | | | tag: tip | |||
|
144 | | | parent: 7:4c9fbe56a16f | |||
|
145 | | | parent: 9:e31216eec445 | |||
|
146 | | | user: szhang | |||
|
147 | | | date: Thu Sep 05 12:59:39 2013 -0400 | |||
|
148 | | | summary: merge | |||
|
149 | | | | |||
|
150 | | o changeset: 9:e31216eec445 | |||
|
151 | | | branch: f1 | |||
|
152 | | | user: szhang | |||
|
153 | | | date: Thu Sep 05 12:59:10 2013 -0400 | |||
|
154 | | | summary: more changes to f1 | |||
|
155 | | | | |||
|
156 | | o changeset: 8:8e4e2c1a07ae | |||
|
157 | | |\ branch: f1 | |||
|
158 | | | | parent: 2:4bc80088dc6b | |||
|
159 | | | | parent: 6:400110238667 | |||
|
160 | | | | user: szhang | |||
|
161 | | | | date: Thu Sep 05 12:57:59 2013 -0400 | |||
|
162 | | | | summary: bad merge | |||
|
163 | | | | | |||
|
164 | o | | changeset: 7:4c9fbe56a16f | |||
|
165 | |/ / branch: f1 | |||
|
166 | | | parent: 2:4bc80088dc6b | |||
|
167 | | | user: szhang | |||
|
168 | | | date: Thu Sep 05 12:54:00 2013 -0400 | |||
|
169 | | | summary: changed f1 | |||
|
170 | | | | |||
|
171 | | o changeset: 6:400110238667 | |||
|
172 | | | branch: f2 | |||
|
173 | | | parent: 4:12e8ec6bb010 | |||
|
174 | | | user: szhang | |||
|
175 | | | date: Tue Sep 03 13:58:02 2013 -0400 | |||
|
176 | | | summary: changed f2 on f2 | |||
|
177 | | | | |||
|
178 | | | @ changeset: 5:d79e2059b5c0 | |||
|
179 | | | | parent: 3:8a951942e016 | |||
|
180 | | | | user: szhang | |||
|
181 | | | | date: Tue Sep 03 13:57:39 2013 -0400 | |||
|
182 | | | | summary: changed f2 on default | |||
|
183 | | | | | |||
|
184 | | o | changeset: 4:12e8ec6bb010 | |||
|
185 | | |/ branch: f2 | |||
|
186 | | | user: szhang | |||
|
187 | | | date: Tue Sep 03 13:57:18 2013 -0400 | |||
|
188 | | | summary: created f2 branch | |||
|
189 | | | | |||
|
190 | | o changeset: 3:8a951942e016 | |||
|
191 | | | parent: 0:24797d4f68de | |||
|
192 | | | user: szhang | |||
|
193 | | | date: Tue Sep 03 13:57:11 2013 -0400 | |||
|
194 | | | summary: added f2.txt | |||
|
195 | | | | |||
|
196 | o | changeset: 2:4bc80088dc6b | |||
|
197 | | | branch: f1 | |||
|
198 | | | user: szhang | |||
|
199 | | | date: Tue Sep 03 13:56:20 2013 -0400 | |||
|
200 | | | summary: added f1.txt | |||
|
201 | | | | |||
|
202 | o | changeset: 1:ef53c9e6b608 | |||
|
203 | |/ branch: f1 | |||
|
204 | | user: szhang | |||
|
205 | | date: Tue Sep 03 13:55:26 2013 -0400 | |||
|
206 | | summary: created f1 branch | |||
|
207 | | | |||
|
208 | o changeset: 0:24797d4f68de | |||
|
209 | user: szhang | |||
|
210 | date: Tue Sep 03 13:55:08 2013 -0400 | |||
|
211 | summary: added default.txt | |||
|
212 | ||||
|
213 | $ hg rebase -s9 -d2 --debug # use debug to really check merge base used | |||
|
214 | rebase onto 2 starting from [<changectx e31216eec445>] | |||
|
215 | rebasing: 9:e31216eec445 5/6 changesets (83.33%) | |||
|
216 | future parents are 2 and -1 | |||
|
217 | rebase status stored | |||
|
218 | update to 2:4bc80088dc6b | |||
|
219 | resolving manifests | |||
|
220 | branchmerge: False, force: True, partial: False | |||
|
221 | ancestor: d79e2059b5c0+, local: d79e2059b5c0+, remote: 4bc80088dc6b | |||
|
222 | f2.txt: other deleted -> r | |||
|
223 | f1.txt: remote created -> g | |||
|
224 | removing f2.txt | |||
|
225 | updating: f2.txt 1/2 files (50.00%) | |||
|
226 | getting f1.txt | |||
|
227 | updating: f1.txt 2/2 files (100.00%) | |||
|
228 | merge against 9:e31216eec445 | |||
|
229 | detach base 8:8e4e2c1a07ae | |||
|
230 | searching for copies back to rev 3 | |||
|
231 | resolving manifests | |||
|
232 | branchmerge: True, force: True, partial: False | |||
|
233 | ancestor: 8e4e2c1a07ae, local: 4bc80088dc6b+, remote: e31216eec445 | |||
|
234 | f1.txt: remote is newer -> g | |||
|
235 | getting f1.txt | |||
|
236 | updating: f1.txt 1/1 files (100.00%) | |||
|
237 | f1.txt | |||
|
238 | rebasing: 10:2f2496ddf49d 6/6 changesets (100.00%) | |||
|
239 | future parents are 11 and 7 | |||
|
240 | rebase status stored | |||
|
241 | already in target | |||
|
242 | merge against 10:2f2496ddf49d | |||
|
243 | detach base 9:e31216eec445 | |||
|
244 | searching for copies back to rev 3 | |||
|
245 | resolving manifests | |||
|
246 | branchmerge: True, force: True, partial: False | |||
|
247 | ancestor: e31216eec445, local: 19c888675e13+, remote: 2f2496ddf49d | |||
|
248 | f1.txt: remote is newer -> g | |||
|
249 | getting f1.txt | |||
|
250 | updating: f1.txt 1/1 files (100.00%) | |||
|
251 | f1.txt | |||
|
252 | rebase merging completed | |||
|
253 | update back to initial working directory parent | |||
|
254 | resolving manifests | |||
|
255 | branchmerge: False, force: False, partial: False | |||
|
256 | ancestor: 2a7f09cac94c, local: 2a7f09cac94c+, remote: d79e2059b5c0 | |||
|
257 | f1.txt: other deleted -> r | |||
|
258 | f2.txt: remote created -> g | |||
|
259 | removing f1.txt | |||
|
260 | updating: f1.txt 1/2 files (50.00%) | |||
|
261 | getting f2.txt | |||
|
262 | updating: f2.txt 2/2 files (100.00%) | |||
|
263 | 3 changesets found | |||
|
264 | list of changesets: | |||
|
265 | 4c9fbe56a16f30c0d5dcc40ec1a97bbe3325209c | |||
|
266 | e31216eec445e44352c5f01588856059466a24c9 | |||
|
267 | 2f2496ddf49d69b5ef23ad8cf9fb2e0e4faf0ac2 | |||
|
268 | bundling: 1/3 changesets (33.33%) | |||
|
269 | bundling: 2/3 changesets (66.67%) | |||
|
270 | bundling: 3/3 changesets (100.00%) | |||
|
271 | bundling: 1/3 manifests (33.33%) | |||
|
272 | bundling: 2/3 manifests (66.67%) | |||
|
273 | bundling: 3/3 manifests (100.00%) | |||
|
274 | bundling: f1.txt 1/1 files (100.00%) | |||
|
275 | saved backup bundle to $TESTTMP/issue4041/.hg/strip-backup/e31216eec445-backup.hg (glob) | |||
|
276 | 3 changesets found | |||
|
277 | list of changesets: | |||
|
278 | 4c9fbe56a16f30c0d5dcc40ec1a97bbe3325209c | |||
|
279 | 19c888675e133ab5dff84516926a65672eaf04d9 | |||
|
280 | 2a7f09cac94c7f4b73ebd5cd1a62d3b2e8e336bf | |||
|
281 | bundling: 1/3 changesets (33.33%) | |||
|
282 | bundling: 2/3 changesets (66.67%) | |||
|
283 | bundling: 3/3 changesets (100.00%) | |||
|
284 | bundling: 1/3 manifests (33.33%) | |||
|
285 | bundling: 2/3 manifests (66.67%) | |||
|
286 | bundling: 3/3 manifests (100.00%) | |||
|
287 | bundling: f1.txt 1/1 files (100.00%) | |||
|
288 | adding branch | |||
|
289 | adding changesets | |||
|
290 | changesets: 1 chunks | |||
|
291 | add changeset 4c9fbe56a16f | |||
|
292 | changesets: 2 chunks | |||
|
293 | add changeset 19c888675e13 | |||
|
294 | changesets: 3 chunks | |||
|
295 | add changeset 2a7f09cac94c | |||
|
296 | adding manifests | |||
|
297 | manifests: 1/2 chunks (50.00%) | |||
|
298 | manifests: 2/2 chunks (100.00%) | |||
|
299 | manifests: 3/2 chunks (150.00%) | |||
|
300 | adding file changes | |||
|
301 | adding f1.txt revisions | |||
|
302 | files: 1/1 chunks (100.00%) | |||
|
303 | added 2 changesets with 2 changes to 1 files | |||
|
304 | removing unknown node e31216eec445 from 1-phase boundary | |||
|
305 | invalid branchheads cache (served): tip differs | |||
|
306 | rebase completed | |||
|
307 | updating the branch cache |
General Comments 0
You need to be logged in to leave comments.
Login now