context: use new manifest.diff(clean=True) support
This further simplifies the status code.
This simplification comes at a slight performance cost for `hg
export`. Before, on mozilla-central:
perfmanifest tip
! wall 0.265977 comb 0.260000 user 0.240000 sys 0.020000 (best of 38)
perftags
! result: 162
! wall 0.007172 comb 0.010000 user 0.000000 sys 0.010000 (best of 403)
perfstatus
! wall 0.422302 comb 0.420000 user 0.260000 sys 0.160000 (best of 24)
hgperf export tip
! wall 0.148706 comb 0.150000 user 0.150000 sys 0.000000 (best of 65)
after, same repo:
perfmanifest tip
! wall 0.267143 comb 0.270000 user 0.250000 sys 0.020000 (best of 37)
perftags
! result: 162
! wall 0.006943 comb 0.010000 user 0.000000 sys 0.010000 (best of 397)
perfstatus
! wall 0.411198 comb 0.410000 user 0.260000 sys 0.150000 (best of 24)
hgperf export tip
! wall 0.173229 comb 0.170000 user 0.170000 sys 0.000000 (best of 55)
The next set of patches introduces a new manifest type implemented
almost entirely in C, and more than makes up for the performance hit
incurred in this change.
--- a/mercurial/context.py Mon Dec 15 16:04:28 2014 -0500
+++ b/mercurial/context.py Mon Dec 15 16:06:04 2014 -0500
@@ -137,13 +137,17 @@
modified, added = [], []
removed = []
- clean = set()
+ clean = []
deleted, unknown, ignored = s.deleted, s.unknown, s.ignored
deletedset = set(deleted)
- d = mf1.diff(mf2)
- for fn, ((node1, flag1), (node2, flag2)) in d.iteritems():
+ d = mf1.diff(mf2, clean=listclean)
+ for fn, value in d.iteritems():
if fn in deletedset:
continue
+ if value is None:
+ clean.append(fn)
+ continue
+ (node1, flag1), (node2, flag2) = value
if node1 is None:
added.append(fn)
elif node2 is None:
@@ -157,12 +161,7 @@
# match the one in mf1.
modified.append(fn)
else:
- clean.add(fn)
- if listclean:
- nondiff = (set(mf1) | set(mf2)) - set(d)
- clean = list((clean | nondiff) - deletedset)
- else:
- clean = []
+ clean.append(fn)
if removed:
# need to filter files if they are already reported as removed