comparison mercurial/changelog.py @ 32262:85ef5a073114

transaction: track newly introduced revisions Tracking revisions is not the data that will unlock the most new capability. However, they are the simplest thing to track and still unlock some nice improvements in regard with caching. We plug ourself at the changelog level to make sure we do not miss any revision additions. The 'revs' set is configured at the repository level because the transaction itself does not needs to know that much about the business logic.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Tue, 02 May 2017 18:45:51 +0200
parents 6f173560c7f4
children 0ad0d26ff703
comparison
equal deleted inserted replaced
32261:976681123416 32262:85ef5a073114
533 533
534 This function exists because creating a changectx object 534 This function exists because creating a changectx object
535 just to access this is costly.""" 535 just to access this is costly."""
536 extra = self.read(rev)[5] 536 extra = self.read(rev)[5]
537 return encoding.tolocal(extra.get("branch")), 'close' in extra 537 return encoding.tolocal(extra.get("branch")), 'close' in extra
538
539 def _addrevision(self, node, rawtext, transaction, *args, **kwargs):
540 # overlay over the standard revlog._addrevision to track the new
541 # revision on the transaction.
542 rev = len(self)
543 node = super(changelog, self)._addrevision(node, rawtext, transaction,
544 *args, **kwargs)
545 revs = transaction.changes.get('revs')
546 if revs is not None:
547 revs.add(rev)
548 return node