##// END OF EJS Templates
context: remove unused filectx.ancestor
Mads Kiilerich -
r20984:f4a87d1e default
parent child Browse files
Show More
@@ -7,7 +7,7 b''
7
7
8 from node import nullid, nullrev, short, hex, bin
8 from node import nullid, nullrev, short, hex, bin
9 from i18n import _
9 from i18n import _
10 import ancestor, mdiff, error, util, scmutil, subrepo, patch, encoding, phases
10 import mdiff, error, util, scmutil, subrepo, patch, encoding, phases
11 import match as matchmod
11 import match as matchmod
12 import os, errno, stat
12 import os, errno, stat
13 import obsolete as obsmod
13 import obsolete as obsmod
@@ -688,55 +688,6 b' class basefilectx(object):'
688
688
689 return zip(hist[base][0], hist[base][1].splitlines(True))
689 return zip(hist[base][0], hist[base][1].splitlines(True))
690
690
691 def ancestor(self, fc2, actx):
692 """
693 find the common ancestor file context, if any, of self, and fc2
694
695 actx must be the changectx of the common ancestor
696 of self's and fc2's respective changesets.
697 """
698
699 # the easy case: no (relevant) renames
700 if fc2.path() == self.path() and self.path() in actx:
701 return actx[self.path()]
702
703 # the next easiest cases: unambiguous predecessor (name trumps
704 # history)
705 if self.path() in actx and fc2.path() not in actx:
706 return actx[self.path()]
707 if fc2.path() in actx and self.path() not in actx:
708 return actx[fc2.path()]
709
710 # prime the ancestor cache for the working directory
711 acache = {}
712 for c in (self, fc2):
713 if c.filenode() is None:
714 pl = [(n.path(), n.filenode()) for n in c.parents()]
715 acache[(c._path, None)] = pl
716
717 flcache = {self._repopath:self._filelog, fc2._repopath:fc2._filelog}
718 def parents(vertex):
719 if vertex in acache:
720 return acache[vertex]
721 f, n = vertex
722 if f not in flcache:
723 flcache[f] = self._repo.file(f)
724 fl = flcache[f]
725 pl = [(f, p) for p in fl.parents(n) if p != nullid]
726 re = fl.renamed(n)
727 if re:
728 pl.append(re)
729 acache[vertex] = pl
730 return pl
731
732 a, b = (self._path, self._filenode), (fc2._path, fc2._filenode)
733 v = ancestor.genericancestor(a, b, parents)
734 if v:
735 f, n = v
736 return filectx(self._repo, f, fileid=n, filelog=flcache[f])
737
738 return None
739
740 def ancestors(self, followfirst=False):
691 def ancestors(self, followfirst=False):
741 visit = {}
692 visit = {}
742 c = self
693 c = self
General Comments 0
You need to be logged in to leave comments. Login now