Mercurial > public > mercurial-scm > hg
comparison mercurial/revlog.py @ 30391:2ded17b64f09
revlog: avoid shadowing several variables using list comprehensions
author | Augie Fackler <augie@google.com> |
---|---|
date | Thu, 10 Nov 2016 16:34:43 -0500 |
parents | 1f92056c4066 |
children | 03fae9048fa1 |
comparison
equal
deleted
inserted
replaced
30390:bff77a693531 | 30391:2ded17b64f09 |
---|---|
595 for p in self.parentrevs(r): | 595 for p in self.parentrevs(r): |
596 if p not in has: | 596 if p not in has: |
597 visit.append(p) | 597 visit.append(p) |
598 missing = list(missing) | 598 missing = list(missing) |
599 missing.sort() | 599 missing.sort() |
600 return has, [self.node(r) for r in missing] | 600 return has, [self.node(miss) for miss in missing] |
601 | 601 |
602 def incrementalmissingrevs(self, common=None): | 602 def incrementalmissingrevs(self, common=None): |
603 """Return an object that can be used to incrementally compute the | 603 """Return an object that can be used to incrementally compute the |
604 revision numbers of the ancestors of arbitrary sets that are not | 604 revision numbers of the ancestors of arbitrary sets that are not |
605 ancestors of common. This is an ancestor.incrementalmissingancestors | 605 ancestors of common. This is an ancestor.incrementalmissingancestors |
747 if lowestrev > nullrev: | 747 if lowestrev > nullrev: |
748 # But, since we weren't, let's recompute the lowest rev to not | 748 # But, since we weren't, let's recompute the lowest rev to not |
749 # include roots that aren't ancestors. | 749 # include roots that aren't ancestors. |
750 | 750 |
751 # Filter out roots that aren't ancestors of heads | 751 # Filter out roots that aren't ancestors of heads |
752 roots = [n for n in roots if n in ancestors] | 752 roots = [root for root in roots if root in ancestors] |
753 # Recompute the lowest revision | 753 # Recompute the lowest revision |
754 if roots: | 754 if roots: |
755 lowestrev = min([self.rev(n) for n in roots]) | 755 lowestrev = min([self.rev(root) for root in roots]) |
756 else: | 756 else: |
757 # No more roots? Return empty list | 757 # No more roots? Return empty list |
758 return nonodes | 758 return nonodes |
759 else: | 759 else: |
760 # We are descending from nullid, and don't need to care about | 760 # We are descending from nullid, and don't need to care about |
809 # will eventually remove it. | 809 # will eventually remove it. |
810 heads[n] = True | 810 heads[n] = True |
811 # But, obviously its parents aren't. | 811 # But, obviously its parents aren't. |
812 for p in self.parents(n): | 812 for p in self.parents(n): |
813 heads.pop(p, None) | 813 heads.pop(p, None) |
814 heads = [n for n, flag in heads.iteritems() if flag] | 814 heads = [head for head, flag in heads.iteritems() if flag] |
815 roots = list(roots) | 815 roots = list(roots) |
816 assert orderedout | 816 assert orderedout |
817 assert roots | 817 assert roots |
818 assert heads | 818 assert heads |
819 return (orderedout, roots, heads) | 819 return (orderedout, roots, heads) |
961 except (TypeError, LookupError): | 961 except (TypeError, LookupError): |
962 pass | 962 pass |
963 | 963 |
964 def _partialmatch(self, id): | 964 def _partialmatch(self, id): |
965 try: | 965 try: |
966 n = self.index.partialmatch(id) | 966 partial = self.index.partialmatch(id) |
967 if n and self.hasnode(n): | 967 if partial and self.hasnode(partial): |
968 return n | 968 return partial |
969 return None | 969 return None |
970 except RevlogError: | 970 except RevlogError: |
971 # parsers.c radix tree lookup gave multiple matches | 971 # parsers.c radix tree lookup gave multiple matches |
972 # fast path: for unfiltered changelog, radix tree is accurate | 972 # fast path: for unfiltered changelog, radix tree is accurate |
973 if not getattr(self, 'filteredrevs', None): | 973 if not getattr(self, 'filteredrevs', None): |