[PATCH 03 of 41] basefilectx: move _changeid from filectx
Sean Farley
sean.michael.farley at gmail.com
Mon Aug 12 11:26:59 CDT 2013
# HG changeset patch
# User Sean Farley <sean.michael.farley at gmail.com>
# Date 1376279046 18000
# Sun Aug 11 22:44:06 2013 -0500
# Node ID a014367989887106e7bc3d31ee3ab4806ebaeb08
# Parent dffad92ab7095f1e715b2fcb59e4826cd9bdbabc
basefilectx: move _changeid from filectx
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -421,10 +421,19 @@
@propertycache
def _filelog(self):
return self._repo.file(self._path)
+ @propertycache
+ def _changeid(self):
+ if '_changeid' in self.__dict__:
+ return self._changeid
+ elif '_changectx' in self.__dict__:
+ return self._changectx.rev()
+ else:
+ return self._filelog.linkrev(self._filerev)
+
class filectx(basefilectx):
"""A filecontext object makes access to data related to a particular
filerevision convenient."""
def __init__(self, repo, path, changeid=None, fileid=None,
filelog=None, changectx=None):
@@ -471,19 +480,10 @@
# complicated to solve. Proper handling of the issue here should be
# considered when solving linkrev issue are on the table.
return changectx(self._repo.unfiltered(), self._changeid)
@propertycache
- def _changeid(self):
- if '_changeid' in self.__dict__:
- return self._changeid
- elif '_changectx' in self.__dict__:
- return self._changectx.rev()
- else:
- return self._filelog.linkrev(self._filerev)
-
- @propertycache
def _filenode(self):
if '_fileid' in self.__dict__:
return self._filelog.lookup(self._fileid)
else:
return self._changectx.filenode(self._path)
More information about the Mercurial-devel
mailing list