comparison hgext3rd/topic/stack.py @ 2915:b3abdb3d819e

stack: replace 'getstack' with direct call to 'stack' The dedicated function do not add any value. We can update all the callers.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 04 Sep 2017 12:23:03 +0200
parents 9897babc1fb5
children 17749d9d3968
comparison
equal deleted inserted replaced
2914:9897babc1fb5 2915:b3abdb3d819e
55 pt1 = self._repo[revs[0]].p1() 55 pt1 = self._repo[revs[0]].p1()
56 if pt1.obsolete(): 56 if pt1.obsolete():
57 pt1 = self._repo[_singlesuccessor(self._repo, pt1)] 57 pt1 = self._repo[_singlesuccessor(self._repo, pt1)]
58 revs.insert(0, pt1.rev()) 58 revs.insert(0, pt1.rev())
59 return revs 59 return revs
60
61 def getstack(repo, branch=None, topic=None):
62 # XXX need sorting
63 return stack(repo, branch=branch, topic = topic)
64 60
65 def labelsgen(prefix, labelssuffix): 61 def labelsgen(prefix, labelssuffix):
66 """ Takes a label prefix and a list of suffixes. Returns a string of the prefix 62 """ Takes a label prefix and a list of suffixes. Returns a string of the prefix
67 formatted with each suffix separated with a space. 63 formatted with each suffix separated with a space.
68 """ 64 """
122 elif data['behindcount']: 118 elif data['behindcount']:
123 fm.plain(', ') 119 fm.plain(', ')
124 fm.plain('%d behind' % data['behindcount'], label='topic.stack.summary.behindcount') 120 fm.plain('%d behind' % data['behindcount'], label='topic.stack.summary.behindcount')
125 fm.plain('\n') 121 fm.plain('\n')
126 122
127 for idx, r in enumerate(getstack(repo, branch=branch, topic=topic), 0): 123 for idx, r in enumerate(stack(repo, branch=branch, topic=topic), 0):
128 ctx = repo[r] 124 ctx = repo[r]
129 # special case for t0, b0 as it's hard to plugin into rest of the logic 125 # special case for t0, b0 as it's hard to plugin into rest of the logic
130 if idx == 0: 126 if idx == 0:
131 # t0, b0 can be None 127 # t0, b0 can be None
132 if r == -1: 128 if r == -1:
199 :troubledcount: number on troubled changesets 195 :troubledcount: number on troubled changesets
200 :headcount: number of heads on the topic 196 :headcount: number of heads on the topic
201 :behindcount: number of changeset on rebase destination 197 :behindcount: number of changeset on rebase destination
202 """ 198 """
203 data = {} 199 data = {}
204 revs = getstack(repo, branch, topic)[1:] 200 revs = stack(repo, branch, topic)[1:]
205 data['changesetcount'] = len(revs) 201 data['changesetcount'] = len(revs)
206 data['troubledcount'] = len([r for r in revs if repo[r].isunstable()]) 202 data['troubledcount'] = len([r for r in revs if repo[r].isunstable()])
207 deps, rdeps = builddependencies(repo, revs) 203 deps, rdeps = builddependencies(repo, revs)
208 data['headcount'] = len([r for r in revs if not rdeps[r]]) 204 data['headcount'] = len([r for r in revs if not rdeps[r]])
209 data['behindcount'] = 0 205 data['behindcount'] = 0