merge with stable
authorMatt Mackall <mpm@selenic.com>
Tue, 06 May 2014 12:47:59 -0500
changeset 21230 d882a8786ddf
parent 21228 be561a622100 (current diff)
parent 21229 54d7657d7d1e (diff)
child 21231 1ce16c7b7fb4
merge with stable
--- a/Makefile	Fri May 02 18:24:10 2014 +0900
+++ b/Makefile	Tue May 06 12:47:59 2014 -0500
@@ -56,7 +56,7 @@
 	find contrib doc hgext i18n mercurial tests \
 		\( -name '*.py[cdo]' -o -name '*.so' \) -exec rm -f '{}' ';'
 	rm -f $(addprefix mercurial/,$(notdir $(wildcard mercurial/pure/[a-z]*.py)))
-	rm -f MANIFEST MANIFEST.in mercurial/__version__.py tests/*.err
+	rm -f MANIFEST MANIFEST.in mercurial/__version__.py hgext/__index__.py tests/*.err
 	rm -rf build mercurial/locale
 	$(MAKE) -C doc clean
 
--- a/hgext/color.py	Fri May 02 18:24:10 2014 +0900
+++ b/hgext/color.py	Tue May 06 12:47:59 2014 -0500
@@ -230,7 +230,7 @@
                         'cyan': (False, curses.COLOR_CYAN),
                         'white': (False, curses.COLOR_WHITE)}
 except ImportError:
-    _terminfo_params = False
+    _terminfo_params = {}
 
 _styles = {'grep.match': 'red bold',
            'grep.linenumber': 'green',
--- a/mercurial/extensions.py	Fri May 02 18:24:10 2014 +0900
+++ b/mercurial/extensions.py	Tue May 06 12:47:59 2014 -0500
@@ -281,7 +281,7 @@
         return dict((name, gettext(desc))
                     for name, desc in __index__.docs.iteritems()
                     if name not in _order)
-    except ImportError:
+    except (ImportError, AttributeError):
         pass
 
     paths = _disabledpaths()
@@ -304,7 +304,7 @@
             return
         else:
             return gettext(__index__.docs.get(name))
-    except ImportError:
+    except (ImportError, AttributeError):
         pass
 
     paths = _disabledpaths()
--- a/mercurial/win32.py	Fri May 02 18:24:10 2014 +0900
+++ b/mercurial/win32.py	Tue May 06 12:47:59 2014 -0500
@@ -25,7 +25,6 @@
 # GetLastError
 _ERROR_SUCCESS = 0
 _ERROR_NO_MORE_FILES = 18
-_ERROR_SHARING_VIOLATION = 32
 _ERROR_INVALID_PARAMETER = 87
 _ERROR_INSUFFICIENT_BUFFER = 122
 
@@ -61,9 +60,7 @@
 
 _OPEN_EXISTING = 3
 
-_FILE_FLAG_OPEN_REPARSE_POINT = 0x00200000
 _FILE_FLAG_BACKUP_SEMANTICS = 0x02000000
-_FILE_FLAG_DELETE_ON_CLOSE = 0x04000000
 
 # SetFileAttributes
 _FILE_ATTRIBUTE_NORMAL = 0x80
@@ -424,18 +421,11 @@
 def unlink(f):
     '''try to implement POSIX' unlink semantics on Windows'''
 
-    # If we can open f exclusively, no other processes must have open handles
-    # for it and we can expect its name will be deleted immediately when we
-    # close the handle unless we have another in the same process.  We also
-    # expect we shall simply fail to open f if it is a directory.
-    fh = _kernel32.CreateFileA(f, 0, 0, None, _OPEN_EXISTING,
-        _FILE_FLAG_OPEN_REPARSE_POINT | _FILE_FLAG_DELETE_ON_CLOSE, None)
-    if fh != _INVALID_HANDLE_VALUE:
-        _kernel32.CloseHandle(fh)
-        return
-    error = _kernel32.GetLastError()
-    if error != _ERROR_SHARING_VIOLATION:
-        raise ctypes.WinError(error)
+    if os.path.isdir(f):
+        # use EPERM because it is POSIX prescribed value, even though
+        # unlink(2) on directories returns EISDIR on Linux
+        raise IOError(errno.EPERM,
+                      "Unlinking directory not permitted: '%s'" % f)
 
     # POSIX allows to unlink and rename open files. Windows has serious
     # problems with doing that:
--- a/setup.py	Fri May 02 18:24:10 2014 +0900
+++ b/setup.py	Tue May 06 12:47:59 2014 -0500
@@ -331,7 +331,9 @@
 
     def run(self):
         if os.path.exists(self._indexfilename):
-            os.unlink(self._indexfilename)
+            f = open(self._indexfilename, 'w')
+            f.write('# empty\n')
+            f.close()
 
         # here no extension enabled, disabled() lists up everything
         code = ('import pprint; from mercurial import extensions; '
--- a/tests/test-status-color.t	Fri May 02 18:24:10 2014 +0900
+++ b/tests/test-status-color.t	Tue May 06 12:47:59 2014 -0500
@@ -319,4 +319,17 @@
   \x1b[0;31;1mU a\x1b[0m (esc)
   \x1b[0;32;1mR b\x1b[0m (esc)
 
+color coding of error message with current availability of curses
+
+  $ hg unknowncommand > /dev/null
+  hg: unknown command 'unknowncommand'
+  [255]
+
+color coding of error message without curses
+
+  $ echo 'raise ImportError' > curses.py
+  $ PYTHONPATH=`pwd`:$PYTHONPATH hg unknowncommand > /dev/null
+  hg: unknown command 'unknowncommand'
+  [255]
+
   $ cd ..