Commit b3187040 authored by Philip Rogers's avatar Philip Rogers Committed by Commit Bot

Fix typos in <histogram> and <histogram_suffixes> processing

Several typos were landed in https://crrev.com/728635:
* hisotgrams -> histograms
* AddBackMisplacedHisotgrams -> AddBackMisplacedHistograms
* hsitogram_suffixes -> histogram_suffixes

There was also a recursive call to "FixMisplacedHisotgrams" that was
renamed in a previous patchset to AddBackMisplacedHistograms. This has
been updated to "AddBackMisplacedHistograms".

The test has been updated with a comment node inside
"<histogram-configuration>" to exercise this codepath. This has been
manually tested by ensuring
https://chromium-review.googlesource.com/c/chromium/src/+/1988857 can
successfully run "git cl format".

Bug: 1039447
Change-Id: I95097c0d4acd23301a7fad0d9d33521be405aa53
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1988375Reviewed-by: default avatarIlya Sherman <isherman@chromium.org>
Commit-Queue: Philip Rogers <pdr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#728726}
parent 834f2092
......@@ -101,7 +101,7 @@ def FixMisplacedHistogramsAndHistogramSuffixes(tree):
tree: The node of the xml tree.
histograms: A list of histogram nodes inside histogram_suffixes_list
node. This is a return element.
histogram_suffixes: A list of histogram_suffixes nodes inside hisotgrams
histogram_suffixes: A list of histogram_suffixes nodes inside histograms
node. This is a return element.
"""
for child in tree:
......@@ -114,17 +114,17 @@ def FixMisplacedHistogramsAndHistogramSuffixes(tree):
ExtractMisplacedHistograms(tree)
def AddBackMisplacedHisotgrams(tree):
"""Adds back those misplaced histogram and hsitogram_suffixes nodes."""
def AddBackMisplacedHistograms(tree):
"""Adds back those misplaced histogram and histogram_suffixes nodes."""
for child in tree:
if child.tag == 'histograms':
child.extend(histograms)
elif child.tag == 'histogram_suffixes_list':
child.extend(histogram_suffixes)
else:
FixMisplacedHisotgrams(child)
AddBackMisplacedHistograms(child)
AddBackMisplacedHisotgrams(tree)
AddBackMisplacedHistograms(tree)
def PrettyPrintHistograms(raw_xml):
"""Pretty-print the given histograms XML.
......
......@@ -12,6 +12,7 @@ ORIGINAL_XML = """
<!-- Top level Comment 1 -->
<!-- Top level Comment 2 -->
<histogram-configuration>
<!-- Second level Comment 1 -->
<histograms>
<histogram name="Test.Histogram" units="us">
<owner>person@chromium.org</owner>
......@@ -63,6 +64,8 @@ PRETTY_XML = """
<histogram-configuration>
<!-- Second level Comment 1 -->
<histograms>
<histogram name="Foo.Bar" units="xxxxxxxxxxxxxxxxxxyyyyyyyyyyyyyyyyyyyyyyzzzz">
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment