Mercurial > public > mercurial-scm > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
44547:81a873477feb | 44548:fdc802f29b2c |
---|---|
2056 def reportphasechanges(repo, tr): | 2056 def reportphasechanges(repo, tr): |
2057 """Report statistics of phase changes for changesets pre-existing | 2057 """Report statistics of phase changes for changesets pre-existing |
2058 pull/unbundle. | 2058 pull/unbundle. |
2059 """ | 2059 """ |
2060 origrepolen = tr.changes.get(b'origrepolen', len(repo)) | 2060 origrepolen = tr.changes.get(b'origrepolen', len(repo)) |
2061 phasetracking = tr.changes.get(b'phases', {}) | 2061 published = [] |
2062 if not phasetracking: | 2062 for revs, (old, new) in tr.changes.get(b'phases', []): |
2063 return | 2063 if new != phases.public: |
2064 published = [ | 2064 continue |
2065 rev | 2065 published.extend(rev for rev in revs if rev < origrepolen) |
2066 for rev, (old, new) in pycompat.iteritems(phasetracking) | |
2067 if new == phases.public and rev < origrepolen | |
2068 ] | |
2069 if not published: | 2066 if not published: |
2070 return | 2067 return |
2071 msg = _(b'%d local changesets published\n') | 2068 msg = _(b'%d local changesets published\n') |
2072 if as_validator: | 2069 if as_validator: |
2073 msg = _(b'%d local changesets will be published\n') | 2070 msg = _(b'%d local changesets will be published\n') |