##// END OF EJS Templates
help: replace some str.split() calls by str.partition() or str.rpartition()...
av6 -
r26845:7a77ee43 default
parent child Browse files
Show More
@@ -115,20 +115,20 b' def topicmatch(ui, kw):'
115 doclines = docs.splitlines()
115 doclines = docs.splitlines()
116 if doclines:
116 if doclines:
117 summary = doclines[0]
117 summary = doclines[0]
118 cmdname = cmd.split('|')[0].lstrip('^')
118 cmdname = cmd.partition('|')[0].lstrip('^')
119 results['commands'].append((cmdname, summary))
119 results['commands'].append((cmdname, summary))
120 for name, docs in itertools.chain(
120 for name, docs in itertools.chain(
121 extensions.enabled(False).iteritems(),
121 extensions.enabled(False).iteritems(),
122 extensions.disabled().iteritems()):
122 extensions.disabled().iteritems()):
123 # extensions.load ignores the UI argument
123 # extensions.load ignores the UI argument
124 mod = extensions.load(None, name, '')
124 mod = extensions.load(None, name, '')
125 name = name.split('.')[-1]
125 name = name.rpartition('.')[-1]
126 if lowercontains(name) or lowercontains(docs):
126 if lowercontains(name) or lowercontains(docs):
127 # extension docs are already translated
127 # extension docs are already translated
128 results['extensions'].append((name, docs.splitlines()[0]))
128 results['extensions'].append((name, docs.splitlines()[0]))
129 for cmd, entry in getattr(mod, 'cmdtable', {}).iteritems():
129 for cmd, entry in getattr(mod, 'cmdtable', {}).iteritems():
130 if kw in cmd or (len(entry) > 2 and lowercontains(entry[2])):
130 if kw in cmd or (len(entry) > 2 and lowercontains(entry[2])):
131 cmdname = cmd.split('|')[0].lstrip('^')
131 cmdname = cmd.partition('|')[0].lstrip('^')
132 if entry[0].__doc__:
132 if entry[0].__doc__:
133 cmddoc = gettext(entry[0].__doc__).splitlines()[0]
133 cmddoc = gettext(entry[0].__doc__).splitlines()[0]
134 else:
134 else:
@@ -330,7 +330,7 b' def help_(ui, name, unknowncmd=False, fu'
330 h = {}
330 h = {}
331 cmds = {}
331 cmds = {}
332 for c, e in commands.table.iteritems():
332 for c, e in commands.table.iteritems():
333 f = c.split("|", 1)[0]
333 f = c.partition("|")[0]
334 if select and not select(f):
334 if select and not select(f):
335 continue
335 continue
336 if (not select and name != 'shortlist' and
336 if (not select and name != 'shortlist' and
@@ -445,7 +445,7 b' def help_(ui, name, unknowncmd=False, fu'
445 head, tail = doc, ""
445 head, tail = doc, ""
446 else:
446 else:
447 head, tail = doc.split('\n', 1)
447 head, tail = doc.split('\n', 1)
448 rst = [_('%s extension - %s\n\n') % (name.split('.')[-1], head)]
448 rst = [_('%s extension - %s\n\n') % (name.rpartition('.')[-1], head)]
449 if tail:
449 if tail:
450 rst.extend(tail.splitlines(True))
450 rst.extend(tail.splitlines(True))
451 rst.append('\n')
451 rst.append('\n')
@@ -460,7 +460,7 b' def help_(ui, name, unknowncmd=False, fu'
460 ct = mod.cmdtable
460 ct = mod.cmdtable
461 except AttributeError:
461 except AttributeError:
462 ct = {}
462 ct = {}
463 modcmds = set([c.split('|', 1)[0] for c in ct])
463 modcmds = set([c.partition('|')[0] for c in ct])
464 rst.extend(helplist(modcmds.__contains__))
464 rst.extend(helplist(modcmds.__contains__))
465 else:
465 else:
466 rst.append(_('(use "hg help extensions" for information on enabling'
466 rst.append(_('(use "hg help extensions" for information on enabling'
General Comments 0
You need to be logged in to leave comments. Login now