comparison mercurial/context.py @ 19702:d25fdd4c2fd1

commitablefilectx: move __init__ from workingfilectx
author Sean Farley <sean.michael.farley@gmail.com>
date Thu, 15 Aug 2013 13:12:50 -0500
parents f0f8380ec516
children d2936bec530b
comparison
equal deleted inserted replaced
19701:f0f8380ec516 19702:d25fdd4c2fd1
1190 1190
1191 class commitablefilectx(basefilectx): 1191 class commitablefilectx(basefilectx):
1192 """A commitablefilectx provides common functionality for a file context that 1192 """A commitablefilectx provides common functionality for a file context that
1193 wants the ability to commit, e.g. workingfilectx or memfilectx.""" 1193 wants the ability to commit, e.g. workingfilectx or memfilectx."""
1194 def __init__(self, repo, path, filelog=None, ctx=None): 1194 def __init__(self, repo, path, filelog=None, ctx=None):
1195 pass 1195 self._repo = repo
1196 self._path = path
1197 self._changeid = None
1198 self._filerev = self._filenode = None
1199
1200 if filelog is not None:
1201 self._filelog = filelog
1202 if ctx:
1203 self._changectx = ctx
1196 1204
1197 class workingfilectx(commitablefilectx): 1205 class workingfilectx(commitablefilectx):
1198 """A workingfilectx object makes access to data related to a particular 1206 """A workingfilectx object makes access to data related to a particular
1199 file in the working directory convenient.""" 1207 file in the working directory convenient."""
1200 def __init__(self, repo, path, filelog=None, workingctx=None): 1208 def __init__(self, repo, path, filelog=None, workingctx=None):
1201 self._repo = repo 1209 super(workingfilectx, self).__init__(repo, path, filelog, workingctx)
1202 self._path = path
1203 self._changeid = None
1204 self._filerev = self._filenode = None
1205
1206 if filelog is not None:
1207 self._filelog = filelog
1208 if workingctx:
1209 self._changectx = workingctx
1210 1210
1211 @propertycache 1211 @propertycache
1212 def _changectx(self): 1212 def _changectx(self):
1213 return workingctx(self._repo) 1213 return workingctx(self._repo)
1214 1214