def runcommand(ui, args): cmd, func, args, options, cmdoptions, alias = _parse(ui, args) cmdoptions['alias'] = alias ui.setconfig("ui", "verbose", str(bool(options["verbose"]))) i18n.setlanguage(ui.config('tortoisehg', 'ui.language')) if options['help']: return help_(ui, cmd) if options['newworkbench']: cmdoptions['newworkbench'] = True path = options['repository'] if path: if path.startswith('bundle:'): s = path[7:].split('+', 1) if len(s) == 1: path, bundle = os.getcwd(), s[0] else: path, bundle = s cmdoptions['bundle'] = os.path.abspath(bundle) path = ui.expandpath(path) # TODO: replace by abspath() if chdir() isn't necessary try: os.chdir(path) path = os.getcwd() except OSError: pass if options['profile']: options['nofork'] = True path = paths.find_root(path) if path: try: lui = ui.copy() lui.readconfig(os.path.join(path, ".hg", "hgrc")) except IOError: pass else: lui = ui hglib.wrapextensionsloader() # enable blacklist of extensions extensions.loadall(lui) args += get_files_from_listfile() if options['quiet']: ui.quiet = True # repository existence will be tested in qtrun() if cmd not in nonrepo_commands.split(): cmdoptions['repository'] = path or options['repository'] or '.' cmdoptions['mainapp'] = True checkedfunc = util.checksignature(func) if cmd in console_commands.split(): d = lambda: checkedfunc(ui, *args, **cmdoptions) else: portable_fork(ui, options) d = lambda: qtrun(checkedfunc, ui, *args, **cmdoptions) return _runcommand(lui, options, cmd, d)
def runcommand(ui, args): cmd, func, args, options, cmdoptions, alias = _parse(ui, args) cmdoptions['alias'] = alias ui.setconfig("ui", "verbose", str(bool(options["verbose"]))) i18n.setlanguage(ui.config('tortoisehg', 'ui.language')) if options['help']: return help_(ui, cmd) if options['newworkbench']: cmdoptions['newworkbench'] = True path = options['repository'] if path: if path.startswith('bundle:'): s = path[7:].split('+', 1) if len(s) == 1: path, bundle = os.getcwd(), s[0] else: path, bundle = s cmdoptions['bundle'] = os.path.abspath(bundle) path = ui.expandpath(path) if not os.path.exists(path) or not os.path.isdir(path + '/.hg'): print 'abort: %s is not a repository' % path return 1 os.chdir(path) if options['fork']: cmdoptions['fork'] = True if options['nofork'] or options['profile']: cmdoptions['nofork'] = True path = paths.find_root(os.getcwd()) if path: cmdoptions['repository'] = path try: lui = ui.copy() lui.readconfig(os.path.join(path, ".hg", "hgrc")) except IOError: pass else: lui = ui hglib.wrapextensionsloader() # enable blacklist of extensions extensions.loadall(lui) args += get_files_from_listfile() if options['quiet']: ui.quiet = True if cmd not in nonrepo_commands.split() and not path: raise error.RepoError( _("There is no Mercurial repository here" " (.hg not found)")) cmdoptions['mainapp'] = True d = lambda: util.checksignature(func)(ui, *args, **cmdoptions) return _runcommand(lui, options, cmd, d)
def runcommand(ui, args): cmd, func, args, options, cmdoptions, alias = _parse(ui, args) cmdoptions['alias'] = alias ui.setconfig("ui", "verbose", str(bool(options["verbose"]))) i18n.setlanguage(ui.config('tortoisehg', 'ui.language')) if options['help']: return help_(ui, cmd) if options['newworkbench']: cmdoptions['newworkbench'] = True path = options['repository'] if path: if path.startswith('bundle:'): s = path[7:].split('+', 1) if len(s) == 1: path, bundle = os.getcwd(), s[0] else: path, bundle = s cmdoptions['bundle'] = os.path.abspath(bundle) path = ui.expandpath(path) if not os.path.exists(path) or not os.path.isdir(path+'/.hg'): print 'abort: %s is not a repository' % path return 1 os.chdir(path) if options['fork']: cmdoptions['fork'] = True if options['nofork'] or options['profile']: cmdoptions['nofork'] = True path = paths.find_root(os.getcwd()) if path: cmdoptions['repository'] = path try: lui = ui.copy() lui.readconfig(os.path.join(path, ".hg", "hgrc")) except IOError: pass else: lui = ui hglib.wrapextensionsloader() # enable blacklist of extensions extensions.loadall(lui) args += get_files_from_listfile() if options['quiet']: ui.quiet = True if cmd not in nonrepo_commands.split() and not path: raise error.RepoError(_("There is no Mercurial repository here" " (.hg not found)")) cmdoptions['mainapp'] = True d = lambda: util.checksignature(func)(ui, *args, **cmdoptions) return _runcommand(lui, options, cmd, d)