diff --git a/hgext/rebase.py b/hgext/rebase.py --- a/hgext/rebase.py +++ b/hgext/rebase.py @@ -60,12 +60,10 @@ # Indicates that a revision needs to be rebased revtodo = -1 -nullmerge = -2 -revignored = -3 # legacy revstates no longer needed in current code -# -4: revprecursor, -5: revpruned -legacystates = {'-4', '-5'} +# -2: nullmerge, -3: revignored, -4: revprecursor, -5: revpruned +legacystates = {'-2', '-3', '-4', '-5'} cmdtable = {} command = registrar.command(cmdtable) @@ -233,8 +231,6 @@ oldrev, newrev = l.split(':') if newrev in legacystates: continue - if newrev in (str(nullmerge), str(revignored)): - state[repo[oldrev].rev()] = int(newrev) elif newrev == nullid: state[repo[oldrev].rev()] = revtodo # Legacy compat special case @@ -439,10 +435,6 @@ self.skipped.add(rev) self.state[rev] = p1 ui.debug('next revision set to %s\n' % p1) - elif self.state[rev] == nullmerge: - pass - elif self.state[rev] == revignored: - pass else: ui.status(_('already rebased %s as %s\n') % (desc, repo[self.state[rev]])) @@ -463,7 +455,7 @@ commitmsg = 'Collapsed revision' for rebased in self.state: if rebased not in self.skipped and\ - self.state[rebased] > nullmerge: + self.state[rebased] >= revtodo: commitmsg += '\n* %s' % repo[rebased].description() editopt = True editor = cmdutil.getcommiteditor(edit=editopt, editform=editform) @@ -479,7 +471,7 @@ else: newrev = repo[newnode].rev() for oldrev in self.state.iterkeys(): - if self.state[oldrev] > nullmerge: + if self.state[oldrev] >= revtodo: self.state[oldrev] = newrev if 'qtip' in repo.tags(): @@ -1226,7 +1218,6 @@ raise error.Abort(_('no matching revisions')) roots.sort() state = dict.fromkeys(rebaseset, revtodo) - detachset = set() emptyrebase = True for root in roots: commonbase = root.ancestor(dest) @@ -1248,47 +1239,6 @@ emptyrebase = False repo.ui.debug('rebase onto %s starting from %s\n' % (dest, root)) - # Rebase tries to turn into a parent of while - # preserving the number of parents of rebased changesets: - # - # - A changeset with a single parent will always be rebased as a - # changeset with a single parent. - # - # - A merge will be rebased as merge unless its parents are both - # ancestors of or are themselves in the rebased set and - # pruned while rebased. - # - # If one parent of is an ancestor of , the rebased - # version of this parent will be . This is always true with - # --base option. - # - # Otherwise, we need to *replace* the original parents with - # . This "detaches" the rebased set from its former location - # and rebases it onto . Changes introduced by ancestors of - # not common with (the detachset, marked as - # nullmerge) are "removed" from the rebased changesets. - # - # - If has a single parent, set it to . - # - # - If is a merge, we cannot decide which parent to - # replace, the rebase operation is not clearly defined. - # - # The table below sums up this behavior: - # - # +------------------+----------------------+-------------------------+ - # | | one parent | merge | - # +------------------+----------------------+-------------------------+ - # | parent in | new parent is | parents in :: are | - # | :: | | remapped to | - # +------------------+----------------------+-------------------------+ - # | unrelated source | new parent is | ambiguous, abort | - # +------------------+----------------------+-------------------------+ - # - # The actual abort is handled by `defineparents` - if len(root.parents()) <= 1: - # ancestors of not ancestors of - detachset.update(repo.changelog.findmissingrevs([commonbase.rev()], - [root.rev()])) if emptyrebase: return None for rev in sorted(state): @@ -1296,18 +1246,6 @@ # if all parents of this revision are done, then so is this revision if parents and all((state.get(p) == p for p in parents)): state[rev] = rev - for r in detachset: - if r not in state: - state[r] = nullmerge - if len(roots) > 1: - # If we have multiple roots, we may have "hole" in the rebase set. - # Rebase roots that descend from those "hole" should not be detached as - # other root are. We use the special `revignored` to inform rebase that - # the revision should be ignored but that `defineparents` should search - # a rebase destination that make sense regarding rebased topology. - rebasedomain = set(repo.revs('%ld::%ld', rebaseset, rebaseset)) - for ignored in set(rebasedomain) - set(rebaseset): - state[ignored] = revignored unfi = repo.unfiltered() for r in obsoletenotrebased: desc = _ctxdesc(unfi[r])