##// 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 # TODO: maybe this can be a wrapper class for changectx/filectx list, which
184 # TODO: maybe this can be a wrapper class for changectx/filectx list, which
185 # yields {'ctx': ctx}
185 # yields {'ctx': ctx}
186 def _ctxsgen(ctxs):
186 def _ctxsgen(context, ctxs):
187 for s in ctxs:
187 for s in ctxs:
188 d = {
188 d = {
189 'node': s.hex(),
189 'node': s.hex(),
@@ -197,19 +197,13 b' def _ctxsgen(ctxs):'
197 d['file'] = s.path()
197 d['file'] = s.path()
198 yield d
198 yield d
199
199
200 class _siblings(object):
200 def _siblings(siblings=None, hiderev=None):
201 def __init__(self, siblings=None, hiderev=None):
201 if siblings is None:
202 if siblings is None:
202 siblings = []
203 siblings = []
203 siblings = [s for s in siblings if s.node() != nullid]
204 self.siblings = [s for s in siblings if s.node() != nullid]
204 if len(siblings) == 1 and siblings[0].rev() == hiderev:
205 if len(self.siblings) == 1 and self.siblings[0].rev() == hiderev:
205 siblings = []
206 self.siblings = []
206 return templateutil.mappinggenerator(_ctxsgen, args=(siblings,))
207
208 def __iter__(self):
209 return _ctxsgen(self.siblings)
210
211 def __len__(self):
212 return len(self.siblings)
213
207
214 def difffeatureopts(req, ui, section):
208 def difffeatureopts(req, ui, section):
215 diffopts = patch.difffeatureopts(ui, untrusted=True,
209 diffopts = patch.difffeatureopts(ui, untrusted=True,
General Comments 0
You need to be logged in to leave comments. Login now