302 makemap, |
302 makemap, |
303 lambda k: b'%s=%s' % (k, stringutil.escapestr(extras[k])), |
303 lambda k: b'%s=%s' % (k, stringutil.escapestr(extras[k])), |
304 ) |
304 ) |
305 |
305 |
306 |
306 |
|
307 @templatekeyword(b'_fast_rank', requires={b'ctx'}) |
|
308 def fast_rank(context, mapping): |
|
309 """the rank of a changeset if cached |
|
310 |
|
311 The rank of a revision is the size of the sub-graph it defines as a head. |
|
312 Equivalently, the rank of a revision `r` is the size of the set |
|
313 `ancestors(r)`, `r` included. |
|
314 """ |
|
315 ctx = context.resource(mapping, b'ctx') |
|
316 rank = ctx.fast_rank() |
|
317 if rank is None: |
|
318 return None |
|
319 return b"%d" % rank |
|
320 |
|
321 |
307 def _getfilestatus(context, mapping, listall=False): |
322 def _getfilestatus(context, mapping, listall=False): |
308 ctx = context.resource(mapping, b'ctx') |
323 ctx = context.resource(mapping, b'ctx') |
309 revcache = context.resource(mapping, b'revcache') |
324 revcache = context.resource(mapping, b'revcache') |
310 if b'filestatus' not in revcache or revcache[b'filestatusall'] < listall: |
325 if b'filestatus' not in revcache or revcache[b'filestatusall'] < listall: |
311 stat = ctx.p1().status( |
326 stat = ctx.p1().status( |