From 6bc6d72516fb5ce1bcc788e2b5b87a78f1354473 Mon Sep 17 00:00:00 2001 From: Lin Yang Date: Mon, 1 Jul 2013 10:58:27 +0800 Subject: [PATCH] Catch exception when git describe Change-Id: I0c5b19348ae8b4a09f884929dd40aa129a6b3ebb Signed-off-by: Lin Yang --- job_submitobs.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/job_submitobs.py b/job_submitobs.py index d48e1eb..473e419 100755 --- a/job_submitobs.py +++ b/job_submitobs.py @@ -23,6 +23,7 @@ from common import gerrit from common.send_mail import prepare_mail import gbp.rpm +from gbp.git.repository import GitRepositoryError WRONG_VERSION_MSG = '- The tag means you want to submit commit %s in %s branch'\ ' to OBS, but this commit does NOT exist in %s branch. '\ @@ -88,8 +89,12 @@ def find_submit_tag(event, mygit): branch = event['branch'] if event['branch'] == 'master': branch = 'trunk' - tag = mygit.describe(event['patchset_revision'], pattern='submit/%s/*' - % branch, exact_match=True) + try: + tag = mygit.describe(event['patchset_revision'], pattern='submit/%s/*' + % branch, exact_match=True) + except GitRepositoryError, err: + # don'n find submit tag on this commit, return None + tag = None return tag -- 2.7.4