url: expand path for web.cacerts stable
authorEduard-Cristian Stefan <alexandrul.ct@gmail.com>
Sun, 02 Jan 2011 15:30:12 +0200
branchstable
changeset 13231 b335882c2f21
parent 13230 827a1cc127bf
child 13232 b25b5ad0cca8
url: expand path for web.cacerts
mercurial/hg.py
mercurial/url.py
tests/test-https.t
--- a/mercurial/hg.py	Wed Jan 05 10:47:35 2011 +0100
+++ b/mercurial/hg.py	Sun Jan 02 15:30:12 2011 +0200
@@ -551,6 +551,6 @@
             dst.setconfig(sect, key, val)
     v = src.config('web', 'cacerts')
     if v:
-        dst.setconfig('web', 'cacerts', v)
+        dst.setconfig('web', 'cacerts', util.expandpath(v))
 
     return dst
--- a/mercurial/url.py	Wed Jan 05 10:47:35 2011 +0100
+++ b/mercurial/url.py	Sun Jan 02 15:30:12 2011 +0200
@@ -512,6 +512,8 @@
         def connect(self):
             if hasattr(self, 'ui'):
                 cacerts = self.ui.config('web', 'cacerts')
+                if cacerts:
+                    cacerts = util.expandpath(cacerts)
             else:
                 cacerts = None
 
--- a/tests/test-https.t	Wed Jan 05 10:47:35 2011 +0100
+++ b/tests/test-https.t	Sun Jan 02 15:30:12 2011 +0200
@@ -154,11 +154,12 @@
   no changes found
   $ mv copy-pull/.hg/hgrc.bu copy-pull/.hg/hgrc
 
-cacert configured globally
+cacert configured globally, also testing expansion of environment
+variables in the filename
 
   $ echo "[web]" >> $HGRCPATH
-  $ echo "cacerts=`pwd`/pub.pem" >> $HGRCPATH
-  $ hg -R copy-pull pull
+  $ echo 'cacerts=$P/pub.pem' >> $HGRCPATH
+  $ P=`pwd` hg -R copy-pull pull
   pulling from https://localhost:$HGPORT/
   searching for changes
   no changes found