mercurial/ui.py
changeset 13238 1b591f9b7fd2
parent 13031 3da456d0c885
child 13493 95b0d4c1c9e1
--- a/mercurial/ui.py	Wed Dec 29 18:29:15 2010 -0800
+++ b/mercurial/ui.py	Thu Jan 06 17:04:33 2011 -0600
@@ -153,6 +153,16 @@
                              "%s.%s = %s\n") % (section, name, uvalue))
         return value
 
+    def configpath(self, section, name, default=None, untrusted=False):
+        'get a path config item, expanded relative to config file'
+        v = self.config(section, name, default, untrusted)
+        if not os.path.isabs(v) or "://" not in v:
+            src = self.configsource(section, name, untrusted)
+            if ':' in src:
+                base = os.path.dirname(src.rsplit(':'))
+                v = os.path.join(base, os.path.expanduser(v))
+        return v
+
     def configbool(self, section, name, default=False, untrusted=False):
         v = self.config(section, name, None, untrusted)
         if v is None: