git-p4: do not terminate creating tag for unknown commit

If p4 reports a tag for a commit that git-p4 does not know about (e.g. because it references a P4 changelist that was imported prior to the point at which the repo was cloned into git), make sure that the error is correctly caught and handled. rather than just crashing. Signed-off-by: Luke Diamand <luke@diamand.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Luke Diamand committed Aug 27, 2015 at 08:18 UTC 9ab1cfe505d43215a61dc5012632dde66fe109db
1 file changed +2 -2
git-p4.py
+2 -2
@@ -2494,9 +2494,9 @@ class P4Sync(Command, P4UserMap):
2494 # find the corresponding git commit; take the oldest commit
2495 changelist = int(change['change'])
2496 gitCommit = read_pipe(["git", "rev-list", "--max-count=1",
2497 - "--reverse", ":/\[git-p4:.*change = %d\]" % changelist])
2497 + "--reverse", ":/\[git-p4:.*change = %d\]" % changelist], ignore_error=True)
2498 if len(gitCommit) == 0:
2499 - print "could not find git commit for changelist %d" % changelist
2499 + print "importing label %s: could not find git commit for changelist %d" % (name, changelist)
2500 else:
2501 gitCommit = gitCommit.strip()
2502 commitFound = True