changeset 39921:1857f50a9643

cleanupnodes: drop special casing around prune markers (API) The `cleanupnodes` has logic to skip the creation of "prune" markers if the changeset is already obsolete. This feels strange and gets in the way of code changes to tracks folds. Now that callers no longer request such prune, we can drop this logic. In many cases, pruning through cleanupnodes should be replaced by internal phase usage.
author Boris Feld <boris.feld@octobus.net>
date Wed, 26 Sep 2018 21:28:21 +0200
parents 7198cdbbbde1
children a8ccd9523d40
files mercurial/scmutil.py tests/test-strip.t
diffstat 2 files changed, 3 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/scmutil.py	Wed Sep 26 22:05:28 2018 +0200
+++ b/mercurial/scmutil.py	Wed Sep 26 21:28:21 2018 +0200
@@ -980,15 +980,13 @@
             # Also sort the node in topology order, that might be useful for
             # some obsstore logic.
             # NOTE: the filtering and sorting might belong to createmarkers.
-            isobs = unfi.obsstore.successors.__contains__
             torev = unfi.changelog.rev
             sortfunc = lambda ns: torev(ns[0][0])
             rels = []
             for ns, s in sorted(replacements.items(), key=sortfunc):
                 for n in ns:
-                    if s or not isobs(n):
-                        rel = (unfi[n], tuple(unfi[m] for m in s))
-                        rels.append(rel)
+                    rel = (unfi[n], tuple(unfi[m] for m in s))
+                    rels.append(rel)
             if rels:
                 obsolete.createmarkers(repo, rels, operation=operation,
                                        metadata=metadata)
--- a/tests/test-strip.t	Wed Sep 26 22:05:28 2018 +0200
+++ b/tests/test-strip.t	Wed Sep 26 21:28:21 2018 +0200
@@ -1246,7 +1246,7 @@
   >                            node(b'D'): [node(b'D2')],
   >                            node(b'G'): [node(b'G2')]}
   >                 scmutil.cleanupnodes(repo, mapping, b'replace')
-  >                 scmutil.cleanupnodes(repo, nodes(b'((B::)+I+Z)-D2'),
+  >                 scmutil.cleanupnodes(repo, nodes(b'((B::)+I+Z)-D2-obsolete()'),
   >                                      b'replace')
   > EOF
   $ hg testnodescleanup --config extensions.t=$TESTTMP/scmutilcleanup.py