Mercurial > public > mercurial-scm > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
2508:ab460a3f0e3a | 2509:6350b01d173f |
---|---|
93 if self.parentui is None: | 93 if self.parentui is None: |
94 return default | 94 return default |
95 else: | 95 else: |
96 return self.parentui.config(section, name, default) | 96 return self.parentui.config(section, name, default) |
97 | 97 |
98 def configlist(self, section, name, default=None): | |
99 """Return a list of comma/space separated strings""" | |
100 result = self.config(section, name) | |
101 if result is None: | |
102 result = default or [] | |
103 if isinstance(result, basestring): | |
104 result = result.replace(",", " ").split() | |
105 return result | |
106 | |
98 def configbool(self, section, name, default=False): | 107 def configbool(self, section, name, default=False): |
99 if self.overlay.has_key((section, name)): | 108 if self.overlay.has_key((section, name)): |
100 return self.overlay[(section, name)] | 109 return self.overlay[(section, name)] |
101 if self.cdata.has_option(section, name): | 110 if self.cdata.has_option(section, name): |
102 try: | 111 try: |
195 def shortuser(self, user): | 204 def shortuser(self, user): |
196 """Return a short representation of a user name or email address.""" | 205 """Return a short representation of a user name or email address.""" |
197 if not self.verbose: user = util.shortuser(user) | 206 if not self.verbose: user = util.shortuser(user) |
198 return user | 207 return user |
199 | 208 |
200 def expandpath(self, loc): | 209 def expandpath(self, loc, default=None): |
201 """Return repository location relative to cwd or from [paths]""" | 210 """Return repository location relative to cwd or from [paths]""" |
202 if loc.find("://") != -1 or os.path.exists(loc): | 211 if loc.find("://") != -1 or os.path.exists(loc): |
203 return loc | 212 return loc |
204 | 213 |
205 return self.config("paths", loc, loc) | 214 path = self.config("paths", loc) |
215 if not path and default is not None: | |
216 path = self.config("paths", default) | |
217 return path or loc | |
206 | 218 |
207 def write(self, *args): | 219 def write(self, *args): |
208 if self.header: | 220 if self.header: |
209 if self.header != self.prev_header: | 221 if self.header != self.prev_header: |
210 self.prev_header = self.header | 222 self.prev_header = self.header |