# HG changeset patch # User Martin von Zweigbergk # Date 2018-02-13 21:16:06 # Node ID c407ccd06abdd44c3d695d601907e4a6a06dfcd4 # Parent cc46e68f050fcdcfc1ece8cb8f21c7c599f0e609 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 diff --git a/hgext/narrow/narrowbundle2.py b/hgext/narrow/narrowbundle2.py --- a/hgext/narrow/narrowbundle2.py +++ b/hgext/narrow/narrowbundle2.py @@ -141,14 +141,14 @@ def _computeellipsis(repo, common, heads # changesets because it's not always correct. TODO: could # we trust it for the non-merge case? p1mf = mfl[cl.changelogrevision(ps[0]).manifest].read() - needed = any(match(f) for f in curmf.diff(p1mf).iterkeys()) + needed = bool(curmf.diff(p1mf, match)) if not needed and len(ps) > 1: # For merge changes, the list of changed files is not # helpful, since we need to emit the merge if a file # in the narrow spec has changed on either side of the # merge. As a result, we do a manifest diff to check. p2mf = mfl[cl.changelogrevision(ps[1]).manifest].read() - needed = any(match(f) for f in curmf.diff(p2mf).iterkeys()) + needed = bool(curmf.diff(p2mf, match)) else: # For a root node, we need to include the node if any # files in the node match the narrowspec.