Răsfoiți Sursa

git_cl: Attempt again to fix xml format on Win

It turns out that we need forward slashes in one place and back
slashes in two other places, so neither path by itself will work.

This CL changes things to do the slash substitution as needed.

Bug: 1502689
Change-Id: I05681ca5aff9f02a1c4ecc14c3c4e877312118ff
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5074657
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Dirk Pranke <dpranke@google.com>
Dirk Pranke 1 an în urmă
părinte
comite
081bca8cb3
1 a modificat fișierele cu 3 adăugiri și 3 ștergeri
  1. 3 3
      git_cl.py

+ 3 - 3
git_cl.py

@@ -6349,7 +6349,7 @@ def _FormatXml(opts, paths, top_dir, upstream_commit):
         if not xml_dir:
         if not xml_dir:
             continue
             continue
 
 
-        tool_dir = os.path.join(top_dir, xml_dir)
+        tool_dir = os.path.join(top_dir, xml_dir.replace('/', os.path.sep))
         pretty_print_tool = os.path.join(tool_dir, 'pretty_print.py')
         pretty_print_tool = os.path.join(tool_dir, 'pretty_print.py')
         cmd = [shutil.which('vpython3'), pretty_print_tool, '--non-interactive']
         cmd = [shutil.which('vpython3'), pretty_print_tool, '--non-interactive']
 
 
@@ -6361,12 +6361,12 @@ def _FormatXml(opts, paths, top_dir, upstream_commit):
         # tools/metrics/histogrmas, pretty-print should be run with an
         # tools/metrics/histogrmas, pretty-print should be run with an
         # additional relative path argument, like: $ python pretty_print.py
         # additional relative path argument, like: $ python pretty_print.py
         # metadata/UMA/histograms.xml $ python pretty_print.py enums.xml
         # metadata/UMA/histograms.xml $ python pretty_print.py enums.xml
-        if xml_dir == os.path.join('tools', 'metrics', 'histograms'):
+        if xml_dir == 'tools/metrics/histograms':
             if os.path.basename(path) not in ('histograms.xml', 'enums.xml',
             if os.path.basename(path) not in ('histograms.xml', 'enums.xml',
                                               'histogram_suffixes_list.xml'):
                                               'histogram_suffixes_list.xml'):
                 # Skip this XML file if it's not one of the known types.
                 # Skip this XML file if it's not one of the known types.
                 continue
                 continue
-            cmd.append(path)
+            cmd.append(path.replace('/', os.path.sep))
 
 
         if opts.dry_run or opts.diff:
         if opts.dry_run or opts.diff:
             cmd.append('--diff')
             cmd.append('--diff')