Parse commits for benches, using only the final entry found
This commit is contained in:
1 parent
2dd35aee8f
commit
850933e4fa
1 file changed
+4
-4
+4
-4
@@ -167,15 +167,15 @@ def getBranch(request, errors, name):
|
|||||||
treeurl = data['commit']['tree']['sha'] + '.zip'
|
treeurl = data['commit']['tree']['sha'] + '.zip'
|
||||||
source = pathjoin(repo, 'archive', treeurl).rstrip('/')
|
source = pathjoin(repo, 'archive', treeurl).rstrip('/')
|
||||||
|
|
||||||
try: # Use the provided Bench is their is one
|
try: # Use the provided Bench if there is one
|
||||||
bench = int(request.POST['{0}bench'.format(name)])
|
bench = int(request.POST['{0}bench'.format(name)])
|
||||||
return (source, branch, data['sha'], bench)
|
return (source, branch, data['sha'], bench)
|
||||||
except: pass
|
except: pass
|
||||||
|
|
||||||
try: # Fallback to try to parse the Bench from the commit
|
try: # Fallback to try to parse the Bench from the commit
|
||||||
message = data['commit']['message'].replace(',', '').upper()
|
message = data['commit']['message']
|
||||||
bench = re.search('(BENCH|NODES)[ :=]+[0-9]+', message)
|
benches = re.findall('(?:BENCH|NODES)[ :=]+([0-9,]+)', message, re.IGNORECASE)
|
||||||
bench = int(re.search('[0-9]+', bench.group()).group())
|
bench = int(benches[-1].replace(',', ''))
|
||||||
return (source, branch, data['sha'], bench)
|
return (source, branch, data['sha'], bench)
|
||||||
|
|
||||||
except: # Neither method found a viable Bench
|
except: # Neither method found a viable Bench
|
||||||
|
|||||||
Reference in new issue
Block a user