# HG changeset patch # User Brendan Cully # Date 1187923935 25200 # Node ID 85ba6ab5bd3af93ac607b4bdaccde1eed0f8dd7a # Parent 8860f29447c1c35cd0be625c9da9c6e9d9396c29# Parent 2b8373bda032901419c229d9b92f539e27b89448 Merge with crew diff -r 8860f29447c1 -r 85ba6ab5bd3a mercurial/util.py --- 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): diff -r 8860f29447c1 -r 85ba6ab5bd3a tests/test-permissions --- 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 diff -r 8860f29447c1 -r 85ba6ab5bd3a tests/test-permissions.out --- 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