merge with i18n stable stable
authorWagner Bruna <wbruna@softwareexpress.com.br>
Tue, 28 Dec 2010 17:58:14 -0200
branchstable
changeset 13221 a54fde8c45b1
parent 13204 5b83ab614dab (diff)
parent 13220 4a39a6afc892 (current diff)
child 13222 0ac5c8dc5be9
merge with i18n stable
--- a/hgext/notify.py	Tue Dec 21 09:26:59 2010 +0100
+++ b/hgext/notify.py	Tue Dec 28 17:58:14 2010 -0200
@@ -215,8 +215,8 @@
                 s = ctx.description().lstrip().split('\n', 1)[0].rstrip()
                 subject = '%s: %s' % (self.root, s)
         maxsubject = int(self.ui.config('notify', 'maxsubject', 67))
-        if maxsubject and len(subject) > maxsubject:
-            subject = subject[:maxsubject - 3] + '...'
+        if maxsubject:
+            subject = util.ellipsis(subject, maxsubject)
         msg['Subject'] = mail.headencode(self.ui, subject,
                                          self.charsets, self.test)
 
--- a/mercurial/help/templates.txt	Tue Dec 21 09:26:59 2010 +0100
+++ b/mercurial/help/templates.txt	Tue Dec 28 17:58:14 2010 -0200
@@ -25,8 +25,9 @@
 
 :author: String. The unmodified author of the changeset.
 
-:branches: String. The name of the branch on which the changeset was
-    committed. Will be empty if the branch name was default.
+:branches: List of strings. The name of the branch on which the
+    changeset was committed. Will be empty if the branch name was
+    default.
 
 :children: List of strings. The children of the changeset.
 
--- a/mercurial/hg.py	Tue Dec 21 09:26:59 2010 +0100
+++ b/mercurial/hg.py	Tue Dec 28 17:58:14 2010 -0200
@@ -545,9 +545,12 @@
     if r:
         dst.setconfig('bundle', 'mainreporoot', r)
 
-    # copy auth and http_proxy section settings
+    # copy selected local settings to the remote ui
     for sect in ('auth', 'http_proxy'):
         for key, val in src.configitems(sect):
             dst.setconfig(sect, key, val)
+    v = src.config('web', 'cacerts')
+    if v:
+        dst.setconfig('web', 'cacerts', v)
 
     return dst
--- a/mercurial/url.py	Tue Dec 21 09:26:59 2010 +0100
+++ b/mercurial/url.py	Tue Dec 28 17:58:14 2010 -0200
@@ -528,7 +528,7 @@
                               self.host)
             else:
                 self.ui.warn(_("warning: %s certificate not verified "
-                               "(check web.cacerts config setting)\n") % 
+                               "(check web.cacerts config setting)\n") %
                              self.host)
                 httplib.HTTPSConnection.connect(self)
 
--- a/mercurial/util.py	Tue Dec 21 09:26:59 2010 +0100
+++ b/mercurial/util.py	Tue Dec 28 17:58:14 2010 -0200
@@ -391,9 +391,7 @@
             return '1'
         return str(val)
     origcmd = cmd
-    if os.name == 'nt' and sys.version_info < (2, 7, 1):
-        # Python versions since 2.7.1 do this extra quoting themselves
-        cmd = '"%s"' % cmd
+    cmd = quotecommand(cmd)
     env = dict(os.environ)
     env.update((k, py2shell(v)) for k, v in environ.iteritems())
     env['HG'] = hgexecutable()
@@ -719,21 +717,37 @@
 
 def checknlink(testfile):
     '''check whether hardlink count reporting works properly'''
-    f = testfile + ".hgtmp"
 
+    # testfile may be open, so we need a separate file for checking to
+    # work around issue2543 (or testfile may get lost on Samba shares)
+    f1 = testfile + ".hgtmp1"
+    if os.path.lexists(f1):
+        return False
     try:
-        os_link(testfile, f)
-    except OSError:
+        posixfile(f1, 'w').close()
+    except IOError:
         return False
 
+    f2 = testfile + ".hgtmp2"
+    fd = None
     try:
+        try:
+            os_link(f1, f2)
+        except OSError:
+            return False
+
         # nlinks() may behave differently for files on Windows shares if
         # the file is open.
-        fd = open(f)
-        return nlinks(f) > 1
+        fd = open(f2)
+        return nlinks(f2) > 1
     finally:
-        fd.close()
-        os.unlink(f)
+        if fd is not None:
+            fd.close()
+        for f in (f1, f2):
+            try:
+                os.unlink(f)
+            except OSError:
+                pass
 
     return False
 
--- a/mercurial/windows.py	Tue Dec 21 09:26:59 2010 +0100
+++ b/mercurial/windows.py	Tue Dec 28 17:58:14 2010 -0200
@@ -160,9 +160,10 @@
 
 def quotecommand(cmd):
     """Build a command string suitable for os.popen* calls."""
-    # The extra quotes are needed because popen* runs the command
-    # through the current COMSPEC. cmd.exe suppress enclosing quotes.
-    return '"' + cmd + '"'
+    if sys.version_info < (2, 7, 1):
+        # Python versions since 2.7.1 do this extra quoting themselves
+        return '"' + cmd + '"'
+    return cmd
 
 def popen(command, mode='r'):
     # Work around "popen spawned process may not write to stdout
--- a/tests/test-https.t	Tue Dec 21 09:26:59 2010 +0100
+++ b/tests/test-https.t	Tue Dec 28 17:58:14 2010 -0200
@@ -126,7 +126,7 @@
   adding bar
   $ cd ..
 
-pull
+pull without cacert
 
   $ cd copy-pull
   $ echo '[hooks]' >> .hg/hgrc
@@ -143,12 +143,28 @@
   (run 'hg update' to get a working copy)
   $ cd ..
 
-cacert
+cacert configured in local repo
 
-  $ hg -R copy-pull pull --config web.cacerts=pub.pem
+  $ cp copy-pull/.hg/hgrc copy-pull/.hg/hgrc.bu
+  $ echo "[web]" >> copy-pull/.hg/hgrc
+  $ echo "cacerts=`pwd`/pub.pem" >> copy-pull/.hg/hgrc
+  $ hg -R copy-pull pull --traceback
   pulling from https://localhost:$HGPORT/
   searching for changes
   no changes found
+  $ mv copy-pull/.hg/hgrc.bu copy-pull/.hg/hgrc
+
+cacert configured globally
+
+  $ echo "[web]" >> $HGRCPATH
+  $ echo "cacerts=`pwd`/pub.pem" >> $HGRCPATH
+  $ hg -R copy-pull pull
+  pulling from https://localhost:$HGPORT/
+  searching for changes
+  no changes found
+
+cacert mismatch
+
   $ hg -R copy-pull pull --config web.cacerts=pub.pem https://127.0.0.1:$HGPORT/
   abort: 127.0.0.1 certificate error: certificate is for localhost
   [255]