##// END OF EJS Templates
hgweb: convert _siblings to a factory function of mappinggenerator...
Yuya Nishihara -
r37718:495fbeae default
parent child Browse files
Show More
@@ -183,7 +183,7 b' class filerevnav(revnav):'
183 183
184 184 # TODO: maybe this can be a wrapper class for changectx/filectx list, which
185 185 # yields {'ctx': ctx}
186 def _ctxsgen(ctxs):
186 def _ctxsgen(context, ctxs):
187 187 for s in ctxs:
188 188 d = {
189 189 'node': s.hex(),
@@ -197,19 +197,13 b' def _ctxsgen(ctxs):'
197 197 d['file'] = s.path()
198 198 yield d
199 199
200 class _siblings(object):
201 def __init__(self, siblings=None, hiderev=None):
202 if siblings is None:
203 siblings = []
204 self.siblings = [s for s in siblings if s.node() != nullid]
205 if len(self.siblings) == 1 and self.siblings[0].rev() == hiderev:
206 self.siblings = []
207
208 def __iter__(self):
209 return _ctxsgen(self.siblings)
210
211 def __len__(self):
212 return len(self.siblings)
200 def _siblings(siblings=None, hiderev=None):
201 if siblings is None:
202 siblings = []
203 siblings = [s for s in siblings if s.node() != nullid]
204 if len(siblings) == 1 and siblings[0].rev() == hiderev:
205 siblings = []
206 return templateutil.mappinggenerator(_ctxsgen, args=(siblings,))
213 207
214 208 def difffeatureopts(req, ui, section):
215 209 diffopts = patch.difffeatureopts(ui, untrusted=True,
General Comments 0
You need to be logged in to leave comments. Login now