comparison mercurial/context.py @ 23757:b5346480a490

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.
author Augie Fackler <augie@google.com>
date Mon, 15 Dec 2014 16:06:04 -0500
parents d43948a910a5
children 50f0096a7346
comparison
equal deleted inserted replaced
23756:829f640b5540 23757:b5346480a490
135 mf1 = other._manifestmatches(match, s) 135 mf1 = other._manifestmatches(match, s)
136 mf2 = self._manifestmatches(match, s) 136 mf2 = self._manifestmatches(match, s)
137 137
138 modified, added = [], [] 138 modified, added = [], []
139 removed = [] 139 removed = []
140 clean = set() 140 clean = []
141 deleted, unknown, ignored = s.deleted, s.unknown, s.ignored 141 deleted, unknown, ignored = s.deleted, s.unknown, s.ignored
142 deletedset = set(deleted) 142 deletedset = set(deleted)
143 d = mf1.diff(mf2) 143 d = mf1.diff(mf2, clean=listclean)
144 for fn, ((node1, flag1), (node2, flag2)) in d.iteritems(): 144 for fn, value in d.iteritems():
145 if fn in deletedset: 145 if fn in deletedset:
146 continue 146 continue
147 if value is None:
148 clean.append(fn)
149 continue
150 (node1, flag1), (node2, flag2) = value
147 if node1 is None: 151 if node1 is None:
148 added.append(fn) 152 added.append(fn)
149 elif node2 is None: 153 elif node2 is None:
150 removed.append(fn) 154 removed.append(fn)
151 elif node2 != _newnode: 155 elif node2 != _newnode:
155 elif self[fn].cmp(other[fn]): 159 elif self[fn].cmp(other[fn]):
156 # node2 was newnode, but the working file doesn't 160 # node2 was newnode, but the working file doesn't
157 # match the one in mf1. 161 # match the one in mf1.
158 modified.append(fn) 162 modified.append(fn)
159 else: 163 else:
160 clean.add(fn) 164 clean.append(fn)
161 if listclean:
162 nondiff = (set(mf1) | set(mf2)) - set(d)
163 clean = list((clean | nondiff) - deletedset)
164 else:
165 clean = []
166 165
167 if removed: 166 if removed:
168 # need to filter files if they are already reported as removed 167 # need to filter files if they are already reported as removed
169 unknown = [fn for fn in unknown if fn not in mf1] 168 unknown = [fn for fn in unknown if fn not in mf1]
170 ignored = [fn for fn in ignored if fn not in mf1] 169 ignored = [fn for fn in ignored if fn not in mf1]