def get_mercurial_default_options_dict( command, command_table=None, **kwd ): '''Borrowed from repoman - get default parameters for a mercurial command.''' if command_table is None: command_table = commands.table possible = cmdutil.findpossible( command, command_table ) if len( possible ) != 1: raise Exception, 'unable to find mercurial command "%s"' % command default_options_dict = dict( ( r[ 1 ].replace( '-', '_' ), r[ 2 ] ) for r in possible[ possible.keys()[ 0 ] ][ 1 ][ 1 ] ) for option in kwd: default_options_dict[ option ] = kwd[ option ] return default_options_dict
def get_mercurial_default_options_dict( command, command_table=None, **kwd ): '''Borrowed from repoman - get default parameters for a mercurial command.''' if command_table is None: command_table = commands.table possible = cmdutil.findpossible( command, command_table ) if len( possible ) != 1: raise Exception('unable to find mercurial command "%s"' % command) default_options_dict = dict( ( r[ 1 ].replace( '-', '_' ), r[ 2 ] ) for r in possible[ possible.keys()[ 0 ] ][ 1 ][ 1 ] ) for option in kwd: default_options_dict[ option ] = kwd[ option ] return default_options_dict
def get_mercurial_default_options_dict( command, command_table=None, **kwd ): '''Borrowed from repoman - get default parameters for a mercurial command.''' if command_table is None: command_table = commands.table possible = cmdutil.findpossible( command, command_table ) # Mercurial >= 3.4 returns a tuple whose first element is the old return dict if type(possible) is tuple: possible = possible[0] if len( possible ) != 1: raise Exception('unable to find mercurial command "%s"' % command) default_options_dict = dict( ( r[1].replace( '-', '_' ), r[2] ) for r in possible.values()[0][1][1] ) for option in kwd: default_options_dict[ option ] = kwd[ option ] return default_options_dict
def get_mercurial_default_options_dict(command, command_table=None, **kwd): '''Borrowed from repoman - get default parameters for a mercurial command.''' if command_table is None: command_table = commands.table possible = cmdutil.findpossible(command, command_table) # Mercurial >= 3.4 returns a tuple whose first element is the old return dict if type(possible) is tuple: possible = possible[0] if len(possible) != 1: raise Exception('unable to find mercurial command "%s"' % command) default_options_dict = dict((r[1].replace('-', '_'), r[2]) for r in next(iter(possible.values()))[1][1]) for option in kwd: default_options_dict[option] = kwd[option] return default_options_dict
def extsetup(ui): # Alias `hg <prefix><view>` to `hg show <view>`. for prefix in ui.configlist('commands', 'show.aliasprefix'): for view in showview._table: name = '%s%s' % (prefix, view) choice, allcommands = cmdutil.findpossible(name, commands.table, strict=True) # This alias is already a command name. Don't set it. if name in choice: continue # Same for aliases. if ui.config('alias', name, None): continue ui.setconfig('alias', name, 'show %s' % view, source='show')
def debugcomplete(ui, cmd='', **opts): """output list of possible commands""" if opts.get('options'): options = [] otables = [globalopts] if cmd: aliases, entry = cmdutil.findcmd(cmd, table, False) otables.append(entry[1]) for t in otables: for o in t: if o[0]: options.append('-%s' % o[0]) options.append('--%s' % o[1]) ui.write("%s\n" % "\n".join(options)) return cmdlist = cmdutil.findpossible(cmd, table) if ui.verbose: cmdlist = [' '.join(c[0]) for c in cmdlist.values()] ui.write("%s\n" % "\n".join(sorted(cmdlist)))