changeset 5222:85ba6ab5bd3a

Merge with crew
author Brendan Cully <brendan@kublai.com>
date Thu, 23 Aug 2007 19:52:15 -0700
parents 8860f29447c1 (current diff) 2b8373bda032 (diff)
children 3786ef8877d5
files
diffstat 3 files changed, 20 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -850,12 +850,16 @@ def checkexec(path):
 
     Requires a directory (like /foo/.hg)
     """
-    fh, fn = tempfile.mkstemp("", "", path)
-    os.close(fh)
-    m = os.stat(fn).st_mode
-    os.chmod(fn, m ^ 0111)
-    r = (os.stat(fn).st_mode != m)
-    os.unlink(fn)
+    try:
+        fh, fn = tempfile.mkstemp("", "", path)
+        os.close(fh)
+        m = os.stat(fn).st_mode
+        os.chmod(fn, m ^ 0111)
+        r = (os.stat(fn).st_mode != m)
+        os.unlink(fn)
+    except (IOError,OSError):
+        # we don't care, the user probably won't be able to commit anyway
+        return False
     return r
 
 def execfunc(path, fallback):
--- a/tests/test-permissions
+++ b/tests/test-permissions
@@ -1,6 +1,7 @@
 #!/bin/sh
 
-hg init
+hg init t
+cd t
 echo foo > a
 hg add a
 hg commit -m "1" -d "1000000 0"
@@ -12,4 +13,5 @@ hg verify 2>/dev/null || echo verify fai
 chmod -w .hg/store/data/a.i
 echo barber > a
 hg commit -m "2" -d "1000000 0" 2>/dev/null || echo commit failed
-
+chmod -w ../t
+hg diff --nodates
--- a/tests/test-permissions.out
+++ b/tests/test-permissions.out
@@ -14,3 +14,9 @@ crosschecking files in changesets and ma
 checking files
 1 files, 1 changesets, 1 total revisions
 commit failed
+diff -r c1fab96507ef a
+--- a/a
++++ b/a
+@@ -1,1 +1,1 @@ foo
+-foo
++barber