[PATCH 01 of 11] util: add stat() function

Idan Kamara idankk86 at gmail.com
Sat Jul 16 09:34:32 CDT 2011


# HG changeset patch
# User Idan Kamara <idankk86 at gmail.com>
# Date 1310819443 -10800
# Node ID d36f5aec2f9e4214fafe048bccd0bb47ac5f9c16
# Parent  50b67d5c4073dc37d0fe549b178bc74c8b9c51f0
util: add stat() function

diff -r 50b67d5c4073 -r d36f5aec2f9e mercurial/util.py
--- a/mercurial/util.py	Fri Jul 15 14:27:16 2011 -0500
+++ b/mercurial/util.py	Sat Jul 16 15:30:43 2011 +0300
@@ -1610,3 +1610,11 @@
         return fd.isatty()
     except AttributeError:
         return False
+
+def stat(path):
+    '''return interesting stat attributes for the given path'''
+    try:
+        st = os.stat(path)
+        return (st.st_mtime, st.st_size)
+    except OSError:
+        return None


More information about the Mercurial-devel mailing list