comparison mercurial/context.py @ 9973:d1319ad5071b

context: use key-sorting instead of tuples
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Tue, 01 Dec 2009 01:03:54 +0100
parents d1043c2ffe6c
children da5209afe1bc
comparison
equal deleted inserted replaced
9972:f603299ffa7a 9973:d1319ad5071b
431 needed[p] += 1 431 needed[p] += 1
432 432
433 # sort by revision (per file) which is a topological order 433 # sort by revision (per file) which is a topological order
434 visit = [] 434 visit = []
435 for f in files: 435 for f in files:
436 fn = [(n.rev(), n) for n in needed if n._path == f] 436 visit.extend(n for n in needed if n._path == f)
437 visit.extend(fn)
438 437
439 hist = {} 438 hist = {}
440 for r, f in sorted(visit): 439 for f in sorted(visit, key=lambda x: x.rev()):
441 curr = decorate(f.data(), f) 440 curr = decorate(f.data(), f)
442 for p in parents(f): 441 for p in parents(f):
443 if p != nullid: 442 if p != nullid:
444 curr = pair(hist[p], curr) 443 curr = pair(hist[p], curr)
445 # trim the history of unneeded revs 444 # trim the history of unneeded revs