stack: replace 'getstack' with direct call to 'stack'
authorPierre-Yves David <pierre-yves.david@octobus.net>
Mon, 04 Sep 2017 12:23:03 +0200
changeset 2915 b3abdb3d819e
parent 2914 9897babc1fb5
child 2916 17749d9d3968
stack: replace 'getstack' with direct call to 'stack' The dedicated function do not add any value. We can update all the callers.
hgext3rd/topic/__init__.py
hgext3rd/topic/revset.py
hgext3rd/topic/stack.py
--- a/hgext3rd/topic/__init__.py	Mon Sep 04 12:19:49 2017 +0200
+++ b/hgext3rd/topic/__init__.py	Mon Sep 04 12:23:03 2017 +0200
@@ -135,7 +135,7 @@
         # XXX we might want to include t0 here,
         # however t0 is related to  'currenttopic' which has no place here.
         return None
-    revlist = stack.getstack(self._repo, topic=topic)
+    revlist = stack.stack(self._repo, topic=topic)
     try:
         return revlist.index(self.rev())
     except IndexError:
@@ -154,12 +154,12 @@
         tname = topic = repo.currenttopic
         if not tname:
             raise error.Abort(_('cannot resolve "%s": no active topic') % name)
-        revs = list(stack.getstack(repo, topic=topic))
+        revs = list(stack.stack(repo, topic=topic))
     elif branchrev.match(name):
         ttype = 'branch'
         idx = int(name[1:])
         tname = branch = repo[None].branch()
-        revs = list(stack.getstack(repo, branch=branch))
+        revs = list(stack.stack(repo, branch=branch))
 
     if revs is not None:
         try:
--- a/hgext3rd/topic/revset.py	Mon Sep 04 12:19:49 2017 +0200
+++ b/hgext3rd/topic/revset.py	Mon Sep 04 12:23:03 2017 +0200
@@ -78,7 +78,7 @@
         topic = repo.currenttopic
     if not topic:
         branch = repo[None].branch()
-    return revset.baseset(stack.getstack(repo, branch=branch, topic=topic)[1:]) & subset
+    return revset.baseset(stack.stack(repo, branch=branch, topic=topic)[1:]) & subset
 
 
 def modsetup(ui):
--- a/hgext3rd/topic/stack.py	Mon Sep 04 12:19:49 2017 +0200
+++ b/hgext3rd/topic/stack.py	Mon Sep 04 12:23:03 2017 +0200
@@ -58,10 +58,6 @@
             revs.insert(0, pt1.rev())
         return revs
 
-def getstack(repo, branch=None, topic=None):
-    # XXX need sorting
-    return stack(repo, branch=branch, topic = topic)
-
 def labelsgen(prefix, labelssuffix):
     """ Takes a label prefix and a list of suffixes. Returns a string of the prefix
     formatted with each suffix separated with a space.
@@ -124,7 +120,7 @@
             fm.plain('%d behind' % data['behindcount'], label='topic.stack.summary.behindcount')
     fm.plain('\n')
 
-    for idx, r in enumerate(getstack(repo, branch=branch, topic=topic), 0):
+    for idx, r in enumerate(stack(repo, branch=branch, topic=topic), 0):
         ctx = repo[r]
         # special case for t0, b0 as it's hard to plugin into rest of the logic
         if idx == 0:
@@ -201,7 +197,7 @@
     :behindcount: number of changeset on rebase destination
     """
     data = {}
-    revs = getstack(repo, branch, topic)[1:]
+    revs = stack(repo, branch, topic)[1:]
     data['changesetcount'] = len(revs)
     data['troubledcount'] = len([r for r in revs if repo[r].isunstable()])
     deps, rdeps = builddependencies(repo, revs)