Mercurial > public > mercurial-scm > hg
diff mercurial/scmutil.py @ 44548:fdc802f29b2c
transactions: convert changes['phases'] to list of ranges
Consecutive revisions are often in the same phase, especially public
revisions. This means that a dictionary keyed by the revision for the
phase transitions is highly redundant. Build a list of (range, (old,
new)) entries instead and aggressively merge ranges with the same
transition. For the test case in issue5691, this reduces memory use by
~20MB.
Differential Revision: https://phab.mercurial-scm.org/D8125
author | Joerg Sonnenberger <joerg@bec.de> |
---|---|
date | Fri, 08 Dec 2017 02:29:02 +0100 |
parents | 13da36d77a3f |
children | 62435a5b46fe |
line wrap: on
line diff
--- a/mercurial/scmutil.py Wed Mar 11 17:42:56 2020 +0100 +++ b/mercurial/scmutil.py Fri Dec 08 02:29:02 2017 +0100 @@ -2058,14 +2058,11 @@ pull/unbundle. """ origrepolen = tr.changes.get(b'origrepolen', len(repo)) - phasetracking = tr.changes.get(b'phases', {}) - if not phasetracking: - return - published = [ - rev - for rev, (old, new) in pycompat.iteritems(phasetracking) - if new == phases.public and rev < origrepolen - ] + published = [] + for revs, (old, new) in tr.changes.get(b'phases', []): + if new != phases.public: + continue + published.extend(rev for rev in revs if rev < origrepolen) if not published: return msg = _(b'%d local changesets published\n')