Mercurial > hg > mercurial-crew-with-dirclash
comparison mercurial/context.py @ 3308:192085505f6f
filectx: add size method
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Mon, 09 Oct 2006 23:20:48 -0500 |
parents | 45f0c49f0449 |
children | 0e370798eebf |
comparison
equal
deleted
inserted
replaced
3307:3cd51b986172 | 3308:192085505f6f |
---|---|
6 # of the GNU General Public License, incorporated herein by reference. | 6 # of the GNU General Public License, incorporated herein by reference. |
7 | 7 |
8 from node import * | 8 from node import * |
9 from i18n import gettext as _ | 9 from i18n import gettext as _ |
10 from demandload import demandload | 10 from demandload import demandload |
11 demandload(globals(), "ancestor bdiff repo revlog util") | 11 demandload(globals(), "ancestor bdiff repo revlog util os") |
12 | 12 |
13 class changectx(object): | 13 class changectx(object): |
14 """A changecontext object makes access to data related to a particular | 14 """A changecontext object makes access to data related to a particular |
15 changeset convenient.""" | 15 changeset convenient.""" |
16 def __init__(self, repo, changeid=None): | 16 def __init__(self, repo, changeid=None): |
189 def changectx(self): return self._changectx | 189 def changectx(self): return self._changectx |
190 | 190 |
191 def data(self): return self._filelog.read(self._filenode) | 191 def data(self): return self._filelog.read(self._filenode) |
192 def renamed(self): return self._filelog.renamed(self._filenode) | 192 def renamed(self): return self._filelog.renamed(self._filenode) |
193 def path(self): return self._path | 193 def path(self): return self._path |
194 def size(self): return self._filelog.size(self._filerev) | |
194 | 195 |
195 def parents(self): | 196 def parents(self): |
196 p = self._path | 197 p = self._path |
197 fl = self._filelog | 198 fl = self._filelog |
198 pl = [ (p, n, fl) for n in self._filelog.parents(self._filenode) ] | 199 pl = [ (p, n, fl) for n in self._filelog.parents(self._filenode) ] |
463 for p,n,l in pl if n != nullid ] | 464 for p,n,l in pl if n != nullid ] |
464 | 465 |
465 def children(self): | 466 def children(self): |
466 return [] | 467 return [] |
467 | 468 |
469 def size(self): return os.stat(self._repo.wjoin(self._path)).st_size |