From 13e0132532847d082b34acf63f3e77d554d7c6f6 Mon Sep 17 00:00:00 2001 From: Jesse Keating Date: Thu, 17 Feb 2011 11:40:34 -0700 Subject: Clarify and make more exact the branch regex This also catches only top level Fedora branches, without the trailing /master --- src/pyfedpkg/__init__.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/pyfedpkg/__init__.py b/src/pyfedpkg/__init__.py index 17ac668..0ef21bf 100644 --- a/src/pyfedpkg/__init__.py +++ b/src/pyfedpkg/__init__.py @@ -1058,8 +1058,9 @@ class PackageModule: # Create a list of "fedoras" fedoras = [] - # Create a regex to find f## branches. Works until Fedora 100 - branchre = re.compile('f\d\d') + # Create a regex to find branches that exactly match f##. Should not + # catch branches such as f14-foobar + branchre = 'f\d\d$' # Find the repo refs for ref in self.repo.refs: @@ -1067,7 +1068,7 @@ class PackageModule: if type(ref) == git.refs.RemoteReference: # grab the top level name branch = ref.name.split('/')[1] - if branchre.match(branch): + if re.match(branchre, branch): # Add it to the fedoras fedoras.append(branch) if fedoras: -- cgit