Merge "aclmanager: do not keep old stable sections around"
This commit is contained in:
@@ -20,6 +20,7 @@
|
|||||||
import argparse
|
import argparse
|
||||||
import getpass
|
import getpass
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
@@ -106,13 +107,32 @@ label-Workflow = -1..+1 group {group}
|
|||||||
else:
|
else:
|
||||||
with open(fullfilename) as aclfile:
|
with open(fullfilename) as aclfile:
|
||||||
hit = False
|
hit = False
|
||||||
|
skip = False
|
||||||
for line in aclfile:
|
for line in aclfile:
|
||||||
if line.startswith("[receive]"):
|
# Skip until start of next section if in skip mode
|
||||||
|
if skip:
|
||||||
|
if line.startswith('['):
|
||||||
|
skip = False
|
||||||
|
else:
|
||||||
|
continue
|
||||||
|
|
||||||
|
if re.match('^\[access "refs/heads/stable/[a-z]', line):
|
||||||
|
# We just hit a specific stable section.
|
||||||
|
# Skip the file until the next section starts.
|
||||||
|
skip = True
|
||||||
|
continue
|
||||||
|
|
||||||
|
if line.startswith("[receive]") and not hit:
|
||||||
|
# We reached the [receive] section: let's place
|
||||||
|
# our specific stable section here.
|
||||||
newcontent += blob.format(
|
newcontent += blob.format(
|
||||||
branch=args.series,
|
branch=args.series,
|
||||||
group=group)
|
group=group)
|
||||||
hit = True
|
hit = True
|
||||||
|
|
||||||
|
# Copy the current line over
|
||||||
newcontent += line
|
newcontent += line
|
||||||
|
|
||||||
if not hit:
|
if not hit:
|
||||||
print("Could not update %s automatically" % fullfilename)
|
print("Could not update %s automatically" % fullfilename)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user