comparison mercurial/commands.py @ 29632:53e2c979e4cd stable

graft: use opts.get() consistently Make life easier for extension writers.
author Gábor Stefanik <gabor.stefanik@nng.com>
date Mon, 25 Jul 2016 17:00:42 +0200
parents 9c3786713926
children 9b6dc989f02b
comparison
equal deleted inserted replaced
29631:387bdd53c77e 29632:53e2c979e4cd
4087 ''' 4087 '''
4088 with repo.wlock(): 4088 with repo.wlock():
4089 return _dograft(ui, repo, *revs, **opts) 4089 return _dograft(ui, repo, *revs, **opts)
4090 4090
4091 def _dograft(ui, repo, *revs, **opts): 4091 def _dograft(ui, repo, *revs, **opts):
4092 if revs and opts['rev']: 4092 if revs and opts.get('rev'):
4093 ui.warn(_('warning: inconsistent use of --rev might give unexpected ' 4093 ui.warn(_('warning: inconsistent use of --rev might give unexpected '
4094 'revision ordering!\n')) 4094 'revision ordering!\n'))
4095 4095
4096 revs = list(revs) 4096 revs = list(revs)
4097 revs.extend(opts['rev']) 4097 revs.extend(opts.get('rev'))
4098 4098
4099 if not opts.get('user') and opts.get('currentuser'): 4099 if not opts.get('user') and opts.get('currentuser'):
4100 opts['user'] = ui.username() 4100 opts['user'] = ui.username()
4101 if not opts.get('date') and opts.get('currentdate'): 4101 if not opts.get('date') and opts.get('currentdate'):
4102 opts['date'] = "%d %d" % util.makedate() 4102 opts['date'] = "%d %d" % util.makedate()
4103 4103
4104 editor = cmdutil.getcommiteditor(editform='graft', **opts) 4104 editor = cmdutil.getcommiteditor(editform='graft', **opts)
4105 4105
4106 cont = False 4106 cont = False
4107 if opts['continue']: 4107 if opts.get('continue'):
4108 cont = True 4108 cont = True
4109 if revs: 4109 if revs:
4110 raise error.Abort(_("can't specify --continue and revisions")) 4110 raise error.Abort(_("can't specify --continue and revisions"))
4111 # read in unfinished revisions 4111 # read in unfinished revisions
4112 try: 4112 try: