From e7fd56b5d06092a842386e250d86673529f51ed3 Mon Sep 17 00:00:00 2001 From: Brian Stinson Date: Jul 20 2015 21:54:11 +0000 Subject: handle old branches (like virt7) but raise a warning --- diff --git a/src/centpkg/__init__.py b/src/centpkg/__init__.py index 97c01be..0935933 100644 --- a/src/centpkg/__init__.py +++ b/src/centpkg/__init__.py @@ -18,6 +18,7 @@ import os import re +import warnings from pyrpkg import Commands, rpkgError from . import centos_cert @@ -34,8 +35,10 @@ class DistGitDirectory(object): def __init__(self, branchtext): sigtobranchre = r'sig-(?P\w+)(?P\d)-?(?P\w+)?-?(?P\w+)?' distrobranchre = r'c(?P\d+)-?(?P\w+)?' + oldbranchre = r'(?P\w+)(?P\d)' sigmatch = re.match(sigtobranchre, branchtext) distromatch = re.match(distrobranchre, branchtext) + oldbranchmatch = re.match(oldbranchre, branchtext) if sigmatch: gd = sigmatch.groupdict() self.signame = gd['signame'] @@ -56,6 +59,9 @@ class DistGitDirectory(object): if gd['projectname'] != 'common': self.projectname = gd['projectname'] + elif oldbranchmatch: + warnings.warn("This branch is deprecated and will be removed soon", + DeprecationWarning) else: raise ValueError("Branchname: {0} is not valid".format(branchtext))