Mercurial > public > mercurial-scm > hg
diff hgext/rebase.py @ 17612:fc2a6114f0a0
rebase: allow creation obsolescence relation instead of stripping
When obsolescence feature is enabled we now create markers from the rebased
set to the resulting set instead of stripping. The "state" mapping built by
rebase holds all necessary data.
Changesets "deleted" by the rebase are marked "succeeded" by the changeset they
would be rebased one. That the best guess of "successors" we have. Getting a
successors as meaningful as possible is important for automatic resolution of
obsolescence troubles. In other word, emptied changeset will looks collapsed
with their former parents. (see "empty changeset" section of the test if you are
still confused)
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Tue, 18 Sep 2012 23:13:31 +0200 |
parents | 910123eac887 |
children | aafc521668d8 |
line wrap: on
line diff
--- a/hgext/rebase.py Tue Sep 18 22:58:12 2012 +0200 +++ b/hgext/rebase.py Tue Sep 18 23:13:31 2012 +0200 @@ -15,7 +15,7 @@ ''' from mercurial import hg, util, repair, merge, cmdutil, commands, bookmarks -from mercurial import extensions, patch, scmutil, phases +from mercurial import extensions, patch, scmutil, phases, obsolete from mercurial.commands import templateopts from mercurial.node import nullrev from mercurial.lock import release @@ -658,14 +658,22 @@ def clearrebased(ui, repo, state): """dispose of rebased revision at the end of the rebase""" - rebased = [rev for rev in state if state[rev] != nullmerge] - if rebased: - if set(repo.changelog.descendants([min(rebased)])) - set(state): - ui.warn(_("warning: new changesets detected " - "on source branch, not stripping\n")) - else: - # backup the old csets by default - repair.strip(ui, repo, repo[min(rebased)].node(), "all") + if obsolete._enabled: + markers = [] + for rev, newrev in sorted(state.items()): + if newrev >= 0: + markers.append((repo[rev], (repo[newrev],))) + if markers: + obsolete.createmarkers(repo, markers) + else: + rebased = [rev for rev in state if state[rev] != nullmerge] + if rebased: + if set(repo.changelog.descendants([min(rebased)])) - set(state): + ui.warn(_("warning: new changesets detected " + "on source branch, not stripping\n")) + else: + # backup the old csets by default + repair.strip(ui, repo, repo[min(rebased)].node(), "all") def pullrebase(orig, ui, repo, *args, **opts):