##// END OF EJS Templates
check-code: catch misspellings of descendant...
Matt Mackall -
r14549:48ec0763 default
parent child Browse files
Show More
@@ -177,6 +177,7 b' pypats = ['
177 "always assign an opened file to a variable, and close it afterwards"),
177 "always assign an opened file to a variable, and close it afterwards"),
178 (r'[\s\(](open|file)\([^)]*\)\.',
178 (r'[\s\(](open|file)\([^)]*\)\.',
179 "always assign an opened file to a variable, and close it afterwards"),
179 "always assign an opened file to a variable, and close it afterwards"),
180 (r'(?i)descendent', "the proper spelling is descendAnt"),
180 ],
181 ],
181 # warnings
182 # warnings
182 [
183 [
@@ -1456,7 +1456,7 b' class localrepository(repo.repository):'
1456
1456
1457 def changegroupsubset(self, bases, heads, source):
1457 def changegroupsubset(self, bases, heads, source):
1458 """Compute a changegroup consisting of all the nodes that are
1458 """Compute a changegroup consisting of all the nodes that are
1459 descendents of any of the bases and ancestors of any of the heads.
1459 descendants of any of the bases and ancestors of any of the heads.
1460 Return a chunkbuffer object whose read() method will return
1460 Return a chunkbuffer object whose read() method will return
1461 successive changegroup chunks.
1461 successive changegroup chunks.
1462
1462
@@ -491,7 +491,7 b' class revlog(object):'
491 return nonodes
491 return nonodes
492 lowestrev = min([self.rev(n) for n in roots])
492 lowestrev = min([self.rev(n) for n in roots])
493 else:
493 else:
494 roots = [nullid] # Everybody's a descendent of nullid
494 roots = [nullid] # Everybody's a descendant of nullid
495 lowestrev = nullrev
495 lowestrev = nullrev
496 if (lowestrev == nullrev) and (heads is None):
496 if (lowestrev == nullrev) and (heads is None):
497 # We want _all_ the nodes!
497 # We want _all_ the nodes!
@@ -528,7 +528,7 b' class revlog(object):'
528 r = self.rev(n)
528 r = self.rev(n)
529 if r >= lowestrev:
529 if r >= lowestrev:
530 if n not in ancestors:
530 if n not in ancestors:
531 # If we are possibly a descendent of one of the roots
531 # If we are possibly a descendant of one of the roots
532 # and we haven't already been marked as an ancestor
532 # and we haven't already been marked as an ancestor
533 ancestors.add(n) # Mark as ancestor
533 ancestors.add(n) # Mark as ancestor
534 # Add non-nullid parents to list of nodes to tag.
534 # Add non-nullid parents to list of nodes to tag.
@@ -562,41 +562,41 b' class revlog(object):'
562 lowestrev = nullrev
562 lowestrev = nullrev
563 roots = [nullid]
563 roots = [nullid]
564 # Transform our roots list into a set.
564 # Transform our roots list into a set.
565 descendents = set(roots)
565 descendants = set(roots)
566 # Also, keep the original roots so we can filter out roots that aren't
566 # Also, keep the original roots so we can filter out roots that aren't
567 # 'real' roots (i.e. are descended from other roots).
567 # 'real' roots (i.e. are descended from other roots).
568 roots = descendents.copy()
568 roots = descendants.copy()
569 # Our topologically sorted list of output nodes.
569 # Our topologically sorted list of output nodes.
570 orderedout = []
570 orderedout = []
571 # Don't start at nullid since we don't want nullid in our output list,
571 # Don't start at nullid since we don't want nullid in our output list,
572 # and if nullid shows up in descedents, empty parents will look like
572 # and if nullid shows up in descedents, empty parents will look like
573 # they're descendents.
573 # they're descendants.
574 for r in xrange(max(lowestrev, 0), highestrev + 1):
574 for r in xrange(max(lowestrev, 0), highestrev + 1):
575 n = self.node(r)
575 n = self.node(r)
576 isdescendent = False
576 isdescendant = False
577 if lowestrev == nullrev: # Everybody is a descendent of nullid
577 if lowestrev == nullrev: # Everybody is a descendant of nullid
578 isdescendent = True
578 isdescendant = True
579 elif n in descendents:
579 elif n in descendants:
580 # n is already a descendent
580 # n is already a descendant
581 isdescendent = True
581 isdescendant = True
582 # This check only needs to be done here because all the roots
582 # This check only needs to be done here because all the roots
583 # will start being marked is descendents before the loop.
583 # will start being marked is descendants before the loop.
584 if n in roots:
584 if n in roots:
585 # If n was a root, check if it's a 'real' root.
585 # If n was a root, check if it's a 'real' root.
586 p = tuple(self.parents(n))
586 p = tuple(self.parents(n))
587 # If any of its parents are descendents, it's not a root.
587 # If any of its parents are descendants, it's not a root.
588 if (p[0] in descendents) or (p[1] in descendents):
588 if (p[0] in descendants) or (p[1] in descendants):
589 roots.remove(n)
589 roots.remove(n)
590 else:
590 else:
591 p = tuple(self.parents(n))
591 p = tuple(self.parents(n))
592 # A node is a descendent if either of its parents are
592 # A node is a descendant if either of its parents are
593 # descendents. (We seeded the dependents list with the roots
593 # descendants. (We seeded the dependents list with the roots
594 # up there, remember?)
594 # up there, remember?)
595 if (p[0] in descendents) or (p[1] in descendents):
595 if (p[0] in descendants) or (p[1] in descendants):
596 descendents.add(n)
596 descendants.add(n)
597 isdescendent = True
597 isdescendant = True
598 if isdescendent and ((ancestors is None) or (n in ancestors)):
598 if isdescendant and ((ancestors is None) or (n in ancestors)):
599 # Only include nodes that are both descendents and ancestors.
599 # Only include nodes that are both descendants and ancestors.
600 orderedout.append(n)
600 orderedout.append(n)
601 if (ancestors is not None) and (n in heads):
601 if (ancestors is not None) and (n in heads):
602 # We're trying to figure out which heads are reachable
602 # We're trying to figure out which heads are reachable
@@ -211,7 +211,7 b' class Merge3Text(object):'
211 Method is as follows:
211 Method is as follows:
212
212
213 The two sequences align only on regions which match the base
213 The two sequences align only on regions which match the base
214 and both descendents. These are found by doing a two-way diff
214 and both descendants. These are found by doing a two-way diff
215 of each one against the base, and then finding the
215 of each one against the base, and then finding the
216 intersections between those regions. These "sync regions"
216 intersections between those regions. These "sync regions"
217 are by definition unchanged in both and easily dealt with.
217 are by definition unchanged in both and easily dealt with.
@@ -315,7 +315,7 b' class Merge3Text(object):'
315 mismatch_region = staticmethod(mismatch_region)
315 mismatch_region = staticmethod(mismatch_region)
316
316
317 def find_sync_regions(self):
317 def find_sync_regions(self):
318 """Return a list of sync regions, where both descendents match the base.
318 """Return a list of sync regions, where both descendants match the base.
319
319
320 Generates a list of (base1, base2, a1, a2, b1, b2). There is
320 Generates a list of (base1, base2, a1, a2, b1, b2). There is
321 always a zero-length sync region at the end of all the files.
321 always a zero-length sync region at the end of all the files.
General Comments 0
You need to be logged in to leave comments. Login now