pi-piper: fix crasher on "d" messages
When we have a "d" operation in the public-inbox repository (a message
removal from the index), we aren't properly catching the exception and
the hook dies. Properly deal with this situation and just move on to the
next commit.
Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
diff --git a/grokmirror/pi_piper.py b/grokmirror/pi_piper.py
index 69b6627..1aad091 100755
--- a/grokmirror/pi_piper.py
+++ b/grokmirror/pi_piper.py
@@ -128,8 +128,8 @@
latest_good = None
ecode = 0
for commit_id, subject in revlist:
- msgbytes = git_get_message_from_pi(repo, commit_id)
- if msgbytes:
+ try:
+ msgbytes = git_get_message_from_pi(repo, commit_id)
if dryrun:
logger.info(' piping: %s (%s b) [DRYRUN]', commit_id, len(msgbytes))
logger.debug(' subject: %s', subject)
@@ -142,6 +142,8 @@
logger.info(err)
break
latest_good = commit_id
+ except KeyError:
+ logger.info('Skipping %s', commit_id)
if latest_good and not dryrun:
with open(statf, 'w') as fh: