comparison mercurial/context.py @ 19559:80ad9fe22e18

basectx: move _fileinfo from changectx
author Sean Farley <sean.michael.farley@gmail.com>
date Mon, 05 Aug 2013 18:28:23 -0500
parents d0448e9d4554
children f256e1108053
comparison
equal deleted inserted replaced
19558:d0448e9d4554 19559:80ad9fe22e18
89 89
90 def p2(self): 90 def p2(self):
91 if len(self._parents) == 2: 91 if len(self._parents) == 2:
92 return self._parents[1] 92 return self._parents[1]
93 return changectx(self._repo, -1) 93 return changectx(self._repo, -1)
94
95 def _fileinfo(self, path):
96 if '_manifest' in self.__dict__:
97 try:
98 return self._manifest[path], self._manifest.flags(path)
99 except KeyError:
100 raise error.ManifestLookupError(self._node, path,
101 _('not found in manifest'))
102 if '_manifestdelta' in self.__dict__ or path in self.files():
103 if path in self._manifestdelta:
104 return (self._manifestdelta[path],
105 self._manifestdelta.flags(path))
106 node, flag = self._repo.manifest.find(self._changeset[0], path)
107 if not node:
108 raise error.ManifestLookupError(self._node, path,
109 _('not found in manifest'))
110
111 return node, flag
94 112
95 class changectx(basectx): 113 class changectx(basectx):
96 """A changecontext object makes access to data related to a particular 114 """A changecontext object makes access to data related to a particular
97 changeset convenient. It represents a read-only context already presnt in 115 changeset convenient. It represents a read-only context already presnt in
98 the repo.""" 116 the repo."""
310 if self.bumped(): 328 if self.bumped():
311 troubles.append('bumped') 329 troubles.append('bumped')
312 if self.divergent(): 330 if self.divergent():
313 troubles.append('divergent') 331 troubles.append('divergent')
314 return troubles 332 return troubles
315
316 def _fileinfo(self, path):
317 if '_manifest' in self.__dict__:
318 try:
319 return self._manifest[path], self._manifest.flags(path)
320 except KeyError:
321 raise error.ManifestLookupError(self._node, path,
322 _('not found in manifest'))
323 if '_manifestdelta' in self.__dict__ or path in self.files():
324 if path in self._manifestdelta:
325 return (self._manifestdelta[path],
326 self._manifestdelta.flags(path))
327 node, flag = self._repo.manifest.find(self._changeset[0], path)
328 if not node:
329 raise error.ManifestLookupError(self._node, path,
330 _('not found in manifest'))
331
332 return node, flag
333 333
334 def filenode(self, path): 334 def filenode(self, path):
335 return self._fileinfo(path)[0] 335 return self._fileinfo(path)[0]
336 336
337 def flags(self, path): 337 def flags(self, path):