comparison mercurial/scmutil.py @ 33352:967ac37f3d45

cleanupnode: do not use generator for node mapping The 'successors' part of the mappings used of be a tuple. This avoid issue from code consuming the generator "by mistake". For example, an extension inspecting the mapping content used to be able to iterate over the successors mapping without consequence. Since the mapping are small we do not expect any performance impact we use tuple again for this.
author Octobus <contact@octobus.net>
date Sun, 09 Jul 2017 15:11:19 +0200
parents 4bae3c117b57
children 0407a51b9d8c
comparison
equal deleted inserted replaced
33351:154298576d44 33352:967ac37f3d45
636 # Unfiltered repo is needed since nodes in mapping might be hidden. 636 # Unfiltered repo is needed since nodes in mapping might be hidden.
637 unfi = repo.unfiltered() 637 unfi = repo.unfiltered()
638 isobs = unfi.obsstore.successors.__contains__ 638 isobs = unfi.obsstore.successors.__contains__
639 torev = unfi.changelog.rev 639 torev = unfi.changelog.rev
640 sortfunc = lambda ns: torev(ns[0]) 640 sortfunc = lambda ns: torev(ns[0])
641 rels = [(unfi[n], (unfi[m] for m in s)) 641 rels = [(unfi[n], tuple(unfi[m] for m in s))
642 for n, s in sorted(mapping.items(), key=sortfunc) 642 for n, s in sorted(mapping.items(), key=sortfunc)
643 if s or not isobs(n)] 643 if s or not isobs(n)]
644 obsolete.createmarkers(repo, rels, operation=operation) 644 obsolete.createmarkers(repo, rels, operation=operation)
645 else: 645 else:
646 from . import repair # avoid import cycle 646 from . import repair # avoid import cycle