git-p4: narrow the scope of exceptions caught when parsing an int
authorLuke Diamand <luke@diamand.org>
Fri, 8 Jun 2018 20:32:47 +0000 (21:32 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 12 Jun 2018 21:46:09 +0000 (14:46 -0700)
The current code traps all exceptions around some code which parses an
integer, and then talks to Perforce.

That can result in errors from Perforce being ignored. Change the code
to only catch the integer conversion exceptions.

Signed-off-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-p4.py
index 90377263fee1f51d20f04f4554b484e3f22c8937..37265fc31dd51c9e55248c901fe13007cbe269a2 100755 (executable)
--- a/git-p4.py
+++ b/git-p4.py
@@ -948,7 +948,7 @@ def p4ChangesForPaths(depotPaths, changeRange, requestedBlockSize):
         try:
             (changeStart, changeEnd) = p4ParseNumericChangeRange(parts)
             block_size = chooseBlockSize(requestedBlockSize)
-        except:
+        except ValueError:
             changeStart = parts[0][1:]
             changeEnd = parts[1]
             if requestedBlockSize: