Show More
@@ -139,9 +139,9 b' class rebaseruntime(object):' | |||||
139 | self.state = {} |
|
139 | self.state = {} | |
140 | self.activebookmark = None |
|
140 | self.activebookmark = None | |
141 | self.currentbookmarks = None |
|
141 | self.currentbookmarks = None | |
142 |
self. |
|
142 | self.dest = None | |
143 | self.skipped = set() |
|
143 | self.skipped = set() | |
144 |
self. |
|
144 | self.destancestors = set() | |
145 |
|
145 | |||
146 | self.collapsef = opts.get('collapse', False) |
|
146 | self.collapsef = opts.get('collapse', False) | |
147 | self.collapsemsg = cmdutil.logmessage(ui, opts) |
|
147 | self.collapsemsg = cmdutil.logmessage(ui, opts) | |
@@ -171,7 +171,7 b' class rebaseruntime(object):' | |||||
171 | def _writestatus(self, f): |
|
171 | def _writestatus(self, f): | |
172 | repo = self.repo.unfiltered() |
|
172 | repo = self.repo.unfiltered() | |
173 | f.write(repo[self.originalwd].hex() + '\n') |
|
173 | f.write(repo[self.originalwd].hex() + '\n') | |
174 |
f.write(repo[self. |
|
174 | f.write(repo[self.dest].hex() + '\n') | |
175 | f.write(repo[self.external].hex() + '\n') |
|
175 | f.write(repo[self.external].hex() + '\n') | |
176 | f.write('%d\n' % int(self.collapsef)) |
|
176 | f.write('%d\n' % int(self.collapsef)) | |
177 | f.write('%d\n' % int(self.keepf)) |
|
177 | f.write('%d\n' % int(self.keepf)) | |
@@ -194,7 +194,7 b' class rebaseruntime(object):' | |||||
194 | """Restore a previously stored status""" |
|
194 | """Restore a previously stored status""" | |
195 | repo = self.repo |
|
195 | repo = self.repo | |
196 | keepbranches = None |
|
196 | keepbranches = None | |
197 |
|
|
197 | dest = None | |
198 | collapse = False |
|
198 | collapse = False | |
199 | external = nullrev |
|
199 | external = nullrev | |
200 | activebookmark = None |
|
200 | activebookmark = None | |
@@ -206,7 +206,7 b' class rebaseruntime(object):' | |||||
206 | if i == 0: |
|
206 | if i == 0: | |
207 | originalwd = repo[l].rev() |
|
207 | originalwd = repo[l].rev() | |
208 | elif i == 1: |
|
208 | elif i == 1: | |
209 |
|
|
209 | dest = repo[l].rev() | |
210 | elif i == 2: |
|
210 | elif i == 2: | |
211 | external = repo[l].rev() |
|
211 | external = repo[l].rev() | |
212 | elif i == 3: |
|
212 | elif i == 3: | |
@@ -242,7 +242,7 b' class rebaseruntime(object):' | |||||
242 | skipped = set() |
|
242 | skipped = set() | |
243 | # recompute the set of skipped revs |
|
243 | # recompute the set of skipped revs | |
244 | if not collapse: |
|
244 | if not collapse: | |
245 |
seen = set([ |
|
245 | seen = set([dest]) | |
246 | for old, new in sorted(state.items()): |
|
246 | for old, new in sorted(state.items()): | |
247 | if new != revtodo and new in seen: |
|
247 | if new != revtodo and new in seen: | |
248 | skipped.add(old) |
|
248 | skipped.add(old) | |
@@ -253,7 +253,7 b' class rebaseruntime(object):' | |||||
253 | _setrebasesetvisibility(repo, set(state.keys()) | set([originalwd])) |
|
253 | _setrebasesetvisibility(repo, set(state.keys()) | set([originalwd])) | |
254 |
|
254 | |||
255 | self.originalwd = originalwd |
|
255 | self.originalwd = originalwd | |
256 |
self. |
|
256 | self.dest = dest | |
257 | self.state = state |
|
257 | self.state = state | |
258 | self.skipped = skipped |
|
258 | self.skipped = skipped | |
259 | self.collapsef = collapse |
|
259 | self.collapsef = collapse | |
@@ -262,12 +262,12 b' class rebaseruntime(object):' | |||||
262 | self.external = external |
|
262 | self.external = external | |
263 | self.activebookmark = activebookmark |
|
263 | self.activebookmark = activebookmark | |
264 |
|
264 | |||
265 |
def _handleskippingobsolete(self, rebaserevs, obsoleterevs, |
|
265 | def _handleskippingobsolete(self, rebaserevs, obsoleterevs, dest): | |
266 | """Compute structures necessary for skipping obsolete revisions |
|
266 | """Compute structures necessary for skipping obsolete revisions | |
267 |
|
267 | |||
268 | rebaserevs: iterable of all revisions that are to be rebased |
|
268 | rebaserevs: iterable of all revisions that are to be rebased | |
269 | obsoleterevs: iterable of all obsolete revisions in rebaseset |
|
269 | obsoleterevs: iterable of all obsolete revisions in rebaseset | |
270 |
|
|
270 | dest: a destination revision for the rebase operation | |
271 | """ |
|
271 | """ | |
272 | self.obsoletenotrebased = {} |
|
272 | self.obsoletenotrebased = {} | |
273 | if not self.ui.configbool('experimental', 'rebaseskipobsolete', |
|
273 | if not self.ui.configbool('experimental', 'rebaseskipobsolete', | |
@@ -276,7 +276,7 b' class rebaseruntime(object):' | |||||
276 | rebaseset = set(rebaserevs) |
|
276 | rebaseset = set(rebaserevs) | |
277 | obsoleteset = set(obsoleterevs) |
|
277 | obsoleteset = set(obsoleterevs) | |
278 | self.obsoletenotrebased = _computeobsoletenotrebased(self.repo, |
|
278 | self.obsoletenotrebased = _computeobsoletenotrebased(self.repo, | |
279 |
obsoleteset, |
|
279 | obsoleteset, dest) | |
280 | skippedset = set(self.obsoletenotrebased) |
|
280 | skippedset = set(self.obsoletenotrebased) | |
281 | _checkobsrebase(self.repo, self.ui, obsoleteset, rebaseset, skippedset) |
|
281 | _checkobsrebase(self.repo, self.ui, obsoleteset, rebaseset, skippedset) | |
282 |
|
282 | |||
@@ -296,11 +296,11 b' class rebaseruntime(object):' | |||||
296 | hint = _('use "hg rebase --abort" to clear broken state') |
|
296 | hint = _('use "hg rebase --abort" to clear broken state') | |
297 | raise error.Abort(msg, hint=hint) |
|
297 | raise error.Abort(msg, hint=hint) | |
298 | if isabort: |
|
298 | if isabort: | |
299 |
return abort(self.repo, self.originalwd, self. |
|
299 | return abort(self.repo, self.originalwd, self.dest, | |
300 | self.state, activebookmark=self.activebookmark) |
|
300 | self.state, activebookmark=self.activebookmark) | |
301 |
|
301 | |||
302 | obsrevs = (r for r, st in self.state.items() if st == revprecursor) |
|
302 | obsrevs = (r for r, st in self.state.items() if st == revprecursor) | |
303 |
self._handleskippingobsolete(self.state.keys(), obsrevs, self. |
|
303 | self._handleskippingobsolete(self.state.keys(), obsrevs, self.dest) | |
304 |
|
304 | |||
305 | def _preparenewrebase(self, dest, rebaseset): |
|
305 | def _preparenewrebase(self, dest, rebaseset): | |
306 | if dest is None: |
|
306 | if dest is None: | |
@@ -332,13 +332,13 b' class rebaseruntime(object):' | |||||
332 | % root, |
|
332 | % root, | |
333 | hint=_("see 'hg help phases' for details")) |
|
333 | hint=_("see 'hg help phases' for details")) | |
334 |
|
334 | |||
335 |
(self.originalwd, self. |
|
335 | (self.originalwd, self.dest, self.state) = result | |
336 | if self.collapsef: |
|
336 | if self.collapsef: | |
337 |
self. |
|
337 | self.destancestors = self.repo.changelog.ancestors( | |
338 |
[self. |
|
338 | [self.dest], | |
339 | inclusive=True) |
|
339 | inclusive=True) | |
340 | self.external = externalparent(self.repo, self.state, |
|
340 | self.external = externalparent(self.repo, self.state, | |
341 |
self. |
|
341 | self.destancestors) | |
342 |
|
342 | |||
343 | if dest.closesbranch() and not self.keepbranchesf: |
|
343 | if dest.closesbranch() and not self.keepbranchesf: | |
344 | self.ui.status(_('reopening closed branch head %s\n') % dest) |
|
344 | self.ui.status(_('reopening closed branch head %s\n') % dest) | |
@@ -359,9 +359,9 b' class rebaseruntime(object):' | |||||
359 | 'branches')) |
|
359 | 'branches')) | |
360 |
|
360 | |||
361 | # Rebase |
|
361 | # Rebase | |
362 |
if not self. |
|
362 | if not self.destancestors: | |
363 |
self. |
|
363 | self.destancestors = repo.changelog.ancestors([self.dest], | |
364 |
|
|
364 | inclusive=True) | |
365 |
|
365 | |||
366 | # Keep track of the current bookmarks in order to reset them later |
|
366 | # Keep track of the current bookmarks in order to reset them later | |
367 | self.currentbookmarks = repo._bookmarks.copy() |
|
367 | self.currentbookmarks = repo._bookmarks.copy() | |
@@ -389,9 +389,9 b' class rebaseruntime(object):' | |||||
389 | ui.status(_('rebasing %s\n') % desc) |
|
389 | ui.status(_('rebasing %s\n') % desc) | |
390 | ui.progress(_("rebasing"), pos, ("%d:%s" % (rev, ctx)), |
|
390 | ui.progress(_("rebasing"), pos, ("%d:%s" % (rev, ctx)), | |
391 | _('changesets'), total) |
|
391 | _('changesets'), total) | |
392 |
p1, p2, base = defineparents(repo, rev, self. |
|
392 | p1, p2, base = defineparents(repo, rev, self.dest, | |
393 | self.state, |
|
393 | self.state, | |
394 |
self. |
|
394 | self.destancestors, | |
395 | self.obsoletenotrebased) |
|
395 | self.obsoletenotrebased) | |
396 | self.storestatus(tr=tr) |
|
396 | self.storestatus(tr=tr) | |
397 | storecollapsemsg(repo, self.collapsemsg) |
|
397 | storecollapsemsg(repo, self.collapsemsg) | |
@@ -402,7 +402,7 b' class rebaseruntime(object):' | |||||
402 | ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), |
|
402 | ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), | |
403 | 'rebase') |
|
403 | 'rebase') | |
404 | stats = rebasenode(repo, rev, p1, base, self.state, |
|
404 | stats = rebasenode(repo, rev, p1, base, self.state, | |
405 |
self.collapsef, self. |
|
405 | self.collapsef, self.dest) | |
406 | if stats and stats[3] > 0: |
|
406 | if stats and stats[3] > 0: | |
407 | raise error.InterventionRequired( |
|
407 | raise error.InterventionRequired( | |
408 | _('unresolved conflicts (see hg ' |
|
408 | _('unresolved conflicts (see hg ' | |
@@ -440,11 +440,11 b' class rebaseruntime(object):' | |||||
440 | elif self.state[rev] == revignored: |
|
440 | elif self.state[rev] == revignored: | |
441 | ui.status(_('not rebasing ignored %s\n') % desc) |
|
441 | ui.status(_('not rebasing ignored %s\n') % desc) | |
442 | elif self.state[rev] == revprecursor: |
|
442 | elif self.state[rev] == revprecursor: | |
443 |
|
|
443 | destctx = repo[self.obsoletenotrebased[rev]] | |
444 |
desc |
|
444 | descdest = '%d:%s "%s"' % (destctx.rev(), destctx, | |
445 |
|
|
445 | destctx.description().split('\n', 1)[0]) | |
446 | msg = _('note: not rebasing %s, already in destination as %s\n') |
|
446 | msg = _('note: not rebasing %s, already in destination as %s\n') | |
447 |
ui.status(msg % (desc, desc |
|
447 | ui.status(msg % (desc, descdest)) | |
448 | elif self.state[rev] == revpruned: |
|
448 | elif self.state[rev] == revpruned: | |
449 | msg = _('note: not rebasing %s, it has no successor\n') |
|
449 | msg = _('note: not rebasing %s, it has no successor\n') | |
450 | ui.status(msg % desc) |
|
450 | ui.status(msg % desc) | |
@@ -459,8 +459,8 b' class rebaseruntime(object):' | |||||
459 | repo, ui, opts = self.repo, self.ui, self.opts |
|
459 | repo, ui, opts = self.repo, self.ui, self.opts | |
460 | if self.collapsef and not self.keepopen: |
|
460 | if self.collapsef and not self.keepopen: | |
461 | p1, p2, _base = defineparents(repo, min(self.state), |
|
461 | p1, p2, _base = defineparents(repo, min(self.state), | |
462 |
self. |
|
462 | self.dest, self.state, | |
463 |
self. |
|
463 | self.destancestors, | |
464 | self.obsoletenotrebased) |
|
464 | self.obsoletenotrebased) | |
465 | editopt = opts.get('edit') |
|
465 | editopt = opts.get('edit') | |
466 | editform = 'rebase.collapse' |
|
466 | editform = 'rebase.collapse' | |
@@ -494,7 +494,7 b' class rebaseruntime(object):' | |||||
494 | raise |
|
494 | raise | |
495 |
|
495 | |||
496 | if newnode is None: |
|
496 | if newnode is None: | |
497 |
newrev = self. |
|
497 | newrev = self.dest | |
498 | else: |
|
498 | else: | |
499 | newrev = repo[newnode].rev() |
|
499 | newrev = repo[newnode].rev() | |
500 | for oldrev in self.state.iterkeys(): |
|
500 | for oldrev in self.state.iterkeys(): | |
@@ -515,7 +515,7 b' class rebaseruntime(object):' | |||||
515 | nstate[repo[k].node()] = repo[succ].node() |
|
515 | nstate[repo[k].node()] = repo[succ].node() | |
516 | # XXX this is the same as dest.node() for the non-continue path -- |
|
516 | # XXX this is the same as dest.node() for the non-continue path -- | |
517 | # this should probably be cleaned up |
|
517 | # this should probably be cleaned up | |
518 |
|
|
518 | destnode = repo[self.dest].node() | |
519 |
|
519 | |||
520 | # restore original working directory |
|
520 | # restore original working directory | |
521 | # (we do this before stripping) |
|
521 | # (we do this before stripping) | |
@@ -531,7 +531,7 b' class rebaseruntime(object):' | |||||
531 |
|
531 | |||
532 | if self.currentbookmarks: |
|
532 | if self.currentbookmarks: | |
533 | with repo.transaction('bookmark') as tr: |
|
533 | with repo.transaction('bookmark') as tr: | |
534 |
updatebookmarks(repo, |
|
534 | updatebookmarks(repo, destnode, nstate, | |
535 | self.currentbookmarks, tr) |
|
535 | self.currentbookmarks, tr) | |
536 | if self.activebookmark not in repo._bookmarks: |
|
536 | if self.activebookmark not in repo._bookmarks: | |
537 | # active bookmark was divergent one and has been deleted |
|
537 | # active bookmark was divergent one and has been deleted | |
@@ -846,9 +846,9 b' def _definesets(ui, repo, destf=None, sr' | |||||
846 |
|
846 | |||
847 | return dest, rebaseset |
|
847 | return dest, rebaseset | |
848 |
|
848 | |||
849 |
def externalparent(repo, state, |
|
849 | def externalparent(repo, state, destancestors): | |
850 | """Return the revision that should be used as the second parent |
|
850 | """Return the revision that should be used as the second parent | |
851 |
when the revisions in state is collapsed on top of |
|
851 | when the revisions in state is collapsed on top of destancestors. | |
852 | Abort if there is more than one parent. |
|
852 | Abort if there is more than one parent. | |
853 | """ |
|
853 | """ | |
854 | parents = set() |
|
854 | parents = set() | |
@@ -858,7 +858,7 b' def externalparent(repo, state, targetan' | |||||
858 | continue |
|
858 | continue | |
859 | for p in repo[rev].parents(): |
|
859 | for p in repo[rev].parents(): | |
860 | if (p.rev() not in state |
|
860 | if (p.rev() not in state | |
861 |
and p.rev() not in |
|
861 | and p.rev() not in destancestors): | |
862 | parents.add(p.rev()) |
|
862 | parents.add(p.rev()) | |
863 | if not parents: |
|
863 | if not parents: | |
864 | return nullrev |
|
864 | return nullrev | |
@@ -866,7 +866,7 b' def externalparent(repo, state, targetan' | |||||
866 | return parents.pop() |
|
866 | return parents.pop() | |
867 | raise error.Abort(_('unable to collapse on top of %s, there is more ' |
|
867 | raise error.Abort(_('unable to collapse on top of %s, there is more ' | |
868 | 'than one external parent: %s') % |
|
868 | 'than one external parent: %s') % | |
869 |
(max( |
|
869 | (max(destancestors), | |
870 | ', '.join(str(p) for p in sorted(parents)))) |
|
870 | ', '.join(str(p) for p in sorted(parents)))) | |
871 |
|
871 | |||
872 | def concludenode(repo, rev, p1, p2, commitmsg=None, editor=None, extrafn=None, |
|
872 | def concludenode(repo, rev, p1, p2, commitmsg=None, editor=None, extrafn=None, | |
@@ -883,8 +883,8 b' def concludenode(repo, rev, p1, p2, comm' | |||||
883 | if extrafn: |
|
883 | if extrafn: | |
884 | extrafn(ctx, extra) |
|
884 | extrafn(ctx, extra) | |
885 |
|
885 | |||
886 |
|
|
886 | destphase = max(ctx.phase(), phases.draft) | |
887 |
overrides = {('phases', 'new-commit'): |
|
887 | overrides = {('phases', 'new-commit'): destphase} | |
888 | with repo.ui.configoverride(overrides, 'rebase'): |
|
888 | with repo.ui.configoverride(overrides, 'rebase'): | |
889 | if keepbranch: |
|
889 | if keepbranch: | |
890 | repo.ui.setconfig('ui', 'allowemptycommit', True) |
|
890 | repo.ui.setconfig('ui', 'allowemptycommit', True) | |
@@ -897,10 +897,10 b' def concludenode(repo, rev, p1, p2, comm' | |||||
897 | repo.dirstate.setbranch(repo[newnode].branch()) |
|
897 | repo.dirstate.setbranch(repo[newnode].branch()) | |
898 | return newnode |
|
898 | return newnode | |
899 |
|
899 | |||
900 |
def rebasenode(repo, rev, p1, base, state, collapse, |
|
900 | def rebasenode(repo, rev, p1, base, state, collapse, dest): | |
901 | 'Rebase a single revision rev on top of p1 using base as merge ancestor' |
|
901 | 'Rebase a single revision rev on top of p1 using base as merge ancestor' | |
902 | # Merge phase |
|
902 | # Merge phase | |
903 |
# Update to ta |
|
903 | # Update to destination and merge it with local | |
904 | if repo['.'].rev() != p1: |
|
904 | if repo['.'].rev() != p1: | |
905 | repo.ui.debug(" update to %d:%s\n" % (p1, repo[p1])) |
|
905 | repo.ui.debug(" update to %d:%s\n" % (p1, repo[p1])) | |
906 | mergemod.update(repo, p1, False, True) |
|
906 | mergemod.update(repo, p1, False, True) | |
@@ -915,7 +915,7 b' def rebasenode(repo, rev, p1, base, stat' | |||||
915 | stats = mergemod.update(repo, rev, True, True, base, collapse, |
|
915 | stats = mergemod.update(repo, rev, True, True, base, collapse, | |
916 | labels=['dest', 'source']) |
|
916 | labels=['dest', 'source']) | |
917 | if collapse: |
|
917 | if collapse: | |
918 |
copies.duplicatecopies(repo, rev, |
|
918 | copies.duplicatecopies(repo, rev, dest) | |
919 | else: |
|
919 | else: | |
920 | # If we're not using --collapse, we need to |
|
920 | # If we're not using --collapse, we need to | |
921 | # duplicate copies between the revision we're |
|
921 | # duplicate copies between the revision we're | |
@@ -923,7 +923,7 b' def rebasenode(repo, rev, p1, base, stat' | |||||
923 | # duplicate any copies that have already been |
|
923 | # duplicate any copies that have already been | |
924 | # performed in the destination. |
|
924 | # performed in the destination. | |
925 | p1rev = repo[rev].p1().rev() |
|
925 | p1rev = repo[rev].p1().rev() | |
926 |
copies.duplicatecopies(repo, rev, p1rev, skiprev= |
|
926 | copies.duplicatecopies(repo, rev, p1rev, skiprev=dest) | |
927 | return stats |
|
927 | return stats | |
928 |
|
928 | |||
929 | def nearestrebased(repo, rev, state): |
|
929 | def nearestrebased(repo, rev, state): | |
@@ -958,7 +958,7 b' def _checkobsrebase(repo, ui, rebaseobsr' | |||||
958 | "experimental.allowdivergence=True") |
|
958 | "experimental.allowdivergence=True") | |
959 | raise error.Abort(msg % (",".join(divhashes),), hint=h) |
|
959 | raise error.Abort(msg % (",".join(divhashes),), hint=h) | |
960 |
|
960 | |||
961 |
def defineparents(repo, rev, |
|
961 | def defineparents(repo, rev, dest, state, destancestors, | |
962 | obsoletenotrebased): |
|
962 | obsoletenotrebased): | |
963 | 'Return the new parent relationship of the revision that will be rebased' |
|
963 | 'Return the new parent relationship of the revision that will be rebased' | |
964 | parents = repo[rev].parents() |
|
964 | parents = repo[rev].parents() | |
@@ -966,26 +966,26 b' def defineparents(repo, rev, target, sta' | |||||
966 | rp1 = None |
|
966 | rp1 = None | |
967 |
|
967 | |||
968 | p1n = parents[0].rev() |
|
968 | p1n = parents[0].rev() | |
969 |
if p1n in |
|
969 | if p1n in destancestors: | |
970 |
p1 = |
|
970 | p1 = dest | |
971 | elif p1n in state: |
|
971 | elif p1n in state: | |
972 | if state[p1n] == nullmerge: |
|
972 | if state[p1n] == nullmerge: | |
973 |
p1 = |
|
973 | p1 = dest | |
974 | elif state[p1n] in revskipped: |
|
974 | elif state[p1n] in revskipped: | |
975 | p1 = nearestrebased(repo, p1n, state) |
|
975 | p1 = nearestrebased(repo, p1n, state) | |
976 | if p1 is None: |
|
976 | if p1 is None: | |
977 |
p1 = |
|
977 | p1 = dest | |
978 | else: |
|
978 | else: | |
979 | p1 = state[p1n] |
|
979 | p1 = state[p1n] | |
980 | else: # p1n external |
|
980 | else: # p1n external | |
981 |
p1 = |
|
981 | p1 = dest | |
982 | p2 = p1n |
|
982 | p2 = p1n | |
983 |
|
983 | |||
984 |
if len(parents) == 2 and parents[1].rev() not in |
|
984 | if len(parents) == 2 and parents[1].rev() not in destancestors: | |
985 | p2n = parents[1].rev() |
|
985 | p2n = parents[1].rev() | |
986 | # interesting second parent |
|
986 | # interesting second parent | |
987 | if p2n in state: |
|
987 | if p2n in state: | |
988 |
if p1 == |
|
988 | if p1 == dest: # p1n in destancestors or external | |
989 | p1 = state[p2n] |
|
989 | p1 = state[p2n] | |
990 | if p1 == revprecursor: |
|
990 | if p1 == revprecursor: | |
991 | rp1 = obsoletenotrebased[p2n] |
|
991 | rp1 = obsoletenotrebased[p2n] | |
@@ -993,7 +993,7 b' def defineparents(repo, rev, target, sta' | |||||
993 | p2 = nearestrebased(repo, p2n, state) |
|
993 | p2 = nearestrebased(repo, p2n, state) | |
994 | if p2 is None: |
|
994 | if p2 is None: | |
995 | # no ancestors rebased yet, detach |
|
995 | # no ancestors rebased yet, detach | |
996 |
p2 = |
|
996 | p2 = dest | |
997 | else: |
|
997 | else: | |
998 | p2 = state[p2n] |
|
998 | p2 = state[p2n] | |
999 | else: # p2n external |
|
999 | else: # p2n external | |
@@ -1109,14 +1109,14 b' def updatemq(repo, state, skipped, **opt' | |||||
1109 | mq.seriesdirty = True |
|
1109 | mq.seriesdirty = True | |
1110 | mq.savedirty() |
|
1110 | mq.savedirty() | |
1111 |
|
1111 | |||
1112 |
def updatebookmarks(repo, |
|
1112 | def updatebookmarks(repo, destnode, nstate, originalbookmarks, tr): | |
1113 | 'Move bookmarks to their correct changesets, and delete divergent ones' |
|
1113 | 'Move bookmarks to their correct changesets, and delete divergent ones' | |
1114 | marks = repo._bookmarks |
|
1114 | marks = repo._bookmarks | |
1115 | for k, v in originalbookmarks.iteritems(): |
|
1115 | for k, v in originalbookmarks.iteritems(): | |
1116 | if v in nstate: |
|
1116 | if v in nstate: | |
1117 | # update the bookmarks for revs that have moved |
|
1117 | # update the bookmarks for revs that have moved | |
1118 | marks[k] = nstate[v] |
|
1118 | marks[k] = nstate[v] | |
1119 |
bookmarks.deletedivergent(repo, [ |
|
1119 | bookmarks.deletedivergent(repo, [destnode], k) | |
1120 | marks.recordchange(tr) |
|
1120 | marks.recordchange(tr) | |
1121 |
|
1121 | |||
1122 | def storecollapsemsg(repo, collapsemsg): |
|
1122 | def storecollapsemsg(repo, collapsemsg): | |
@@ -1168,7 +1168,7 b' def needupdate(repo, state):' | |||||
1168 |
|
1168 | |||
1169 | return False |
|
1169 | return False | |
1170 |
|
1170 | |||
1171 |
def abort(repo, originalwd, |
|
1171 | def abort(repo, originalwd, dest, state, activebookmark=None): | |
1172 | '''Restore the repository to its original state. Additional args: |
|
1172 | '''Restore the repository to its original state. Additional args: | |
1173 |
|
1173 | |||
1174 | activebookmark: the name of the bookmark that should be active after the |
|
1174 | activebookmark: the name of the bookmark that should be active after the | |
@@ -1176,9 +1176,9 b' def abort(repo, originalwd, target, stat' | |||||
1176 |
|
1176 | |||
1177 | try: |
|
1177 | try: | |
1178 | # If the first commits in the rebased set get skipped during the rebase, |
|
1178 | # If the first commits in the rebased set get skipped during the rebase, | |
1179 |
# their values within the state mapping will be the |
|
1179 | # their values within the state mapping will be the dest rev id. The | |
1180 |
# dstates list must must not contain the |
|
1180 | # dstates list must must not contain the dest rev (issue4896) | |
1181 |
dstates = [s for s in state.values() if s >= 0 and s != |
|
1181 | dstates = [s for s in state.values() if s >= 0 and s != dest] | |
1182 | immutable = [d for d in dstates if not repo[d].mutable()] |
|
1182 | immutable = [d for d in dstates if not repo[d].mutable()] | |
1183 | cleanup = True |
|
1183 | cleanup = True | |
1184 | if immutable: |
|
1184 | if immutable: | |
@@ -1197,13 +1197,13 b' def abort(repo, originalwd, target, stat' | |||||
1197 |
|
1197 | |||
1198 | if cleanup: |
|
1198 | if cleanup: | |
1199 | shouldupdate = False |
|
1199 | shouldupdate = False | |
1200 |
rebased = filter(lambda x: x >= 0 and x != |
|
1200 | rebased = filter(lambda x: x >= 0 and x != dest, state.values()) | |
1201 | if rebased: |
|
1201 | if rebased: | |
1202 | strippoints = [ |
|
1202 | strippoints = [ | |
1203 | c.node() for c in repo.set('roots(%ld)', rebased)] |
|
1203 | c.node() for c in repo.set('roots(%ld)', rebased)] | |
1204 |
|
1204 | |||
1205 | updateifonnodes = set(rebased) |
|
1205 | updateifonnodes = set(rebased) | |
1206 |
updateifonnodes.add( |
|
1206 | updateifonnodes.add(dest) | |
1207 | updateifonnodes.add(originalwd) |
|
1207 | updateifonnodes.add(originalwd) | |
1208 | shouldupdate = repo['.'].rev() in updateifonnodes |
|
1208 | shouldupdate = repo['.'].rev() in updateifonnodes | |
1209 |
|
1209 |
General Comments 0
You need to be logged in to leave comments.
Login now