D4308: debugcommands: use a revset instead of dagutil

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Thu Aug 16 20:44:33 UTC 2018


indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  All this code was doing was finding the nodes that are heads
  from the ancestors of an input set. This can easily be expressed
  with a revset without having to go through dagutil.
  
  This was the last use of ancestorset() outside of dagutil itself.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D4308

AFFECTED FILES
  mercurial/debugcommands.py

CHANGE DETAILS

diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -42,7 +42,6 @@
     color,
     context,
     dagparser,
-    dagutil,
     encoding,
     error,
     exchange,
@@ -791,11 +790,10 @@
             if not opts.get('nonheads'):
                 ui.write(("unpruned common: %s\n") %
                          " ".join(sorted(short(n) for n in common)))
-                cl = repo.changelog
-                clnode = cl.node
-                dag = dagutil.revlogdag(cl)
-                all = dag.ancestorset(cl.rev(n) for n in common)
-                common = {clnode(r) for r in dag.headsetofconnecteds(all)}
+
+                clnode = repo.changelog.node
+                common = repo.revs('heads(::%ln)', common)
+                common = {clnode(r) for r in common}
         else:
             nodes = None
             if pushedrevs:



To: indygreg, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list