From patchwork Thu Sep 27 17:08:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [04, of, 13] rebase: don't try to prune obsolete changeset already in the destination From: Boris Feld X-Patchwork-Id: 35142 Message-Id: To: mercurial-devel@mercurial-scm.org Date: Thu, 27 Sep 2018 19:08:36 +0200 # HG changeset patch # User Boris Feld # Date 1537992328 -7200 # Wed Sep 26 22:05:28 2018 +0200 # Node ID f70aad5388994c9dd8f1b6f814ed648252c378a0 # Parent b425c3186b916eef5e315962fb73491f046e10bf # EXP-Topic trackfold # Available At https://bitbucket.org/octobus/mercurial-devel/ # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r f70aad538899 rebase: don't try to prune obsolete changeset already in the destination With similar motivations to the previous changesets, we stop marking changeset from pruning when it is not the command intention. In this case, we still need to distinguish between the strip and the obsolete case. diff --git a/hgext/rebase.py b/hgext/rebase.py --- a/hgext/rebase.py +++ b/hgext/rebase.py @@ -1763,17 +1763,21 @@ def clearrebased(ui, repo, destmap, stat tonode = repo.changelog.node replacements = {} moves = {} + stripcleanup = not obsolete.isenabled(repo, obsolete.createmarkersopt) for rev, newrev in sorted(state.items()): if newrev >= 0 and newrev != rev: oldnode = tonode(rev) newnode = collapsedas or tonode(newrev) moves[oldnode] = newnode if not keepf: + succs = None if rev in skipped: - succs = () + if stripcleanup or not repo[rev].obsolete(): + succs = () else: succs = (newnode,) - replacements[oldnode] = succs + if succs is not None: + replacements[oldnode] = succs scmutil.cleanupnodes(repo, replacements, 'rebase', moves, backup=backup) if fm: hf = fm.hexfunc