From cb63263510d9488b4659604e8de5c79ce1f43c89 Mon Sep 17 00:00:00 2001 From: Jeremy Stanley Date: Wed, 17 Feb 2016 22:31:54 +0000 Subject: [PATCH] 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 --- tools/normalize_acl.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/normalize_acl.py b/tools/normalize_acl.py index 3cff0d0cba..46905d3ea0 100755 --- a/tools/normalize_acl.py +++ b/tools/normalize_acl.py @@ -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])