From: Lin Yang Date: Mon, 1 Jul 2013 02:58:27 +0000 (+0800) Subject: Catch exception when git describe X-Git-Tag: 0.14~106 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6bc6d72516fb5ce1bcc788e2b5b87a78f1354473;p=services%2Fjenkins-scripts.git Catch exception when git describe Change-Id: I0c5b19348ae8b4a09f884929dd40aa129a6b3ebb Signed-off-by: Lin Yang --- 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