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: 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()