changeset 14998:a5d449fc5e07 stable

merge with i18n
author Matt Mackall <mpm@selenic.com>
date Mon, 01 Aug 2011 10:54:10 -0500
parents a115b5ee9c63 (diff) f091c142fdc1 (current diff)
children f6a737357195 68b5d7005cca
files
diffstat 10 files changed, 56 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/color.py	Sun Jul 31 23:42:40 2011 +0900
+++ b/hgext/color.py	Mon Aug 01 10:54:10 2011 -0500
@@ -180,6 +180,7 @@
             realmode = 'ansi'
 
     if realmode == 'win32':
+        _terminfo_params = {}
         if not w32effects:
             if mode == 'win32':
                 # only warn if color.mode is explicitly set to win32
--- a/mercurial/dispatch.py	Sun Jul 31 23:42:40 2011 +0900
+++ b/mercurial/dispatch.py	Mon Aug 01 10:54:10 2011 -0500
@@ -608,11 +608,15 @@
         for cfg in cfgs:
             req.repo.ui.setconfig(*cfg)
 
-    for opt in ('verbose', 'debug', 'quiet', 'traceback'):
-        val = bool(options[opt])
-        if val:
+    if options['verbose'] or options['debug'] or options['quiet']:
+        for opt in ('verbose', 'debug', 'quiet'):
+            val = str(bool(options[opt]))
             for ui_ in uis:
-                ui_.setconfig('ui', opt, str(val))
+                ui_.setconfig('ui', opt, val)
+
+    if options['traceback']:
+        for ui_ in uis:
+            ui_.setconfig('ui', 'traceback', 'on')
 
     if options['noninteractive']:
         for ui_ in uis:
--- a/mercurial/hgweb/hgweb_mod.py	Sun Jul 31 23:42:40 2011 +0900
+++ b/mercurial/hgweb/hgweb_mod.py	Mon Aug 01 10:54:10 2011 -0500
@@ -129,8 +129,9 @@
                 # A client that sends unbundle without 100-continue will
                 # break if we respond early.
                 if (cmd == 'unbundle' and
-                    req.env.get('HTTP_EXPECT',
-                                '').lower() != '100-continue'):
+                    (req.env.get('HTTP_EXPECT',
+                                 '').lower() != '100-continue') or
+                    req.env.get('X-HgHttp2', '')):
                     req.drain()
                 req.respond(inst, protocol.HGTYPE)
                 return '0\n%s\n' % inst.message
--- a/mercurial/hook.py	Sun Jul 31 23:42:40 2011 +0900
+++ b/mercurial/hook.py	Mon Aug 01 10:54:10 2011 -0500
@@ -134,12 +134,16 @@
 
     oldstdout = -1
     if _redirect:
-        stdoutno = sys.__stdout__.fileno()
-        stderrno = sys.__stderr__.fileno()
-        # temporarily redirect stdout to stderr, if possible
-        if stdoutno >= 0 and stderrno >= 0:
-            oldstdout = os.dup(stdoutno)
-            os.dup2(stderrno, stdoutno)
+        try:
+            stdoutno = sys.__stdout__.fileno()
+            stderrno = sys.__stderr__.fileno()
+            # temporarily redirect stdout to stderr, if possible
+            if stdoutno >= 0 and stderrno >= 0:
+                oldstdout = os.dup(stdoutno)
+                os.dup2(stderrno, stdoutno)
+        except AttributeError:
+            # __stdout/err__ doesn't have fileno(), it's not a real file
+            pass
 
     try:
         for hname, cmd in ui.configitems('hooks'):
--- a/mercurial/httpclient/socketutil.py	Sun Jul 31 23:42:40 2011 +0900
+++ b/mercurial/httpclient/socketutil.py	Mon Aug 01 10:54:10 2011 -0500
@@ -78,10 +78,6 @@
     CERT_NONE = ssl.CERT_NONE
     CERT_OPTIONAL = ssl.CERT_OPTIONAL
     CERT_REQUIRED = ssl.CERT_REQUIRED
-    PROTOCOL_SSLv2 = ssl.PROTOCOL_SSLv2
-    PROTOCOL_SSLv3 = ssl.PROTOCOL_SSLv3
-    PROTOCOL_SSLv23 = ssl.PROTOCOL_SSLv23
-    PROTOCOL_TLSv1 = ssl.PROTOCOL_TLSv1
 else:
     class FakeSocket(httplib.FakeSocket):
         """Socket wrapper that supports SSL.
@@ -105,10 +101,7 @@
                     else:
                         raise x
 
-    PROTOCOL_SSLv2 = 0
-    PROTOCOL_SSLv3 = 1
-    PROTOCOL_SSLv23 = 2
-    PROTOCOL_TLSv1 = 3
+    _PROTOCOL_SSLv23 = 2
 
     CERT_NONE = 0
     CERT_OPTIONAL = 1
@@ -116,7 +109,7 @@
 
     def wrap_socket(sock, keyfile=None, certfile=None,
                 server_side=False, cert_reqs=CERT_NONE,
-                ssl_version=PROTOCOL_SSLv23, ca_certs=None,
+                ssl_version=_PROTOCOL_SSLv23, ca_certs=None,
                 do_handshake_on_connect=True,
                 suppress_ragged_eofs=True):
         if cert_reqs != CERT_NONE and ca_certs:
--- a/mercurial/httpclient/tests/util.py	Sun Jul 31 23:42:40 2011 +0900
+++ b/mercurial/httpclient/tests/util.py	Mon Aug 01 10:54:10 2011 -0500
@@ -133,7 +133,7 @@
 
 def mocksslwrap(sock, keyfile=None, certfile=None,
                 server_side=False, cert_reqs=http.socketutil.CERT_NONE,
-                ssl_version=http.socketutil.PROTOCOL_SSLv23, ca_certs=None,
+                ssl_version=None, ca_certs=None,
                 do_handshake_on_connect=True,
                 suppress_ragged_eofs=True):
     return MockSSLSocket(sock)
--- a/mercurial/httprepo.py	Sun Jul 31 23:42:40 2011 +0900
+++ b/mercurial/httprepo.py	Mon Aug 01 10:54:10 2011 -0500
@@ -78,6 +78,7 @@
 
         if data and self.ui.configbool('ui', 'usehttp2', False):
             headers['Expect'] = '100-Continue'
+            headers['X-HgHttp2'] = '1'
 
         self.ui.debug("sending %s command\n" % cmd)
         q = [('cmd', cmd)]
--- a/mercurial/subrepo.py	Sun Jul 31 23:42:40 2011 +0900
+++ b/mercurial/subrepo.py	Mon Aug 01 10:54:10 2011 -0500
@@ -606,7 +606,7 @@
             if item == 'external':
                 externals.append(path)
             if (item not in ('', 'normal', 'unversioned', 'external')
-                or props not in ('', 'none')):
+                or props not in ('', 'none', 'normal')):
                 changes.append(path)
         for path in changes:
             for ext in externals:
--- a/mercurial/util.py	Sun Jul 31 23:42:40 2011 +0900
+++ b/mercurial/util.py	Mon Aug 01 10:54:10 2011 -0500
@@ -1468,8 +1468,9 @@
 
         self.path = path
 
+        # leave the query string escaped
         for a in ('user', 'passwd', 'host', 'port',
-                  'path', 'query', 'fragment'):
+                  'path', 'fragment'):
             v = getattr(self, a)
             if v is not None:
                 setattr(self, a, _urlunquote(v))
@@ -1490,6 +1491,10 @@
 
         >>> str(url('http://user:pw@host:80/?foo#bar'))
         'http://user:pw@host:80/?foo#bar'
+        >>> str(url('http://user:pw@host:80/?foo=bar&baz=42'))
+        'http://user:pw@host:80/?foo=bar&baz=42'
+        >>> str(url('http://user:pw@host:80/?foo=bar%3dbaz'))
+        'http://user:pw@host:80/?foo=bar%3dbaz'
         >>> str(url('ssh://user:pw@[::1]:2200//home/joe#'))
         'ssh://user:pw@[::1]:2200//home/joe#'
         >>> str(url('http://localhost:80//'))
@@ -1538,9 +1543,13 @@
         if self.host:
             s += '/'
         if self.path:
+            # TODO: similar to the query string, we should not unescape the
+            # path when we store it, the path might contain '%2f' = '/',
+            # which we should *not* escape.
             s += urllib.quote(self.path, safe=self._safepchars)
         if self.query:
-            s += '?' + urllib.quote(self.query, safe=self._safepchars)
+            # we store the query in escaped form.
+            s += '?' + self.query
         if self.fragment is not None:
             s += '#' + urllib.quote(self.fragment, safe=self._safepchars)
         return s
--- a/tests/test-hgrc.t	Sun Jul 31 23:42:40 2011 +0900
+++ b/tests/test-hgrc.t	Mon Aug 01 10:54:10 2011 -0500
@@ -54,12 +54,20 @@
   warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
   $ unset FAKEPATH
 
-make sure unspecified global ui options don't override old values
+make sure global options given on the cmdline take precedence
 
   $ hg showconfig --config ui.verbose=True --quiet
-  ui.verbose=True
+  ui.verbose=False
+  ui.debug=False
   ui.quiet=True
 
+  $ touch foobar/untracked
+  $ cat >> foobar/.hg/hgrc <<EOF
+  > [ui]
+  > verbose=True
+  > EOF
+  $ hg -R foobar st -q
+
 username expansion
 
   $ olduser=$HGUSER
@@ -140,7 +148,9 @@
   $ hg showconfig --config ui.traceback=True --debug
   read config from: $TESTTMP/hgrc
   none: ui.traceback=True
+  none: ui.verbose=False
   none: ui.debug=True
+  none: ui.quiet=False
 
 plain mode with exceptions
 
@@ -156,18 +166,24 @@
   read config from: $TESTTMP/hgrc
   $TESTTMP/hgrc:15: extensions.plain=./plain.py
   none: ui.traceback=True
+  none: ui.verbose=False
   none: ui.debug=True
+  none: ui.quiet=False
   $ unset HGPLAIN
   $ hg showconfig --config ui.traceback=True --debug
   plain: True
   read config from: $TESTTMP/hgrc
   $TESTTMP/hgrc:15: extensions.plain=./plain.py
   none: ui.traceback=True
+  none: ui.verbose=False
   none: ui.debug=True
+  none: ui.quiet=False
   $ HGPLAINEXCEPT=i18n; export HGPLAINEXCEPT
   $ hg showconfig --config ui.traceback=True --debug
   plain: True
   read config from: $TESTTMP/hgrc
   $TESTTMP/hgrc:15: extensions.plain=./plain.py
   none: ui.traceback=True
+  none: ui.verbose=False
   none: ui.debug=True
+  none: ui.quiet=False