From 1f49d7c0ea7b0755ab309818d570419803a6f45d Mon Sep 17 00:00:00 2001 From: Zhang Qiang Date: Mon, 28 Jan 2013 11:41:12 -0500 Subject: [PATCH] Add tag format check Currently, valid tag format is: submit/$target/$date.$time Change-Id: Ie209565c1dc20bdc9e27a46579da5dbc902432f9 --- gitbuildsys/cmd_submit.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gitbuildsys/cmd_submit.py b/gitbuildsys/cmd_submit.py index 181e4f1..5e466e4 100644 --- a/gitbuildsys/cmd_submit.py +++ b/gitbuildsys/cmd_submit.py @@ -19,6 +19,7 @@ """Implementation of subcmd: submit""" import os +import re import time from gitbuildsys.utils import edit @@ -77,6 +78,11 @@ def main(args): if args.tag: tagname = args.tag + tag_re = re.compile(r'^submit/\S+/\d{8}\.\d{6}$') + if not tag_re.match(tagname): + raise GbsError("invalid tag %s, valid tag format is " + "submit/$target/$date.$time. For example:\n " + "submit/trunk/20130128.022439 " % tagname) else: target = args.target if not target: -- 2.7.4