Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.8, 0.8.1, and 0.8.2

hgtk: bring help logic up to date with Mercurial

Fixes #334

Changeset d8d38b17809a

Parent 86e1cc3e60f8

by Steve Borho

Changes to one file · Browse files at d8d38b17809a Showing diff from parent 86e1cc3e60f8 Diff from another changeset...

Change 1 of 2 Show Entire File hggtk/​hgtk.py Stacked
 
436
437
438
439
 
 
 
 
 
 
 
 
440
441
442
 
496
497
498
499
500
501
502
503
504
505
 
 
 
 
 
506
507
508
509
510
511
512
 
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
 
542
543
544
 
436
437
438
 
439
440
441
442
443
444
445
446
447
448
449
 
503
504
505
 
 
 
 
 
 
 
506
507
508
509
510
511
512
513
 
514
515
 
516
517
518
519
520
521
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
522
523
 
524
525
526
527
@@ -436,7 +436,14 @@
  if with_version:   version(ui)   ui.write('\n') - aliases, i = cmdutil.findcmd(name, table) + + try: + aliases, i = cmdutil.findcmd(name, table, False) + except hglib.AmbiguousCommand, inst: + select = lambda c: c.lstrip('^').startswith(inst.args[0]) + helplist('list of commands:\n\n', select) + return +   # synopsis   ui.write("%s\n" % i[2])   @@ -496,49 +503,25 @@
  addglobalopts(True)     def helptopic(name): - v = None - for i in help.helptable: - l = i.split('|') - if name in l: - v = i - header = l[-1] - if not v: + from mercurial import help + for names, header, doc in help.helptable: + if name in names: + break + else:   raise hglib.UnknownCommand(name)     # description - doc = help.helptable[v]   if not doc:   doc = _("(No help text available)") - if callable(doc): + if hasattr(doc, '__call__'):   doc = doc()     ui.write("%s\n" % header)   ui.write("%s\n" % doc.rstrip())   - def helpext(name): - try: - mod = extensions.find(name) - except KeyError: - raise hglib.UnknownCommand(name) - - doc = (mod.__doc__ or _('No help text available')).splitlines(0) - ui.write(_('%s extension - %s\n') % (name.split('.')[-1], doc[0])) - for d in doc[1:]: - ui.write(d, '\n') - - ui.status('\n') - - try: - ct = mod.cmdtable - except AttributeError: - ct = {} - - modcmds = dict.fromkeys([c.split('|', 1)[0] for c in ct]) - helplist(_('list of commands:\n\n'), modcmds.has_key) -   if name and name != 'shortlist':   i = None - for f in (helpcmd, helptopic, helpext): + for f in (helpcmd, helptopic):   try:   f(name)   i = None