##// END OF EJS Templates
extensions: drop maxlength from enabled and disabled...
Matt Mackall -
r14316:d5b52569 default
parent child Browse files
Show More
@@ -157,16 +157,7 b' def commandprinter(ui, cmdtable, section'
157 157
158 158
159 159 def allextensionnames():
160 extensionnames = []
161
162 extensionsdictionary = extensions.enabled()[0]
163 extensionnames.extend(extensionsdictionary.keys())
164
165 extensionsdictionary = extensions.disabled()[0]
166 extensionnames.extend(extensionsdictionary.keys())
167
168 return extensionnames
169
160 return extensions.enabled().keys() + extensions.disabled().keys()
170 161
171 162 if __name__ == "__main__":
172 163 show_doc(sys.stdout)
@@ -2752,8 +2752,7 b' def help_(ui, name=None, with_version=Fa'
2752 2752 doc = gettext(mod.__doc__).splitlines()[0]
2753 2753
2754 2754 msg = help.listexts(_("'%s' is provided by the following "
2755 "extension:") % cmd, {ext: doc}, len(ext),
2756 indent=4)
2755 "extension:") % cmd, {ext: doc}, indent=4)
2757 2756 ui.write(minirst.format(msg, textwidth))
2758 2757 ui.write('\n\n')
2759 2758 ui.write(_('use "hg help extensions" for information on enabling '
@@ -2799,8 +2798,7 b' def help_(ui, name=None, with_version=Fa'
2799 2798
2800 2799 helplist(header)
2801 2800 if name != 'shortlist':
2802 exts, maxlength = extensions.enabled()
2803 text = help.listexts(_('enabled extensions:'), exts, maxlength)
2801 text = help.listexts(_('enabled extensions:'), extensions.enabled())
2804 2802 if text:
2805 2803 ui.write("\n%s\n" % minirst.format(text, textwidth))
2806 2804
@@ -230,20 +230,15 b' def disabled():'
230 230
231 231 paths = _disabledpaths()
232 232 if not paths:
233 return None, 0
233 return None
234 234
235 235 exts = {}
236 maxlength = 0
237 236 for name, path in paths.iteritems():
238 237 doc = _disabledhelp(path)
239 if not doc:
240 continue
238 if doc:
239 exts[name] = doc
241 240
242 exts[name] = doc
243 if len(name) > maxlength:
244 maxlength = len(name)
245
246 return exts, maxlength
241 return exts
247 242
248 243 def disabledext(name):
249 244 '''find a specific disabled extension from hgext. returns desc'''
@@ -299,11 +294,9 b' def disabledcmd(ui, cmd, strict=False):'
299 294 def enabled():
300 295 '''return a dict of {name: desc} of extensions, and the max name length'''
301 296 exts = {}
302 maxlength = 0
303 297 for ename, ext in extensions():
304 298 doc = (gettext(ext.__doc__) or _('(no help text available)'))
305 299 ename = ename.split('.')[-1]
306 maxlength = max(len(ename), maxlength)
307 300 exts[ename] = doc.splitlines()[0].strip()
308 301
309 return exts, maxlength
302 return exts
@@ -43,10 +43,11 b' def moduledoc(file):'
43 43
44 44 return ''.join(result)
45 45
46 def listexts(header, exts, maxlength, indent=1):
46 def listexts(header, exts, indent=1):
47 47 '''return a text listing of the given extensions'''
48 48 if not exts:
49 49 return ''
50 maxlength = max(len(e) for e in exts)
50 51 result = '\n%s\n\n' % header
51 52 for name, desc in sorted(exts.iteritems()):
52 53 result += '%s%-*s %s\n' % (' ' * indent, maxlength + 2,
@@ -55,13 +56,8 b' def listexts(header, exts, maxlength, in'
55 56
56 57 def extshelp():
57 58 doc = loaddoc('extensions')()
58
59 exts, maxlength = extensions.enabled()
60 doc += listexts(_('enabled extensions:'), exts, maxlength)
61
62 exts, maxlength = extensions.disabled()
63 doc += listexts(_('disabled extensions:'), exts, maxlength)
64
59 doc += listexts(_('enabled extensions:'), extensions.enabled())
60 doc += listexts(_('disabled extensions:'), extensions.disabled())
65 61 return doc
66 62
67 63 def loaddoc(topic):
@@ -408,7 +408,7 b' class hgsubrepo(abstractsubrepo):'
408 408 if r == '' and not ignoreupdate: # no state recorded
409 409 return True
410 410 w = self._repo[None]
411 if r != w.p1().node() and not ignoreupdate:
411 if r != w.p1().hex() and not ignoreupdate:
412 412 # different version checked out
413 413 return True
414 414 return w.dirty() # working directory changed
General Comments 0
You need to be logged in to leave comments. Login now