From 7820745ba2d5f1cb9a66fd6dc1b2ff56f00c485e Mon Sep 17 00:00:00 2001 From: Jeremy Stanley Date: Tue, 2 May 2023 15:49:00 +0000 Subject: [PATCH] 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 --- tools/normalize_acl.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/tools/normalize_acl.py b/tools/normalize_acl.py index 5de200c6a5..840d7abb8f 100755 --- a/tools/normalize_acl.py +++ b/tools/normalize_acl.py @@ -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: