[asterisk-commits] russell: testsuite/asterisk/trunk r84 - /asterisk/trunk/asteriskversion.py
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Mar 17 15:40:29 CDT 2010
Author: russell
Date: Wed Mar 17 15:40:25 2010
New Revision: 84
URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=84
Log:
Use one regex instead of 2 for svn version parsing.
seanbright wins a beer!
Modified:
asterisk/trunk/asteriskversion.py
Modified: asterisk/trunk/asteriskversion.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/asteriskversion.py?view=diff&rev=84&r1=83&r2=84
==============================================================================
--- asterisk/trunk/asteriskversion.py (original)
+++ asterisk/trunk/asteriskversion.py Wed Mar 17 15:40:25 2010
@@ -37,16 +37,14 @@
def __parse_svn_version(self):
self.svn = True
- match = re.search("SVN-(.*)-r(.*)", self.version_str)
+ match = re.search(
+ "SVN-(?P<branch>.*)-r(?P<revision>\d+M?)(:?\-(?P<parent>.*))?",
+ self.version_str
+ )
if match is not None:
- self.branch = match.group(1)
- self.revision = match.group(2)
- # I know you could do this with one regex. If someone wants
- # to help me figure out why I couldn't do it, that would rock.
- match = re.search("(.*)-(.*)", self.revision)
- if match is not None:
- self.revision = match.group(1)
- self.parent = match.group(2)
+ self.branch = match.group("branch")
+ self.revision = match.group("revision")
+ self.parent = match.group("parent")
def __get_ast_version(self):
'''
More information about the asterisk-commits
mailing list