Mercurial > hg
comparison hgext/narrow/narrowbundle2.py @ 36208:c407ccd06abd
narrow: only diff manifest part within narrowspec when generating changegroup
Since 959ebff3505a (manifest: add match argument to diff and
filesnotin, 2017-03-07), we have a more efficient way of diffing
manifests while applying a matcher. Let's use that while generating
narrowed changegroups, so we avoid diffing parts of the manifest that
don't match the narrowspec.
Differential Revision: https://phab.mercurial-scm.org/D2233
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Tue, 13 Feb 2018 13:16:06 -0800 |
parents | 4224f26c0d35 |
children | 2ad527f7d27a |
comparison
equal
deleted
inserted
replaced
36207:cc46e68f050f | 36208:c407ccd06abd |
---|---|
139 if ps: | 139 if ps: |
140 # We choose to not trust the changed files list in | 140 # We choose to not trust the changed files list in |
141 # changesets because it's not always correct. TODO: could | 141 # changesets because it's not always correct. TODO: could |
142 # we trust it for the non-merge case? | 142 # we trust it for the non-merge case? |
143 p1mf = mfl[cl.changelogrevision(ps[0]).manifest].read() | 143 p1mf = mfl[cl.changelogrevision(ps[0]).manifest].read() |
144 needed = any(match(f) for f in curmf.diff(p1mf).iterkeys()) | 144 needed = bool(curmf.diff(p1mf, match)) |
145 if not needed and len(ps) > 1: | 145 if not needed and len(ps) > 1: |
146 # For merge changes, the list of changed files is not | 146 # For merge changes, the list of changed files is not |
147 # helpful, since we need to emit the merge if a file | 147 # helpful, since we need to emit the merge if a file |
148 # in the narrow spec has changed on either side of the | 148 # in the narrow spec has changed on either side of the |
149 # merge. As a result, we do a manifest diff to check. | 149 # merge. As a result, we do a manifest diff to check. |
150 p2mf = mfl[cl.changelogrevision(ps[1]).manifest].read() | 150 p2mf = mfl[cl.changelogrevision(ps[1]).manifest].read() |
151 needed = any(match(f) for f in curmf.diff(p2mf).iterkeys()) | 151 needed = bool(curmf.diff(p2mf, match)) |
152 else: | 152 else: |
153 # For a root node, we need to include the node if any | 153 # For a root node, we need to include the node if any |
154 # files in the node match the narrowspec. | 154 # files in the node match the narrowspec. |
155 needed = any(match(f) for f in curmf) | 155 needed = any(match(f) for f in curmf) |
156 | 156 |