comparison mercurial/context.py @ 16599:4b73f4ba27ca

filectx: make ancestor require actx When grafting or rebasing, we need to know the target ancestor.
author Matt Mackall <mpm@selenic.com>
date Fri, 04 May 2012 17:27:14 -0500
parents bfe89d65d651
children 0c98820be15c
comparison
equal deleted inserted replaced
16592:4878914b02ab 16599:4b73f4ba27ca
632 hist[f] = curr 632 hist[f] = curr
633 pcache[f] = [] 633 pcache[f] = []
634 634
635 return zip(hist[base][0], hist[base][1].splitlines(True)) 635 return zip(hist[base][0], hist[base][1].splitlines(True))
636 636
637 def ancestor(self, fc2, actx=None): 637 def ancestor(self, fc2, actx):
638 """ 638 """
639 find the common ancestor file context, if any, of self, and fc2 639 find the common ancestor file context, if any, of self, and fc2
640 640
641 If actx is given, it must be the changectx of the common ancestor 641 actx must be the changectx of the common ancestor
642 of self's and fc2's respective changesets. 642 of self's and fc2's respective changesets.
643 """ 643 """
644
645 if actx is None:
646 actx = self.changectx().ancestor(fc2.changectx())
647
648 # the trivial case: changesets are unrelated, files must be too
649 if not actx:
650 return None
651 644
652 # the easy case: no (relevant) renames 645 # the easy case: no (relevant) renames
653 if fc2.path() == self.path() and self.path() in actx: 646 if fc2.path() == self.path() and self.path() in actx:
654 return actx[self.path()] 647 return actx[self.path()]
655 acache = {} 648 acache = {}