def checktool(exe, name=None, abort=True): name = name or exe if not util.findexe(exe): if abort: exc = error.Abort else: exc = MissingTool raise exc(_('cannot find required "%s" tool') % name)
def uisetup(ui): for cmd, path in ui.configitems("extdiff"): path = util.expandpath(path) if cmd.startswith("cmd."): cmd = cmd[4:] if not path: path = util.findexe(cmd) if path is None: path = filemerge.findexternaltool(ui, cmd) or cmd diffopts = ui.config("extdiff", "opts." + cmd) cmdline = util.shellquote(path) if diffopts: cmdline += " " + diffopts elif cmd.startswith("opts."): continue else: if path: # case "cmd = path opts" cmdline = path diffopts = len(pycompat.shlexsplit(cmdline)) > 1 else: # case "cmd =" path = util.findexe(cmd) if path is None: path = filemerge.findexternaltool(ui, cmd) or cmd cmdline = util.shellquote(path) diffopts = False # look for diff arguments in [diff-tools] then [merge-tools] if not diffopts: args = ui.config("diff-tools", cmd + ".diffargs") or ui.config( "merge-tools", cmd + ".diffargs" ) if args: cmdline += " " + args command( cmd, extdiffopts[:], _("hg %s [OPTION]... [FILE]...") % cmd, inferrepo=True )(savedcmd(path, cmdline))