diff mercurial/ui.py @ 2509:6350b01d173f

merge with wsgi changes.
author Vadim Gelfer <vadim.gelfer@gmail.com>
date Tue, 27 Jun 2006 00:10:41 -0700
parents 18cf95ad3666
children 0875cda033fd 6e5427447f4c
line wrap: on
line diff
--- a/mercurial/ui.py	Tue Jun 27 00:09:37 2006 -0700
+++ b/mercurial/ui.py	Tue Jun 27 00:10:41 2006 -0700
@@ -95,6 +95,15 @@
         else:
             return self.parentui.config(section, name, default)
 
+    def configlist(self, section, name, default=None):
+        """Return a list of comma/space separated strings"""
+        result = self.config(section, name)
+        if result is None:
+            result = default or []
+        if isinstance(result, basestring):
+            result = result.replace(",", " ").split()
+        return result
+
     def configbool(self, section, name, default=False):
         if self.overlay.has_key((section, name)):
             return self.overlay[(section, name)]
@@ -197,12 +206,15 @@
         if not self.verbose: user = util.shortuser(user)
         return user
 
-    def expandpath(self, loc):
+    def expandpath(self, loc, default=None):
         """Return repository location relative to cwd or from [paths]"""
         if loc.find("://") != -1 or os.path.exists(loc):
             return loc
 
-        return self.config("paths", loc, loc)
+        path = self.config("paths", loc)
+        if not path and default is not None:
+            path = self.config("paths", default)
+        return path or loc
 
     def write(self, *args):
         if self.header: