comparison hgext/record.py @ 13196:592998ba3466

record: clean up command table The --force option to qnew has become a no-op, so qrecord doesn't need to use it. This allows record's command table to be simplified; in the process of doing so, this patch also cleans up the cmdtable visually.
author Kevin Bullock <kbullock@ringworld.org>
date Tue, 21 Dec 2010 15:27:58 -0600
parents f14cfcc488fb
children 82133e91ce7d
comparison
equal deleted inserted replaced
13195:f14cfcc488fb 13196:592998ba3466
406 raise util.Abort(_("'mq' extension not loaded")) 406 raise util.Abort(_("'mq' extension not loaded"))
407 407
408 def committomq(ui, repo, *pats, **opts): 408 def committomq(ui, repo, *pats, **opts):
409 mq.new(ui, repo, patch, *pats, **opts) 409 mq.new(ui, repo, patch, *pats, **opts)
410 410
411 opts = opts.copy()
412 opts['force'] = True # always 'qnew -f'
413 dorecord(ui, repo, committomq, *pats, **opts) 411 dorecord(ui, repo, committomq, *pats, **opts)
414 412
415 413
416 def dorecord(ui, repo, commitfunc, *pats, **opts): 414 def dorecord(ui, repo, commitfunc, *pats, **opts):
417 if not ui.interactive(): 415 if not ui.interactive():
555 finally: 553 finally:
556 ui.write = oldwrite 554 ui.write = oldwrite
557 555
558 cmdtable = { 556 cmdtable = {
559 "record": 557 "record":
560 (record, 558 (record, commands.table['^commit|ci'][1], # same options as commit
561
562 # add commit options
563 commands.table['^commit|ci'][1],
564
565 _('hg record [OPTION]... [FILE]...')), 559 _('hg record [OPTION]... [FILE]...')),
566 } 560 }
567 561
568 562
569 def uisetup(ui): 563 def uisetup(ui):
572 except KeyError: 566 except KeyError:
573 return 567 return
574 568
575 qcmdtable = { 569 qcmdtable = {
576 "qrecord": 570 "qrecord":
577 (qrecord, 571 (qrecord, mq.cmdtable['^qnew'][1], # same options as qnew
578
579 # add qnew options, except '--force'
580 [opt for opt in mq.cmdtable['^qnew'][1] if opt[1] != 'force'],
581
582 _('hg qrecord [OPTION]... PATCH [FILE]...')), 572 _('hg qrecord [OPTION]... PATCH [FILE]...')),
583 } 573 }
584 574
585 cmdtable.update(qcmdtable) 575 cmdtable.update(qcmdtable)
586 576