X-Git-Url: https://git.distorted.org.uk/~mdw/stgit/blobdiff_plain/5660771ca427fedb50cb3607e6b76c299d5d5fa3..9ab06b9858bbb0196867506724a8d74c8f39e113:/stgit/commands/common.py diff --git a/stgit/commands/common.py b/stgit/commands/common.py index dfd7e26..bc8266e 100644 --- a/stgit/commands/common.py +++ b/stgit/commands/common.py @@ -97,6 +97,15 @@ def git_commit(name, repository, branch_name = None): except libgit.RepositoryException: raise CmdException('%s: Unknown patch or revision name' % name) +def color_diff_flags(): + """Return the git flags for coloured diff output if the configuration and + stdout allows.""" + stdout_is_tty = (sys.stdout.isatty() and 'true') or 'false' + if config.get_colorbool('color.diff', stdout_is_tty) == 'true': + return ['--color'] + else: + return [] + def check_local_changes(): if git.local_changes(): raise CmdException('local changes in the tree. Use "refresh" or' @@ -111,7 +120,7 @@ def check_head_top_equal(crt_series): def check_conflicts(): if git.get_conflicts(): raise CmdException('Unsolved conflicts. Please fix the conflicts' - ' then use "resolve " or revert the' + ' then use "git add --update " or revert the' ' changes with "status --reset".') def print_crt_patch(crt_series, branch = None):