changeset 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 ba45041827a2
files mercurial/context.py
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/context.py	Sun Dec 24 22:29:29 2006 +0100
+++ b/mercurial/context.py	Sun Dec 24 22:55:34 2006 +0100
@@ -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 @@
         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