# HG changeset patch # User Benoit Boissinot # Date 2006-12-24 21:55:34 # Node ID 2b8825c94c5a9a145d8421210d466a524f566541 # Parent a4edadd807dd9d82547f1ab5afc61f65a9d2a715 add date attribute to workingfilectx diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -7,7 +7,7 @@ from node import * from i18n import _ -import ancestor, bdiff, repo, revlog, util, os +import ancestor, bdiff, repo, revlog, util, os, errno class changectx(object): """A changecontext object makes access to data related to a particular @@ -501,5 +501,12 @@ class workingfilectx(filectx): return [] def size(self): return os.stat(self._repo.wjoin(self._path)).st_size + def date(self): + t, tz = self._changectx.date() + try: + return (os.lstat(repo.wjoin(self._path)).st_mtime, tz) + except OSError, err: + if err.errno != errno.ENOENT: raise + return (t, tz) def cmp(self, text): return self._repo.wread(self._path) == text