changeset 8196:b7c85a809a54

ui: fix-up and warn about deprecated %%
author Matt Mackall <mpm@selenic.com>
date Sun, 26 Apr 2009 16:50:43 -0500
parents 1750510251d0
children d94f17c27505
files mercurial/ui.py
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/ui.py	Sun Apr 26 16:50:43 2009 -0500
+++ b/mercurial/ui.py	Sun Apr 26 16:50:43 2009 -0500
@@ -226,14 +226,22 @@
         if not self.verbose: user = util.shortuser(user)
         return user
 
+    def _path(self, loc):
+        p = self.config('paths', loc)
+        if p and '%%' in p:
+            ui.warn('(deprecated \'\%\%\' in path %s=%s from %s)\n' %
+                    (loc, p, self.configsource('paths', loc)))
+            return p.replace('%%', '%')
+        return p
+
     def expandpath(self, loc, default=None):
         """Return repository location relative to cwd or from [paths]"""
         if "://" in loc or os.path.isdir(os.path.join(loc, '.hg')):
             return loc
 
-        path = self.config("paths", loc)
+        path = self._path(loc)
         if not path and default is not None:
-            path = self.config("paths", default)
+            path = self._path(default)
         return path or loc
 
     def pushbuffer(self):