Keep Gerrit ACL lines deduplicated

Gerrit ACLs can have multiple duplicate option keys in a section,
but completely duplicate lines (key and value together) have no use
so make sure they're collapsed into at most 1 copy.

Change-Id: I6bf43e860dcc8c3d7b2846d4e058b6c8ac7243eb
This commit is contained in:
Jeremy Stanley 2016-02-17 22:31:54 +00:00
parent ce3ca98ce7
commit cb63263510

View File

@ -140,8 +140,11 @@ if '7' in transformations:
for section in sorted(acl.keys()):
if acl[section]:
out += '\n[%s]\n' % section
lastoption = ''
for option in sorted(acl[section], key=tokens):
out += '%s\n' % option
if option != lastoption:
out += '%s\n' % option
lastoption = option
if dry_run:
print(out[1:-1])