Mercurial > public > mercurial-scm > hg-stable
diff mercurial/changelog.py @ 39328:5763216ba311
transaction: remember original len(repo) instead of tracking added revs (API)
It's silly to keep updating xrange(len(changelog), len(changelog) + 1) for
each added revision. Instead, let's simply remember the first revision to
be added.
The test output slightly changed as the branch cache is also warmed up by
stream clone, which seems more consistent.
.. api::
``tr.changes['revs']`` is replaced by ``tr.changes['origrepolen']`` which
is the first revision number to be added.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 25 Aug 2018 15:28:48 +0900 |
parents | 0a5b20c107a6 |
children | b63dee7bd0d9 |
line wrap: on
line diff
--- a/mercurial/changelog.py Sat Aug 25 15:19:43 2018 +0900 +++ b/mercurial/changelog.py Sat Aug 25 15:28:48 2018 +0900 @@ -545,19 +545,3 @@ just to access this is costly.""" extra = self.read(rev)[5] return encoding.tolocal(extra.get("branch")), 'close' in extra - - def _addrevision(self, node, rawtext, transaction, *args, **kwargs): - # overlay over the standard revlog._addrevision to track the new - # revision on the transaction. - rev = len(self) - node = super(changelog, self)._addrevision(node, rawtext, transaction, - *args, **kwargs) - revs = transaction.changes.get('revs') - if revs is not None: - if revs: - assert revs[-1] + 1 == rev - revs = pycompat.membershiprange(revs[0], rev + 1) - else: - revs = pycompat.membershiprange(rev, rev + 1) - transaction.changes['revs'] = revs - return node