[PATCH 03 of 19] localrepo: use _manifestmatches instead of duplicating logic
Sean Farley
sean.michael.farley at gmail.com
Thu May 15 21:16:21 UTC 2014
# HG changeset patch
# User Sean Farley <sean.michael.farley at gmail.com>
# Date 1394581124 18000
# Tue Mar 11 18:38:44 2014 -0500
# Node ID 92f56bf667e28d86f35448852f482cf4085b46f9
# Parent 4f3d70781a6031841ed191b360b7971af948977f
localrepo: use _manifestmatches instead of duplicating logic
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1506,19 +1506,10 @@ class localrepository(object):
If node1 is None, use the first dirstate parent instead.
If node2 is None, compare node1 with working directory.
"""
- def mfmatches(ctx):
- mf = ctx.manifest().copy()
- if match.always():
- return mf
- for fn in mf.keys():
- if not match(fn):
- del mf[fn]
- return mf
-
ctx1 = self[node1]
ctx2 = self[node2]
# This next code block is, admittedly, fragile logic that tests for
# reversing the contexts and wouldn't need to exist if it weren't for
@@ -1561,25 +1552,25 @@ class localrepository(object):
clean=listclean, unknown=listunknown)
modified, added, removed, deleted, unknown, ignored, clean = r
if not parentworking:
- mf1 = mfmatches(ctx1)
+ mf1 = ctx1._manifestmatches(match, r)
if working:
# we are comparing working dir against non-parent
# generate a pseudo-manifest for the working dir
- mf2 = mfmatches(self['.'])
+ mf2 = self['.']._manifestmatches(match, r)
for f in modified + added:
mf2[f] = None
mf2.set(f, ctx2.flags(f))
for f in removed:
if f in mf2:
del mf2[f]
else:
# we are comparing two revisions
deleted, unknown, ignored = [], [], []
- mf2 = mfmatches(ctx2)
+ mf2 = ctx2._manifestmatches(match, r)
modified, added, clean = [], [], []
withflags = mf1.withflags() | mf2.withflags()
for fn, mf2node in mf2.iteritems():
if fn in mf1:
More information about the Mercurial-devel
mailing list