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