def helplist(header, select=None): h = {} cmds = {} for c, e in table.iteritems(): f = c.split("|", 1)[0] if select and not select(f): continue if (not select and name != 'shortlist' and e[0].__module__ != __name__): continue if name == "shortlist" and not f.startswith("^"): continue f = f.lstrip("^") if not ui.debugflag and f.startswith("debug"): continue doc = e[0].__doc__ if doc and 'DEPRECATED' in doc and not ui.verbose: continue #doc = gettext(doc) if not doc: doc = _("(no help text available)") h[f] = doc.splitlines()[0].rstrip() cmds[f] = c.lstrip("^") if not h: ui.status(_('no commands defined\n')) return ui.status(header) fns = sorted(h) m = max(map(len, fns)) for f in fns: if ui.verbose: commands = cmds[f].replace("|", ", ") ui.write(" %s:\n %s\n" % (commands, h[f])) else: ui.write('%s\n' % (util.wrap(h[f], textwidth, initindent=' %-*s ' % (m, f), hangindent=' ' * (m + 4)))) if not ui.quiet: addglobalopts(True)
def helplist(header, select=None): h = {} cmds = {} for c, e in table.iteritems(): f = c.split("|", 1)[0] if select and not select(f): continue if (not select and name != 'shortlist' and e[0].__module__ != __name__): continue if name == "shortlist" and not f.startswith("^"): continue f = f.lstrip("^") if not ui.debugflag and f.startswith("debug"): continue doc = e[0].__doc__ if doc and 'DEPRECATED' in doc and not ui.verbose: continue #doc = gettext(doc) if not doc: doc = _("(no help text available)") h[f] = doc.splitlines()[0].rstrip() cmds[f] = c.lstrip("^") if not h: ui.status(_('no commands defined\n')) return ui.status(header) fns = sorted(h) m = max(map(len, fns)) for f in fns: if ui.verbose: commands = cmds[f].replace("|",", ") ui.write(" %s:\n %s\n"%(commands, h[f])) else: ui.write('%s\n' % (util.wrap(h[f], textwidth, initindent=' %-*s ' % (m, f), hangindent=' ' * (m + 4)))) if not ui.quiet: addglobalopts(True)
if "DEPRECATED" in desc and not ui.verbose: continue opt_output.append(("%2s%s" % (shortopt and "-%s" % shortopt, longopt and " --%s" % longopt), "%s%s" % (desc, default and _(" (default: %s)") % default or ""))) if opt_output: opts_len = max([len(line[0]) for line in opt_output if line[1]] or [0]) for first, second in opt_output: if second: initindent = ' %-*s ' % (opts_len, first) hangindent = ' ' * (opts_len + 3) ui.write('%s\n' % (util.wrap(second, textwidth, initindent=initindent, hangindent=hangindent))) else: ui.write("%s\n" % first) def version(ui, **opts): """output version and copyright information""" ui.write(_('TortoiseHg Dialogs (version %s), ' 'Mercurial (version %s)\n') % (thgversion.version(), hglib.hgversion)) if not ui.quiet: ui.write(shortlicense) def debugcomplete(ui, cmd='', **opts): """output list of possible commands""" if opts.get('options'):
opt_output.append(("\n%s" % title, None)) for shortopt, longopt, default, desc in options: if "DEPRECATED" in desc and not ui.verbose: continue opt_output.append( ("%2s%s" % (shortopt and "-%s" % shortopt, longopt and " --%s" % longopt), "%s%s" % (desc, default and _(" (default: %s)") % default or ""))) if opt_output: opts_len = max([len(line[0]) for line in opt_output if line[1]] or [0]) for first, second in opt_output: if second: initindent = ' %-*s ' % (opts_len, first) hangindent = ' ' * (opts_len + 3) ui.write('%s\n' % (util.wrap(second, textwidth, initindent=initindent, hangindent=hangindent))) else: ui.write("%s\n" % first) @command('^hgignore|ignore|filter', [], _('thg hgignore [FILE]')) def hgignore(ui, repoagent, *pats, **opts): """ignore filter editor""" from tortoisehg.hgqt import hgignore as hgignoremod if pats and pats[0].endswith('.hgignore'): pats = [] return hgignoremod.HgignoreDialog(repoagent, None, *pats) @command('import', [('', 'mq', False, _('import to the patch queue (MQ)'))],