##// END OF EJS Templates
mq: use sets instead of lists for speed...
Nicolas Dumazet -
r12948:de6a28ff default
parent child Browse files
Show More
@@ -1289,6 +1289,9 b' class queue(object):'
1289 else:
1289 else:
1290 match = cmdutil.matchall(repo)
1290 match = cmdutil.matchall(repo)
1291 m, a, r, d = repo.status(match=match)[:4]
1291 m, a, r, d = repo.status(match=match)[:4]
1292 mm = set(mm)
1293 aa = set(aa)
1294 dd = set(dd)
1292
1295
1293 # we might end up with files that were added between
1296 # we might end up with files that were added between
1294 # qtip and the dirstate parent, but then changed in the
1297 # qtip and the dirstate parent, but then changed in the
@@ -1296,31 +1299,31 b' class queue(object):'
1296 # show up in the added section
1299 # show up in the added section
1297 for x in m:
1300 for x in m:
1298 if x not in aa:
1301 if x not in aa:
1299 mm.append(x)
1302 mm.add(x)
1300 # we might end up with files added by the local dirstate that
1303 # we might end up with files added by the local dirstate that
1301 # were deleted by the patch. In this case, they should only
1304 # were deleted by the patch. In this case, they should only
1302 # show up in the changed section.
1305 # show up in the changed section.
1303 for x in a:
1306 for x in a:
1304 if x in dd:
1307 if x in dd:
1305 del dd[dd.index(x)]
1308 dd.remove(x)
1306 mm.append(x)
1309 mm.add(x)
1307 else:
1310 else:
1308 aa.append(x)
1311 aa.add(x)
1309 # make sure any files deleted in the local dirstate
1312 # make sure any files deleted in the local dirstate
1310 # are not in the add or change column of the patch
1313 # are not in the add or change column of the patch
1311 forget = []
1314 forget = []
1312 for x in d + r:
1315 for x in d + r:
1313 if x in aa:
1316 if x in aa:
1314 del aa[aa.index(x)]
1317 aa.remove(x)
1315 forget.append(x)
1318 forget.append(x)
1316 continue
1319 continue
1317 elif x in mm:
1320 else:
1318 del mm[mm.index(x)]
1321 mm.discard(x)
1319 dd.append(x)
1322 dd.add(x)
1320
1323
1321 m = list(set(mm))
1324 m = list(mm)
1322 r = list(set(dd))
1325 r = list(dd)
1323 a = list(set(aa))
1326 a = list(aa)
1324 c = [filter(matchfn, l) for l in (m, a, r)]
1327 c = [filter(matchfn, l) for l in (m, a, r)]
1325 match = cmdutil.matchfiles(repo, set(c[0] + c[1] + c[2]))
1328 match = cmdutil.matchfiles(repo, set(c[0] + c[1] + c[2]))
1326 chunks = patch.diff(repo, patchparent, match=match,
1329 chunks = patch.diff(repo, patchparent, match=match,
General Comments 0
You need to be logged in to leave comments. Login now