##// 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 177 "always assign an opened file to a variable, and close it afterwards"),
178 178 (r'[\s\(](open|file)\([^)]*\)\.',
179 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 182 # warnings
182 183 [
@@ -1456,7 +1456,7 b' class localrepository(repo.repository):'
1456 1456
1457 1457 def changegroupsubset(self, bases, heads, source):
1458 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 1460 Return a chunkbuffer object whose read() method will return
1461 1461 successive changegroup chunks.
1462 1462
@@ -491,7 +491,7 b' class revlog(object):'
491 491 return nonodes
492 492 lowestrev = min([self.rev(n) for n in roots])
493 493 else:
494 roots = [nullid] # Everybody's a descendent of nullid
494 roots = [nullid] # Everybody's a descendant of nullid
495 495 lowestrev = nullrev
496 496 if (lowestrev == nullrev) and (heads is None):
497 497 # We want _all_ the nodes!
@@ -528,7 +528,7 b' class revlog(object):'
528 528 r = self.rev(n)
529 529 if r >= lowestrev:
530 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 532 # and we haven't already been marked as an ancestor
533 533 ancestors.add(n) # Mark as ancestor
534 534 # Add non-nullid parents to list of nodes to tag.
@@ -562,41 +562,41 b' class revlog(object):'
562 562 lowestrev = nullrev
563 563 roots = [nullid]
564 564 # Transform our roots list into a set.
565 descendents = set(roots)
565 descendants = set(roots)
566 566 # Also, keep the original roots so we can filter out roots that aren't
567 567 # 'real' roots (i.e. are descended from other roots).
568 roots = descendents.copy()
568 roots = descendants.copy()
569 569 # Our topologically sorted list of output nodes.
570 570 orderedout = []
571 571 # Don't start at nullid since we don't want nullid in our output list,
572 572 # and if nullid shows up in descedents, empty parents will look like
573 # they're descendents.
573 # they're descendants.
574 574 for r in xrange(max(lowestrev, 0), highestrev + 1):
575 575 n = self.node(r)
576 isdescendent = False
577 if lowestrev == nullrev: # Everybody is a descendent of nullid
578 isdescendent = True
579 elif n in descendents:
580 # n is already a descendent
581 isdescendent = True
576 isdescendant = False
577 if lowestrev == nullrev: # Everybody is a descendant of nullid
578 isdescendant = True
579 elif n in descendants:
580 # n is already a descendant
581 isdescendant = True
582 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 584 if n in roots:
585 585 # If n was a root, check if it's a 'real' root.
586 586 p = tuple(self.parents(n))
587 # If any of its parents are descendents, it's not a root.
588 if (p[0] in descendents) or (p[1] in descendents):
587 # If any of its parents are descendants, it's not a root.
588 if (p[0] in descendants) or (p[1] in descendants):
589 589 roots.remove(n)
590 590 else:
591 591 p = tuple(self.parents(n))
592 # A node is a descendent if either of its parents are
593 # descendents. (We seeded the dependents list with the roots
592 # A node is a descendant if either of its parents are
593 # descendants. (We seeded the dependents list with the roots
594 594 # up there, remember?)
595 if (p[0] in descendents) or (p[1] in descendents):
596 descendents.add(n)
597 isdescendent = True
598 if isdescendent and ((ancestors is None) or (n in ancestors)):
599 # Only include nodes that are both descendents and ancestors.
595 if (p[0] in descendants) or (p[1] in descendants):
596 descendants.add(n)
597 isdescendant = True
598 if isdescendant and ((ancestors is None) or (n in ancestors)):
599 # Only include nodes that are both descendants and ancestors.
600 600 orderedout.append(n)
601 601 if (ancestors is not None) and (n in heads):
602 602 # We're trying to figure out which heads are reachable
@@ -211,7 +211,7 b' class Merge3Text(object):'
211 211 Method is as follows:
212 212
213 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 215 of each one against the base, and then finding the
216 216 intersections between those regions. These "sync regions"
217 217 are by definition unchanged in both and easily dealt with.
@@ -315,7 +315,7 b' class Merge3Text(object):'
315 315 mismatch_region = staticmethod(mismatch_region)
316 316
317 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 320 Generates a list of (base1, base2, a1, a2, b1, b2). There is
321 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