Make option indenting a selectable transformation

A previous change added indentation of Gerrit ACL options hard-coded
into the normalization script. Make that rule selectable instead,
like the prior transformations.

Change-Id: I57d33e2d3f55712f9ed46d740480a4ab6476d8bc
This commit is contained in:
Jeremy Stanley 2023-05-02 15:49:00 +00:00
parent f913313781
commit 7820745ba2
1 changed files with 8 additions and 7 deletions

View File

@ -31,8 +31,7 @@
# 9 - Ensure submit requirements
# * functions only noblock
# * each label has a s-r block
#
# There is a final pass to use tab indents that always applies.
# 10- Values should be indented with a hard tab, as that is the gerrit default
#
import re
@ -82,7 +81,7 @@ The current transformations
key2 = value
''' # noqa: W191, E101
LAST_TRANSFORMATION = 9
LAST_TRANSFORMATION = 10
aclfile = sys.argv[1]
@ -346,10 +345,12 @@ for section in sorted(acl.keys()):
lastoption = ''
for option in sorted(acl[section], key=tokens):
if option != lastoption:
# Gerrit prefers all option lines indented by a single
# hard tab; this minimises diffs if things like
# upgrades need to modify the acls
out += '\t%s\n' % option
if '10' in transformations:
# Gerrit prefers all option lines indented by a single
# hard tab; this minimises diffs if things like
# upgrades need to modify the acls
out += '\t'
out += '%s\n' % option
lastoption = option
if dry_run: