# HG changeset patch # User Matt Mackall # Date 1202088545 21600 # Node ID 090b1a6659014ee5c88f8d877230b9ad7a9a48d1 # Parent 3c9dbb743d2091943950a1f564e899038ad41dac filemerge: add config item for GUI tools .gui indicates whether a tool requires a GUI to run diff -r 3c9dbb743d20 -r 090b1a665901 mercurial/filemerge.py --- a/mercurial/filemerge.py Sun Feb 03 19:29:05 2008 -0600 +++ b/mercurial/filemerge.py Sun Feb 03 19:29:05 2008 -0600 @@ -36,6 +36,8 @@ ui.warn(_("tool %s can't handle symlinks\n") % tmsg) elif binary and not _toolbool(ui, tool, "binary"): ui.warn(_("tool %s can't handle binary\n") % tmsg) + elif not util.gui() and _toolbool(ui, tool, "gui"): + ui.warn(_("tool %s requires a GUI\n") % tmsg) else: return True return False diff -r 3c9dbb743d20 -r 090b1a665901 mercurial/util.py --- a/mercurial/util.py Sun Feb 03 19:29:05 2008 -0600 +++ b/mercurial/util.py Sun Feb 03 19:29:05 2008 -0600 @@ -895,6 +895,10 @@ function if need.''' return path.split(os.sep) +def gui(): + '''Are we running in a GUI?''' + return os.name == "nt" or os.name == "mac" or os.environ.get("DISPLAY") + # Platform specific variants if os.name == 'nt': import msvcrt