comparison mercurial/ui.py @ 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 94246e90081e
children d94f17c27505
comparison
equal deleted inserted replaced
8195:1750510251d0 8196:b7c85a809a54
224 def shortuser(self, user): 224 def shortuser(self, user):
225 """Return a short representation of a user name or email address.""" 225 """Return a short representation of a user name or email address."""
226 if not self.verbose: user = util.shortuser(user) 226 if not self.verbose: user = util.shortuser(user)
227 return user 227 return user
228 228
229 def _path(self, loc):
230 p = self.config('paths', loc)
231 if p and '%%' in p:
232 ui.warn('(deprecated \'\%\%\' in path %s=%s from %s)\n' %
233 (loc, p, self.configsource('paths', loc)))
234 return p.replace('%%', '%')
235 return p
236
229 def expandpath(self, loc, default=None): 237 def expandpath(self, loc, default=None):
230 """Return repository location relative to cwd or from [paths]""" 238 """Return repository location relative to cwd or from [paths]"""
231 if "://" in loc or os.path.isdir(os.path.join(loc, '.hg')): 239 if "://" in loc or os.path.isdir(os.path.join(loc, '.hg')):
232 return loc 240 return loc
233 241
234 path = self.config("paths", loc) 242 path = self._path(loc)
235 if not path and default is not None: 243 if not path and default is not None:
236 path = self.config("paths", default) 244 path = self._path(default)
237 return path or loc 245 return path or loc
238 246
239 def pushbuffer(self): 247 def pushbuffer(self):
240 self.buffers.append([]) 248 self.buffers.append([])
241 249