comparison mercurial/context.py @ 19703:d2936bec530b

commitablefilectx: move __nonzero__ from workingfilectx
author Sean Farley <sean.michael.farley@gmail.com>
date Thu, 15 Aug 2013 13:23:06 -0500
parents d25fdd4c2fd1
children bad0bd99ac96
comparison
equal deleted inserted replaced
19702:d25fdd4c2fd1 19703:d2936bec530b
1200 if filelog is not None: 1200 if filelog is not None:
1201 self._filelog = filelog 1201 self._filelog = filelog
1202 if ctx: 1202 if ctx:
1203 self._changectx = ctx 1203 self._changectx = ctx
1204 1204
1205 def __nonzero__(self):
1206 return True
1207
1205 class workingfilectx(commitablefilectx): 1208 class workingfilectx(commitablefilectx):
1206 """A workingfilectx object makes access to data related to a particular 1209 """A workingfilectx object makes access to data related to a particular
1207 file in the working directory convenient.""" 1210 file in the working directory convenient."""
1208 def __init__(self, repo, path, filelog=None, workingctx=None): 1211 def __init__(self, repo, path, filelog=None, workingctx=None):
1209 super(workingfilectx, self).__init__(repo, path, filelog, workingctx) 1212 super(workingfilectx, self).__init__(repo, path, filelog, workingctx)
1210 1213
1211 @propertycache 1214 @propertycache
1212 def _changectx(self): 1215 def _changectx(self):
1213 return workingctx(self._repo) 1216 return workingctx(self._repo)
1214
1215 def __nonzero__(self):
1216 return True
1217 1217
1218 def data(self): 1218 def data(self):
1219 return self._repo.wread(self._path) 1219 return self._repo.wread(self._path)
1220 def renamed(self): 1220 def renamed(self):
1221 rp = self._repo.dirstate.copied(self._path) 1221 rp = self._repo.dirstate.copied(self._path)