@matheusbsbs / matheus-bagliano / commits / 5c3d5020e6
Fork 0

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>

Luke Diamand committed Jan 29, 2020 at 11:12 UTC 5c3d5020e66caad0418b5696ba0f3d013641fcdd
1 file changed +8
git-p4.py
+8
@@ -618,6 +618,14 @@ class P4RequestSizeException(P4ServerException):
618 super(P4RequestSizeException, self).__init__(exit_code, p4_result)
619 self.limit = limit
620
621 +class P4CommandException(P4Exception):
622 + """ Something went wrong calling p4 which means we have to give up """
623 + def __init__(self, msg):
624 + self.msg = msg
625 +
626 + def __str__(self):
627 + return self.msg
628 +
629 def isModeExecChanged(src_mode, dst_mode):
630 return isModeExec(src_mode) != isModeExec(dst_mode)
631