Mercurial > public > mercurial-scm > hg-stable
diff hgext/rebase.py @ 18444:55aff0c2b73c
rebase: do not invent successor to skipped changeset
When rebase results in an empty a changeset it is "skipped" and no related
changeset is created at all. When we added obsolescence support to rebase (in
fc2a6114f0a0) it seemed a good idea to use its parent successor as the
successors for such dropped changesets. (see old version of the altered test).
This option was chosen because it seems a good way to hint about were the
dropped changeset "intended" to be. Such hint would have been used by automatic
evolution mechanism to rebase potential unstable children.
However, field testing of this version are not conclusive. It very often leads
to the creation of (totally unfounded) evolution divergence. This changeset
changes this behavior and mark skipped changesets as pruned (obsolete without
successors). This prevents the issue and seems semantically better probably a
win for obsolescence reading tool.
See example bellow for details:
User Babar has five changesets of interest:
- O, its current base of development.
- U, the new upstream
- A and C, some development changesets
- B another development changeset independent from A
O - A - B - C
\
U
Babar decides that B is more critical than the A and C and rebase it first
$ hg rebase --rev B --dest U
B is now obsolete (in lower case bellow). Rebase result, B', is its
successors.(note, C is unstable)
O - A - b - C
\
U - B'
Babar is now done with B', and want to rebase the rest of its history:
$ hg rebase --source A --dest B'
hg rebase process A, B and C. B is skipped as all its changes are already contained
in B'.
O - U - B' - A' - C'
Babar have the expected result graph wise, obsolescence marker are as follow:
B -> B' (from first rebase)
A -> A' (from second rebase)
C -> C' (from second rebase)
B -> ?? (from second rebase)
Before this changeset, the last marker is `B -> A'`. This cause two issues:
- This is semantically wrong. B have nothing to do with A'
- B has now two successors sets: (B',) and (A',). We detect a divergent
rewriting. The B' and A' are reported as "divergent" to Babar, confusion
ensues. In addition such divergent situation (divergent changeset are children
to each other) is tricky to solve.
With this changeset the last marker is `B -> ?`:
- This is semantically better.
- B has a single successors set (B',)
This scenario is added to the tests suite.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Fri, 18 Jan 2013 14:15:32 +0100 |
parents | 100fdc84670f |
children | c83d36b81df1 |
line wrap: on
line diff
--- a/hgext/rebase.py Thu Jan 17 17:51:30 2013 +0100 +++ b/hgext/rebase.py Fri Jan 18 14:15:32 2013 +0100 @@ -312,7 +312,7 @@ collapsedas = None if collapsef: collapsedas = newrev - clearrebased(ui, repo, state, collapsedas) + clearrebased(ui, repo, state, skipped, collapsedas) if currentbookmarks: updatebookmarks(repo, nstate, currentbookmarks, **opts) @@ -660,7 +660,7 @@ state[r] = nullmerge return repo['.'].rev(), dest.rev(), state -def clearrebased(ui, repo, state, collapsedas=None): +def clearrebased(ui, repo, state, skipped, collapsedas=None): """dispose of rebased revision at the end of the rebase If `collapsedas` is not None, the rebase was a collapse whose result if the @@ -669,9 +669,13 @@ markers = [] for rev, newrev in sorted(state.items()): if newrev >= 0: - if collapsedas is not None: - newrev = collapsedas - markers.append((repo[rev], (repo[newrev],))) + if rev in skipped: + succs = () + elif collapsedas is not None: + succs = (repo[collapsedas],) + else: + succs = (repo[newrev],) + markers.append((repo[rev], succs)) if markers: obsolete.createmarkers(repo, markers) else: