mercurial/util.py
changeset 3677 1a0fa3914c46
parent 3673 eb0b4a2d70a9
child 3721 98f2507c5551
--- a/mercurial/util.py	Sat Nov 18 23:51:13 2006 -0200
+++ b/mercurial/util.py	Sat Nov 18 23:51:14 2006 -0200
@@ -654,6 +654,11 @@
     def explain_exit(code):
         return _("exited with status %d") % code, code
 
+    # if you change this stub into a real check, please try to implement the
+    # username and groupname functions above, too.
+    def isowner(fp, st=None):
+        return True
+
     try:
         # override functions with win32 versions if possible
         from util_win32 import *
@@ -765,6 +770,16 @@
             return _("stopped by signal %d") % val, val
         raise ValueError(_("invalid exit code"))
 
+    def isowner(fp, st=None):
+        """Return True if the file object f belongs to the current user.
+
+        The return value of a util.fstat(f) may be passed as the st argument.
+        """
+        if st is None:
+            st = fstat(f)
+        return st.st_uid == os.getuid()
+
+
 def opener(base, audit=True):
     """
     return a function that opens files relative to base