Mercurial > public > mercurial-scm > hg
comparison mercurial/context.py @ 19573:dffad92ab709
basefilectx: move _filelog from filectx
author | Sean Farley <sean.michael.farley@gmail.com> |
---|---|
date | Sun, 11 Aug 2013 22:40:59 -0500 |
parents | c19f46b904b9 |
children | a01436798988 |
comparison
equal
deleted
inserted
replaced
19572:c19f46b904b9 | 19573:dffad92ab709 |
---|---|
417 directory, | 417 directory, |
418 memfilectx: a filecontext that represents files in-memory.""" | 418 memfilectx: a filecontext that represents files in-memory.""" |
419 def __new__(cls, repo, path, *args, **kwargs): | 419 def __new__(cls, repo, path, *args, **kwargs): |
420 return super(basefilectx, cls).__new__(cls) | 420 return super(basefilectx, cls).__new__(cls) |
421 | 421 |
422 @propertycache | |
423 def _filelog(self): | |
424 return self._repo.file(self._path) | |
425 | |
422 class filectx(basefilectx): | 426 class filectx(basefilectx): |
423 """A filecontext object makes access to data related to a particular | 427 """A filecontext object makes access to data related to a particular |
424 filerevision convenient.""" | 428 filerevision convenient.""" |
425 def __init__(self, repo, path, changeid=None, fileid=None, | 429 def __init__(self, repo, path, changeid=None, fileid=None, |
426 filelog=None, changectx=None): | 430 filelog=None, changectx=None): |
465 # | 469 # |
466 # Linkrevs have several serious troubles with filtering that are | 470 # Linkrevs have several serious troubles with filtering that are |
467 # complicated to solve. Proper handling of the issue here should be | 471 # complicated to solve. Proper handling of the issue here should be |
468 # considered when solving linkrev issue are on the table. | 472 # considered when solving linkrev issue are on the table. |
469 return changectx(self._repo.unfiltered(), self._changeid) | 473 return changectx(self._repo.unfiltered(), self._changeid) |
470 | |
471 @propertycache | |
472 def _filelog(self): | |
473 return self._repo.file(self._path) | |
474 | 474 |
475 @propertycache | 475 @propertycache |
476 def _changeid(self): | 476 def _changeid(self): |
477 if '_changeid' in self.__dict__: | 477 if '_changeid' in self.__dict__: |
478 return self._changeid | 478 return self._changeid |