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

View File

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