changeset 5240: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	Thu Aug 23 19:51:59 2007 -0700
+++ b/mercurial/util.py	Thu Aug 23 19:52:15 2007 -0700
@@ -850,12 +850,16 @@
 
     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	Thu Aug 23 19:51:59 2007 -0700
+++ b/tests/test-permissions	Thu Aug 23 19:52:15 2007 -0700
@@ -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 @@
 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	Thu Aug 23 19:51:59 2007 -0700
+++ b/tests/test-permissions.out	Thu Aug 23 19:52:15 2007 -0700
@@ -14,3 +14,9 @@
 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