diff options
Diffstat (limited to 'git_review')
-rw-r--r-- | git_review/cmd.py | 13 | ||||
-rw-r--r-- | git_review/tests/test_unit.py | 2 |
2 files changed, 13 insertions, 2 deletions
diff --git a/git_review/cmd.py b/git_review/cmd.py index ea09278..5b65812 100644 --- a/git_review/cmd.py +++ b/git_review/cmd.py @@ -373,9 +373,17 @@ def set_hooks_commit_msg(remote, target_file): userhost = hostname # OS independent target file scp_target_file = target_file.replace(os.sep, "/") + + # Get scp options + scp_out = run_command("scp") + scp_opts = scp_out[scp_out.index("[") + 2:scp_out.index("]")] + cmd = ["scp", userhost + ":hooks/commit-msg", scp_target_file] if port is not None: cmd.insert(1, "-P%s" % port) + # Force scp protocol if the -O option is available + if "O" in scp_opts: + cmd.insert(1, "-O") if VERBOSE: hook_url = 'scp://%s%s/hooks/commit-msg' \ @@ -1005,7 +1013,10 @@ def assert_one_change(remote, branch, yes, have_hook): "branches (for independent changes).") print("\nThe outstanding commits are:\n\n%s\n\n" "Do you really want to submit the above commits?" % output) - yes_no = input("Type 'yes' to confirm, other to cancel: ") + try: + yes_no = input("Type 'yes' to confirm, other to cancel: ") + except KeyboardInterrupt: + yes_no = "no" if yes_no.lower().strip() != "yes": print("Aborting.") sys.exit(1) diff --git a/git_review/tests/test_unit.py b/git_review/tests/test_unit.py index 7dc0c0e..1bbdbff 100644 --- a/git_review/tests/test_unit.py +++ b/git_review/tests/test_unit.py @@ -21,9 +21,9 @@ import io import os import sys import textwrap +from unittest import mock import fixtures -import mock import testtools from git_review import cmd |