Mercurial > hg
comparison mercurial/context.py @ 19574:a01436798988
basefilectx: move _changeid from filectx
author | Sean Farley <sean.michael.farley@gmail.com> |
---|---|
date | Sun, 11 Aug 2013 22:44:06 -0500 |
parents | dffad92ab709 |
children | 5a868137b830 |
comparison
equal
deleted
inserted
replaced
19573:dffad92ab709 | 19574:a01436798988 |
---|---|
421 | 421 |
422 @propertycache | 422 @propertycache |
423 def _filelog(self): | 423 def _filelog(self): |
424 return self._repo.file(self._path) | 424 return self._repo.file(self._path) |
425 | 425 |
426 @propertycache | |
427 def _changeid(self): | |
428 if '_changeid' in self.__dict__: | |
429 return self._changeid | |
430 elif '_changectx' in self.__dict__: | |
431 return self._changectx.rev() | |
432 else: | |
433 return self._filelog.linkrev(self._filerev) | |
434 | |
426 class filectx(basefilectx): | 435 class filectx(basefilectx): |
427 """A filecontext object makes access to data related to a particular | 436 """A filecontext object makes access to data related to a particular |
428 filerevision convenient.""" | 437 filerevision convenient.""" |
429 def __init__(self, repo, path, changeid=None, fileid=None, | 438 def __init__(self, repo, path, changeid=None, fileid=None, |
430 filelog=None, changectx=None): | 439 filelog=None, changectx=None): |
469 # | 478 # |
470 # Linkrevs have several serious troubles with filtering that are | 479 # Linkrevs have several serious troubles with filtering that are |
471 # complicated to solve. Proper handling of the issue here should be | 480 # complicated to solve. Proper handling of the issue here should be |
472 # considered when solving linkrev issue are on the table. | 481 # considered when solving linkrev issue are on the table. |
473 return changectx(self._repo.unfiltered(), self._changeid) | 482 return changectx(self._repo.unfiltered(), self._changeid) |
474 | |
475 @propertycache | |
476 def _changeid(self): | |
477 if '_changeid' in self.__dict__: | |
478 return self._changeid | |
479 elif '_changectx' in self.__dict__: | |
480 return self._changectx.rev() | |
481 else: | |
482 return self._filelog.linkrev(self._filerev) | |
483 | 483 |
484 @propertycache | 484 @propertycache |
485 def _filenode(self): | 485 def _filenode(self): |
486 if '_fileid' in self.__dict__: | 486 if '_fileid' in self.__dict__: |
487 return self._filelog.lookup(self._fileid) | 487 return self._filelog.lookup(self._fileid) |