ui: fix-up and warn about deprecated %%
authorMatt Mackall <mpm@selenic.com>
Sun, 26 Apr 2009 16:50:43 -0500
changeset 8196 b7c85a809a54
parent 8195 1750510251d0
child 8197 d94f17c27505
ui: fix-up and warn about deprecated %%
mercurial/ui.py
--- 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):