Mercurial > hg
changeset 24184:cd66080ef6d4
copies: move code into new manifestdict.filesnotin() method
copies._computeforwardmissing() finds files in one context that is not
in the other. Let's move this code into a new method on manifestdict,
so m1.filesnotin(m2) can be optimized for various types of manifests
(we expect more types of manifests soon).
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 27 Feb 2015 13:57:37 -0800 |
parents | 932de135041f |
children | 3a3806fe3ddf |
files | mercurial/copies.py mercurial/manifest.py |
diffstat | 2 files changed, 7 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/copies.py Fri Feb 27 23:30:42 2015 -0500 +++ b/mercurial/copies.py Fri Feb 27 13:57:37 2015 -0800 @@ -149,9 +149,7 @@ This is its own function so extensions can easily wrap this call to see what files _forwardcopies is about to process. """ - missing = set(b.manifest().iterkeys()) - missing.difference_update(a.manifest().iterkeys()) - return missing + return b.manifest().filesnotin(a.manifest()) def _forwardcopies(a, b): '''find {dst@b: src@a} copy mapping where a is an ancestor of b'''
--- a/mercurial/manifest.py Fri Feb 27 23:30:42 2015 -0500 +++ b/mercurial/manifest.py Fri Feb 27 13:57:37 2015 -0800 @@ -38,6 +38,12 @@ ret._flags[fn] = flags return ret + def filesnotin(self, m2): + '''Set of files in this manifest that are not in the other''' + files = set(self.iterkeys()) + files.difference_update(m2.iterkeys()) + return files + def matches(self, match): '''generate a new manifest filtered by the match argument''' if match.always():