##// END OF EJS Templates
hgweb: extract a generator function of _siblings class...
Yuya Nishihara -
r37717:0e02eb83 default
parent child Browse files
Show More
@@ -181,6 +181,22 b' class filerevnav(revnav):'
181 181 def hex(self, rev):
182 182 return hex(self._changelog.node(self._revlog.linkrev(rev)))
183 183
184 # TODO: maybe this can be a wrapper class for changectx/filectx list, which
185 # yields {'ctx': ctx}
186 def _ctxsgen(ctxs):
187 for s in ctxs:
188 d = {
189 'node': s.hex(),
190 'rev': s.rev(),
191 'user': s.user(),
192 'date': s.date(),
193 'description': s.description(),
194 'branch': s.branch(),
195 }
196 if util.safehasattr(s, 'path'):
197 d['file'] = s.path()
198 yield d
199
184 200 class _siblings(object):
185 201 def __init__(self, siblings=None, hiderev=None):
186 202 if siblings is None:
@@ -190,18 +206,7 b' class _siblings(object):'
190 206 self.siblings = []
191 207
192 208 def __iter__(self):
193 for s in self.siblings:
194 d = {
195 'node': s.hex(),
196 'rev': s.rev(),
197 'user': s.user(),
198 'date': s.date(),
199 'description': s.description(),
200 'branch': s.branch(),
201 }
202 if util.safehasattr(s, 'path'):
203 d['file'] = s.path()
204 yield d
209 return _ctxsgen(self.siblings)
205 210
206 211 def __len__(self):
207 212 return len(self.siblings)
General Comments 0
You need to be logged in to leave comments. Login now