comparison mercurial/context.py @ 24411:5a12ef618c03 stable

adjustlinkrev: handle 'None' value as source When the source rev value is 'None', the ctx is a working context. We cannot compute the ancestors from there so we directly skip to its parents. This will be necessary to allow 'None' value for '_descendantrev' itself necessary to make all contexts used in 'mergecopies' reuse the same '_ancestrycontext'.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Thu, 19 Mar 2015 23:57:34 -0700
parents 86de531e07e1
children 1cfded2fa1a9 612ed41ae359
comparison
equal deleted inserted replaced
24410:86de531e07e1 24411:5a12ef618c03
772 fr = filelog.rev(fnode) 772 fr = filelog.rev(fnode)
773 lkr = filelog.linkrev(fr) 773 lkr = filelog.linkrev(fr)
774 # hack to reuse ancestor computation when searching for renames 774 # hack to reuse ancestor computation when searching for renames
775 memberanc = getattr(self, '_ancestrycontext', None) 775 memberanc = getattr(self, '_ancestrycontext', None)
776 iteranc = None 776 iteranc = None
777 revs = [srcrev] 777 if srcrev is None:
778 # wctx case, used by workingfilectx during mergecopy
779 revs = [p.rev() for p in self._repo[None].parents()]
780 inclusive = True # we skipped the real (revless) source
781 else:
782 revs = [srcrev]
778 if memberanc is None: 783 if memberanc is None:
779 memberanc = iteranc = cl.ancestors(revs, lkr, inclusive=inclusive) 784 memberanc = iteranc = cl.ancestors(revs, lkr,
785 inclusive=inclusive)
780 # check if this linkrev is an ancestor of srcrev 786 # check if this linkrev is an ancestor of srcrev
781 if lkr not in memberanc: 787 if lkr not in memberanc:
782 if iteranc is None: 788 if iteranc is None:
783 iteranc = cl.ancestors(revs, lkr, inclusive=inclusive) 789 iteranc = cl.ancestors(revs, lkr, inclusive=inclusive)
784 for a in iteranc: 790 for a in iteranc: