D2403: stack: remove destutil.stackbase

lothiraldan (Boris Feld) phabricator at mercurial-scm.org
Fri Feb 23 05:37:21 EST 2018


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

REVISION SUMMARY
  Use directly stack.getstack in show stack command. Remove destutil.stackbase.
  Import a TODO from the show stack in the code.

REPOSITORY
  rHG Mercurial

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: mercurial-devel


More information about the Mercurial-devel mailing list