summaryrefslogtreecommitdiff
path: root/git-p4.py
diff options
context:
space:
mode:
authorLuke Diamand <luke@diamand.org>2020-01-29 11:12:42 +0000
committerJunio C Hamano <gitster@pobox.com>2020-01-30 12:20:57 -0800
commit5c3d5020e66caad0418b5696ba0f3d013641fcdd (patch)
treeac9899b658bc0c8693224f4ab49f1901a1050c98 /git-p4.py
parent837b3a6376804ec70b88f06c3f702a38c59196c3 (diff)
downloadgit-5c3d5020e66caad0418b5696ba0f3d013641fcdd.tar.gz
git-p4: add P4CommandException to report errors talking to Perforce
Currently when there is a P4 error, git-p4 calls die() which just exits. This then leaves the git-fast-import process still running, and can even leave p4 itself still running. As a result, git-p4 fails to exit cleanly. This is a particular problem for people running the unit tests in regression. Use this exception to report errors upwards, cleaning up as the error propagates. Signed-off-by: Luke Diamand <luke@diamand.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-p4.py')
-rwxr-xr-xgit-p4.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/git-p4.py b/git-p4.py
index 23724defe8..df2a956622 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -618,6 +618,14 @@ class P4RequestSizeException(P4ServerException):
super(P4RequestSizeException, self).__init__(exit_code, p4_result)
self.limit = limit
+class P4CommandException(P4Exception):
+ """ Something went wrong calling p4 which means we have to give up """
+ def __init__(self, msg):
+ self.msg = msg
+
+ def __str__(self):
+ return self.msg
+
def isModeExecChanged(src_mode, dst_mode):
return isModeExec(src_mode) != isModeExec(dst_mode)