##// END OF EJS Templates
copies: use set instead of dict
Benoit Boissinot -
r8468:b35d11d1 default
parent child Browse files
Show More
@@ -20,18 +20,18 b' def _dirname(f):'
20 20 return f[:s]
21 21
22 22 def _dirs(files):
23 d = {}
23 d = set()
24 24 for f in files:
25 25 f = _dirname(f)
26 26 while f not in d:
27 d[f] = True
27 d.add(f)
28 28 f = _dirname(f)
29 29 return d
30 30
31 31 def _findoldnames(fctx, limit):
32 32 "find files that path was copied from, back to linkrev limit"
33 33 old = {}
34 seen = {}
34 seen = set()
35 35 orig = fctx.path()
36 36 visit = [(fctx, 0)]
37 37 while visit:
@@ -39,7 +39,7 b' def _findoldnames(fctx, limit):'
39 39 s = str(fc)
40 40 if s in seen:
41 41 continue
42 seen[s] = 1
42 seen.add(s)
43 43 if fc.path() != orig and fc.path() not in old:
44 44 old[fc.path()] = (depth, fc.path()) # remember depth
45 45 if fc.rev() < limit and fc.rev() is not None:
@@ -184,7 +184,7 b' def copies(repo, c1, c2, ca, checkdirs=F'
184 184
185 185 # generate a directory move map
186 186 d1, d2 = _dirs(m1), _dirs(m2)
187 invalid = {}
187 invalid = set()
188 188 dirmove = {}
189 189
190 190 # examine each file copy for a potential directory move, which is
@@ -196,13 +196,13 b' def copies(repo, c1, c2, ca, checkdirs=F'
196 196 continue
197 197 elif dsrc in d1 and ddst in d1:
198 198 # directory wasn't entirely moved locally
199 invalid[dsrc] = True
199 invalid.add(dsrc)
200 200 elif dsrc in d2 and ddst in d2:
201 201 # directory wasn't entirely moved remotely
202 invalid[dsrc] = True
202 invalid.add(dsrc)
203 203 elif dsrc in dirmove and dirmove[dsrc] != ddst:
204 204 # files from the same directory moved to two different places
205 invalid[dsrc] = True
205 invalid.add(dsrc)
206 206 else:
207 207 # looks good so far
208 208 dirmove[dsrc + "/"] = ddst + "/"
General Comments 0
You need to be logged in to leave comments. Login now