Show More
@@ -69,12 +69,12 b' def _makeextrafn(copiers):' | |||
|
69 | 69 | c(ctx, extra) |
|
70 | 70 | return extrafn |
|
71 | 71 | |
|
72 | def _destrebase(repo, sourceset): | |
|
72 | def _destrebase(repo, sourceset, destspace=None): | |
|
73 | 73 | """small wrapper around destmerge to pass the right extra args |
|
74 | 74 | |
|
75 | 75 | Please wrap destutil.destmerge instead.""" |
|
76 | 76 | return destutil.destmerge(repo, action='rebase', sourceset=sourceset, |
|
77 | onheadcheck=False) | |
|
77 | onheadcheck=False, destspace=destspace) | |
|
78 | 78 | |
|
79 | 79 | revsetpredicate = registrar.revsetpredicate() |
|
80 | 80 | |
@@ -222,6 +222,9 b' def rebase(ui, repo, **opts):' | |||
|
222 | 222 | srcf = opts.get('source', None) |
|
223 | 223 | basef = opts.get('base', None) |
|
224 | 224 | revf = opts.get('rev', []) |
|
225 | # search default destination in this space | |
|
226 | # used in the 'hg pull --rebase' case, see issue 5214. | |
|
227 | destspace = opts.get('_destspace') | |
|
225 | 228 | contf = opts.get('continue') |
|
226 | 229 | abortf = opts.get('abort') |
|
227 | 230 | collapsef = opts.get('collapse', False) |
@@ -296,7 +299,8 b' def rebase(ui, repo, **opts):' | |||
|
296 | 299 | _checkobsrebase(repo, ui, rebaseobsrevs, rebasesetrevs, |
|
297 | 300 | rebaseobsskipped) |
|
298 | 301 | else: |
|
299 |
dest, rebaseset = _definesets(ui, repo, destf, srcf, basef, revf |
|
|
302 | dest, rebaseset = _definesets(ui, repo, destf, srcf, basef, revf, | |
|
303 | destspace=destspace) | |
|
300 | 304 | if dest is None: |
|
301 | 305 | return _nothingtorebase() |
|
302 | 306 | |
@@ -525,9 +529,12 b' def rebase(ui, repo, **opts):' | |||
|
525 | 529 | finally: |
|
526 | 530 | release(lock, wlock) |
|
527 | 531 | |
|
528 |
def _definesets(ui, repo, destf=None, srcf=None, basef=None, revf=[] |
|
|
532 | def _definesets(ui, repo, destf=None, srcf=None, basef=None, revf=[], | |
|
533 | destspace=None): | |
|
529 | 534 | """use revisions argument to define destination and rebase set |
|
530 | 535 | """ |
|
536 | # destspace is here to work around issues with `hg pull --rebase` see | |
|
537 | # issue5214 for details | |
|
531 | 538 | if srcf and basef: |
|
532 | 539 | raise error.Abort(_('cannot specify both a source and a base')) |
|
533 | 540 | if revf and basef: |
@@ -560,7 +567,7 b' def _definesets(ui, repo, destf=None, sr' | |||
|
560 | 567 | "can't compute rebase set\n")) |
|
561 | 568 | return None, None |
|
562 | 569 | if not destf: |
|
563 | dest = repo[_destrebase(repo, base)] | |
|
570 | dest = repo[_destrebase(repo, base, destspace=destspace)] | |
|
564 | 571 | destf = str(dest) |
|
565 | 572 | |
|
566 | 573 | commonanc = repo.revs('ancestor(%ld, %d)', base, dest).first() |
@@ -598,7 +605,7 b' def _definesets(ui, repo, destf=None, sr' | |||
|
598 | 605 | return None, None |
|
599 | 606 | |
|
600 | 607 | if not destf: |
|
601 | dest = repo[_destrebase(repo, rebaseset)] | |
|
608 | dest = repo[_destrebase(repo, rebaseset, destspace=destspace)] | |
|
602 | 609 | destf = str(dest) |
|
603 | 610 | |
|
604 | 611 | return dest, rebaseset |
@@ -256,7 +256,7 b' msgdestmerge = {' | |||
|
256 | 256 | }, |
|
257 | 257 | } |
|
258 | 258 | |
|
259 | def _destmergebook(repo, action='merge', sourceset=None): | |
|
259 | def _destmergebook(repo, action='merge', sourceset=None, destspace=None): | |
|
260 | 260 | """find merge destination in the active bookmark case""" |
|
261 | 261 | node = None |
|
262 | 262 | bmheads = repo.bookmarkheads(repo._activebookmark) |
@@ -275,7 +275,8 b" def _destmergebook(repo, action='merge'," | |||
|
275 | 275 | assert node is not None |
|
276 | 276 | return node |
|
277 | 277 | |
|
278 |
def _destmergebranch(repo, action='merge', sourceset=None, onheadcheck=True |
|
|
278 | def _destmergebranch(repo, action='merge', sourceset=None, onheadcheck=True, | |
|
279 | destspace=None): | |
|
279 | 280 | """find merge destination based on branch heads""" |
|
280 | 281 | node = None |
|
281 | 282 | |
@@ -308,6 +309,12 b" def _destmergebranch(repo, action='merge" | |||
|
308 | 309 | bheads = list(repo.revs('%ln - (%ld::)', bheads, sourceset)) |
|
309 | 310 | # filters out bookmarked heads |
|
310 | 311 | nbhs = list(repo.revs('%ld - bookmark()', bheads)) |
|
312 | ||
|
313 | if destspace is not None: | |
|
314 | # restrict search space | |
|
315 | # used in the 'hg pull --rebase' case, see issue 5214. | |
|
316 | nbhs = list(repo.revs('%ld and %ld', destspace, nbhs)) | |
|
317 | ||
|
311 | 318 | if len(nbhs) > 1: |
|
312 | 319 | # Case B: There is more than 1 other anonymous heads |
|
313 | 320 | # |
@@ -339,18 +346,22 b" def _destmergebranch(repo, action='merge" | |||
|
339 | 346 | assert node is not None |
|
340 | 347 | return node |
|
341 | 348 | |
|
342 |
def destmerge(repo, action='merge', sourceset=None, onheadcheck=True |
|
|
349 | def destmerge(repo, action='merge', sourceset=None, onheadcheck=True, | |
|
350 | destspace=None): | |
|
343 | 351 | """return the default destination for a merge |
|
344 | 352 | |
|
345 | 353 | (or raise exception about why it can't pick one) |
|
346 | 354 | |
|
347 | 355 | :action: the action being performed, controls emitted error message |
|
348 | 356 | """ |
|
357 | # destspace is here to work around issues with `hg pull --rebase` see | |
|
358 | # issue5214 for details | |
|
349 | 359 | if repo._activebookmark: |
|
350 |
node = _destmergebook(repo, action=action, sourceset=sourceset |
|
|
360 | node = _destmergebook(repo, action=action, sourceset=sourceset, | |
|
361 | destspace=destspace) | |
|
351 | 362 | else: |
|
352 | 363 | node = _destmergebranch(repo, action=action, sourceset=sourceset, |
|
353 | onheadcheck=onheadcheck) | |
|
364 | onheadcheck=onheadcheck, destspace=destspace) | |
|
354 | 365 | return repo[node].rev() |
|
355 | 366 | |
|
356 | 367 | histeditdefaultrevset = 'reverse(only(.) and not public() and not ::merge())' |
General Comments 0
You need to be logged in to leave comments.
Login now