Skip to content

Commit 9ab1cfe

Browse files
luked99gitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 62a3c48 commit 9ab1cfe

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

git-p4.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2494,9 +2494,9 @@ def importP4Labels(self, stream, p4Labels):
24942494
# find the corresponding git commit; take the oldest commit
24952495
changelist = int(change['change'])
24962496
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)
24982498
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)
25002500
else:
25012501
gitCommit = gitCommit.strip()
25022502
commitFound = True

0 commit comments

Comments
 (0)