Improve `git cl format` for metrics XML files.

- Remove a reference to rappor, which doesn't exist anymore
- Don't error if an XML file is found with a different name

The error would happen because we'd try to run pretty_print.py without
a filename argument.

Change-Id: Ifa77af07dcd9113540890863a9d1d3198bae59a9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4762087
Reviewed-by: Andy Perelson <ajp@google.com>
Commit-Queue: Alexei Svitkine <asvitkine@chromium.org>
changes/87/4762087/3
Alexei Svitkine 2 years ago committed by LUCI CQ
parent c38ebeafb0
commit d40cda515b

@ -6093,8 +6093,11 @@ def CMDformat(parser, args):
# $ python pretty_print.py metadata/UMA/histograms.xml
# $ python pretty_print.py enums.xml
if (diff_xml.endswith('histograms.xml') or diff_xml.endswith('enums.xml')
or diff_xml.endswith('histogram_suffixes_list.xml')):
if xml_dir == os.path.join('tools', 'metrics', 'histograms'):
if os.path.basename(diff_xml) not in ('histograms.xml', 'enums.xml',
'histogram_suffixes_list.xml'):
# Skip this XML file if it's not one of the known types.
continue
cmd.append(diff_xml)
if opts.dry_run or opts.diff:
@ -6124,7 +6127,6 @@ def GetMetricsDir(diff_xml):
metrics_xml_dirs = [
os.path.join('tools', 'metrics', 'actions'),
os.path.join('tools', 'metrics', 'histograms'),
os.path.join('tools', 'metrics', 'rappor'),
os.path.join('tools', 'metrics', 'structured'),
os.path.join('tools', 'metrics', 'ukm'),
]

Loading…
Cancel
Save