Bug 1541660 - Fix clang-format subcommands that don't take a path. r=bastien
authorEmilio Cobos Álvarez <emilio@crisal.io>
Thu, 04 Apr 2019 07:14:34 +0000
changeset 467936 aab55dab4d5bd736245393af111e7283741858ed
parent 467935 768adc665e9bbd2e0a279fa0062e0c974e7cbf70
child 467937 408104f784ef610f7d1b9f12edc114fa799465ca
push id112667
push useraiakab@mozilla.com
push dateThu, 04 Apr 2019 16:12:45 +0000
treeherdermozilla-inbound@230bb363f2f3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbastien
bugs1541660
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1541660 - Fix clang-format subcommands that don't take a path. r=bastien We do need some test for this stuff... Differential Revision: https://phabricator.services.mozilla.com/D26039
python/mozbuild/mozbuild/mach_commands.py
--- a/python/mozbuild/mozbuild/mach_commands.py
+++ b/python/mozbuild/mozbuild/mach_commands.py
@@ -2417,17 +2417,19 @@ class StaticAnalysis(MachCommandBase):
     @CommandArgument('--outgoing', default=False, action='store_true',
                      help='Run clang-format on outgoing files from mercurial repository')
     def clang_format(self, assume_filename, path, commit, output_path=None, output_format='diff', verbose=False, outgoing=False):
         # Run clang-format or clang-format-diff on the local changes
         # or files/directories
         if path is None and outgoing:
             repo = get_repository_object(self.topsrcdir)
             path = repo.get_outgoing_files()
-        path = map(os.path.abspath, path)
+
+        if path:
+            path = map(os.path.abspath, path)
 
         os.chdir(self.topsrcdir)
 
         # Load output file handle, either stdout or a file handle in write mode
         output = None
         if output_path is not None:
             output = sys.stdout if output_path == 'stdout' else open(output_path, 'w')