Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/templateutil.py @ 44599:1f81f680912f
templater: remember cache key of evaluated revset
This provides a hint for caching further computation result of the given
revset. See the next patch for example.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 15 Mar 2020 16:00:45 +0900 |
parents | e3e44e6e7245 |
children | d4ba4d51f85f |
comparison
equal
deleted
inserted
replaced
44598:e3e44e6e7245 | 44599:1f81f680912f |
---|---|
412 class revslist(wrapped): | 412 class revslist(wrapped): |
413 """Wrapper for a smartset (a list/set of revision numbers) | 413 """Wrapper for a smartset (a list/set of revision numbers) |
414 | 414 |
415 If name specified, the revs will be rendered with the old-style list | 415 If name specified, the revs will be rendered with the old-style list |
416 template of the given name by default. | 416 template of the given name by default. |
417 """ | 417 |
418 | 418 The cachekey provides a hint to cache further computation on this |
419 def __init__(self, repo, revs, name=None): | 419 smartset. If the underlying smartset is dynamically created, the cachekey |
420 should be None. | |
421 """ | |
422 | |
423 def __init__(self, repo, revs, name=None, cachekey=None): | |
420 assert isinstance(revs, smartset.abstractsmartset) | 424 assert isinstance(revs, smartset.abstractsmartset) |
421 self._repo = repo | 425 self._repo = repo |
422 self._revs = revs | 426 self._revs = revs |
423 self._name = name | 427 self._name = name |
428 self.cachekey = cachekey | |
424 | 429 |
425 def contains(self, context, mapping, item): | 430 def contains(self, context, mapping, item): |
426 rev = unwrapinteger(context, mapping, item) | 431 rev = unwrapinteger(context, mapping, item) |
427 return rev in self._revs | 432 return rev in self._revs |
428 | 433 |