D2403: stack: remove destutil.stackbase

lothiraldan (Boris Feld) phabricator at mercurial-scm.org
Thu Apr 5 16:22:35 UTC 2018


lothiraldan updated this revision to Diff 7736.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2403?vs=6219&id=7736

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

AFFECTED FILES
  hgext/show.py
  mercurial/destutil.py

CHANGE DETAILS

diff --git a/mercurial/destutil.py b/mercurial/destutil.py
--- a/mercurial/destutil.py
+++ b/mercurial/destutil.py
@@ -357,10 +357,6 @@
 
     return None
 
-def stackbase(ui, repo):
-    revs = stack.getstack(repo)
-    return revs.first() if revs else None
-
 def _statusotherbook(ui, repo):
     bmheads = bookmarks.headsforactive(repo)
     curhead = repo[repo._activebookmark].node()
diff --git a/hgext/show.py b/hgext/show.py
--- a/hgext/show.py
+++ b/hgext/show.py
@@ -35,7 +35,6 @@
 from mercurial import (
     cmdutil,
     commands,
-    destutil,
     error,
     formatter,
     graphmod,
@@ -45,6 +44,7 @@
     registrar,
     revset,
     revsetlang,
+    stack
 )
 
 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
@@ -193,17 +193,17 @@
                    'changeset)\n'))
         return
 
-    # TODO extract "find stack" into a function to facilitate
-    # customization and reuse.
-
-    baserev = destutil.stackbase(ui, repo)
     basectx = None
 
+    _stack = stack.getstack(repo)
+    baserev = _stack.first()
+
+    # TODO doesn't yet handle case where wdir is a draft merge
     if baserev is None:
         baserev = wdirctx.rev()
         stackrevs = {wdirctx.rev()}
     else:
-        stackrevs = set(repo.revs('%d::.', baserev))
+        stackrevs = set(_stack)
 
     ctx = repo[baserev]
     if ctx.p1().rev() != nullrev:



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


More information about the Mercurial-devel mailing list