Mercurial > public > mercurial-scm > hg
comparison mercurial/context.py @ 3962:2b8825c94c5a
add date attribute to workingfilectx
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Sun, 24 Dec 2006 22:55:34 +0100 |
parents | a4edadd807dd |
children | 2308c39b9521 |
comparison
equal
deleted
inserted
replaced
3961:a4edadd807dd | 3962:2b8825c94c5a |
---|---|
5 # This software may be used and distributed according to the terms | 5 # This software may be used and distributed according to the terms |
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 _ | 9 from i18n import _ |
10 import ancestor, bdiff, repo, revlog, util, os | 10 import ancestor, bdiff, repo, revlog, util, os, errno |
11 | 11 |
12 class changectx(object): | 12 class changectx(object): |
13 """A changecontext object makes access to data related to a particular | 13 """A changecontext object makes access to data related to a particular |
14 changeset convenient.""" | 14 changeset convenient.""" |
15 def __init__(self, repo, changeid=None): | 15 def __init__(self, repo, changeid=None): |
499 | 499 |
500 def children(self): | 500 def children(self): |
501 return [] | 501 return [] |
502 | 502 |
503 def size(self): return os.stat(self._repo.wjoin(self._path)).st_size | 503 def size(self): return os.stat(self._repo.wjoin(self._path)).st_size |
504 def date(self): | |
505 t, tz = self._changectx.date() | |
506 try: | |
507 return (os.lstat(repo.wjoin(self._path)).st_mtime, tz) | |
508 except OSError, err: | |
509 if err.errno != errno.ENOENT: raise | |
510 return (t, tz) | |
504 | 511 |
505 def cmp(self, text): return self._repo.wread(self._path) == text | 512 def cmp(self, text): return self._repo.wread(self._path) == text |