Mercurial > hg
comparison mercurial/context.py @ 24415:1cfded2fa1a9
merge with stable
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Fri, 20 Mar 2015 17:30:38 -0500 |
parents | 82b82168d045 5a12ef618c03 |
children | 065b886f61c6 |
comparison
equal
deleted
inserted
replaced
24414:f247fbfe07f3 | 24415:1cfded2fa1a9 |
---|---|
773 fr = filelog.rev(fnode) | 773 fr = filelog.rev(fnode) |
774 lkr = filelog.linkrev(fr) | 774 lkr = filelog.linkrev(fr) |
775 # hack to reuse ancestor computation when searching for renames | 775 # hack to reuse ancestor computation when searching for renames |
776 memberanc = getattr(self, '_ancestrycontext', None) | 776 memberanc = getattr(self, '_ancestrycontext', None) |
777 iteranc = None | 777 iteranc = None |
778 if srcrev is None: | |
779 # wctx case, used by workingfilectx during mergecopy | |
780 revs = [p.rev() for p in self._repo[None].parents()] | |
781 inclusive = True # we skipped the real (revless) source | |
782 else: | |
783 revs = [srcrev] | |
778 if memberanc is None: | 784 if memberanc is None: |
779 memberanc = iteranc = cl.ancestors([srcrev], lkr, | 785 memberanc = iteranc = cl.ancestors(revs, lkr, |
780 inclusive=inclusive) | 786 inclusive=inclusive) |
781 # check if this linkrev is an ancestor of srcrev | 787 # check if this linkrev is an ancestor of srcrev |
782 if lkr not in memberanc: | 788 if lkr not in memberanc: |
783 if iteranc is None: | 789 if iteranc is None: |
784 iteranc = cl.ancestors([srcrev], lkr, inclusive=inclusive) | 790 iteranc = cl.ancestors(revs, lkr, inclusive=inclusive) |
785 for a in iteranc: | 791 for a in iteranc: |
786 ac = cl.read(a) # get changeset data (we avoid object creation) | 792 ac = cl.read(a) # get changeset data (we avoid object creation) |
787 if path in ac[3]: # checking the 'files' field. | 793 if path in ac[3]: # checking the 'files' field. |
788 # The file has been touched, check if the content is | 794 # The file has been touched, check if the content is |
789 # similar to the one we search for. | 795 # similar to the one we search for. |
912 # use linkrev to find the first changeset where self appeared | 918 # use linkrev to find the first changeset where self appeared |
913 base = self | 919 base = self |
914 introrev = self.introrev() | 920 introrev = self.introrev() |
915 if self.rev() != introrev: | 921 if self.rev() != introrev: |
916 base = self.filectx(self.filenode(), changeid=introrev) | 922 base = self.filectx(self.filenode(), changeid=introrev) |
923 ac = self._repo.changelog.ancestors([introrev], inclusive=True) | |
924 base._ancestrycontext = ac | |
917 | 925 |
918 # This algorithm would prefer to be recursive, but Python is a | 926 # This algorithm would prefer to be recursive, but Python is a |
919 # bit recursion-hostile. Instead we do an iterative | 927 # bit recursion-hostile. Instead we do an iterative |
920 # depth-first search. | 928 # depth-first search. |
921 | 929 |