Mercurial > public > mercurial-scm > hg
comparison mercurial/context.py @ 23770:50f0096a7346
filectx: fix annotate to not directly instantiate filectx
28a302e9225d changed basefilectx.annotate() to directly instantiate new
filectx's instead of going through self.filectx(), this breaks extensions that
replace the filectx class, and would also break future uses that would need
memfilectx's.
author | Durham Goode <durham@fb.com> |
---|---|
date | Fri, 09 Jan 2015 11:21:29 -0800 |
parents | b5346480a490 |
children | 70bf92b87410 |
comparison
equal
deleted
inserted
replaced
23769:bb3ee61cfaa1 | 23770:50f0096a7346 |
---|---|
891 | 891 |
892 # use linkrev to find the first changeset where self appeared | 892 # use linkrev to find the first changeset where self appeared |
893 base = self | 893 base = self |
894 introrev = self.introrev() | 894 introrev = self.introrev() |
895 if self.rev() != introrev: | 895 if self.rev() != introrev: |
896 base = filectx(self._repo, self._path, filelog=self.filelog(), | 896 base = self.filectx(self.filenode(), changeid=introrev) |
897 fileid=self.filenode(), changeid=introrev) | |
898 | 897 |
899 # This algorithm would prefer to be recursive, but Python is a | 898 # This algorithm would prefer to be recursive, but Python is a |
900 # bit recursion-hostile. Instead we do an iterative | 899 # bit recursion-hostile. Instead we do an iterative |
901 # depth-first search. | 900 # depth-first search. |
902 | 901 |
998 # Linkrevs have several serious troubles with filtering that are | 997 # Linkrevs have several serious troubles with filtering that are |
999 # complicated to solve. Proper handling of the issue here should be | 998 # complicated to solve. Proper handling of the issue here should be |
1000 # considered when solving linkrev issue are on the table. | 999 # considered when solving linkrev issue are on the table. |
1001 return changectx(self._repo.unfiltered(), self._changeid) | 1000 return changectx(self._repo.unfiltered(), self._changeid) |
1002 | 1001 |
1003 def filectx(self, fileid): | 1002 def filectx(self, fileid, changeid=None): |
1004 '''opens an arbitrary revision of the file without | 1003 '''opens an arbitrary revision of the file without |
1005 opening a new filelog''' | 1004 opening a new filelog''' |
1006 return filectx(self._repo, self._path, fileid=fileid, | 1005 return filectx(self._repo, self._path, fileid=fileid, |
1007 filelog=self._filelog) | 1006 filelog=self._filelog, changeid=changeid) |
1008 | 1007 |
1009 def data(self): | 1008 def data(self): |
1010 try: | 1009 try: |
1011 return self._filelog.read(self._filenode) | 1010 return self._filelog.read(self._filenode) |
1012 except error.CensoredNodeError: | 1011 except error.CensoredNodeError: |