Mercurial > public > mercurial-scm > hg
diff mercurial/scmutil.py @ 39301: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 | f98d3c57906f |
children | 570fca90d556 |
line wrap: on
line diff
--- a/mercurial/scmutil.py Sat Aug 25 15:19:43 2018 +0900 +++ b/mercurial/scmutil.py Sat Aug 25 15:28:48 2018 +0900 @@ -1618,13 +1618,13 @@ @reportsummary def reportnewcs(repo, tr): """Report the range of new revisions pulled/unbundled.""" - newrevs = tr.changes.get('revs', pycompat.xrange(0, 0)) - if not newrevs: + origrepolen = tr.changes.get('origrepolen', len(repo)) + if origrepolen >= len(repo): return # Compute the bounds of new revisions' range, excluding obsoletes. unfi = repo.unfiltered() - revs = unfi.revs('%ld and not obsolete()', newrevs) + revs = unfi.revs('%d: and not obsolete()', origrepolen) if not revs: # Got only obsoletes. return @@ -1641,13 +1641,13 @@ """Report statistics of phase changes for changesets pre-existing pull/unbundle. """ - newrevs = tr.changes.get('revs', pycompat.xrange(0, 0)) + origrepolen = tr.changes.get('origrepolen', len(repo)) phasetracking = tr.changes.get('phases', {}) if not phasetracking: return published = [ rev for rev, (old, new) in phasetracking.iteritems() - if new == phases.public and rev not in newrevs + if new == phases.public and rev < origrepolen ] if not published: return