Bug 1387036 : ./mach clang-format , removed filterdiff and added "git diff -- *" for restricting diff to a given set of file extensions. draft
authorPrithviraj Pawar <prithviraj10pawar@gmail.com>
Sat, 12 Aug 2017 23:35:51 +0530
changeset 645599 c77d05da80aa5020316fdae995da21bc4a636d3e
parent 645321 1f363abd841d1ad9fb8ac1e67ea7c8636895d766
child 725935 2770b8c39da625e76c1bc8bf535f8efcf6ddd70b
push id73795
push userbmo:prithviraj10pawar@gmail.com
push dateSun, 13 Aug 2017 15:30:18 +0000
bugs1387036
milestone57.0a1
Bug 1387036 : ./mach clang-format , removed filterdiff and added "git diff -- *" for restricting diff to a given set of file extensions. MozReview-Commit-ID: 3M7GMpFYqkR
tools/mach_commands.py
--- a/tools/mach_commands.py
+++ b/tools/mach_commands.py
@@ -262,29 +262,17 @@ class FormatProvider(MachCommandBase):
         from subprocess import Popen, PIPE
 
         if os.path.exists(".hg"):
             diff_process = Popen(["hg", "diff", "-U0", "-r", ".^",
                                   "--include", "glob:**.c", "--include", "glob:**.cpp",
                                   "--include", "glob:**.h",
                                   "--exclude", "listfile:.clang-format-ignore"], stdout=PIPE)
         else:
-            git_process = Popen(["git", "diff", "--no-color", "-U0", "HEAD^"], stdout=PIPE)
-            try:
-                diff_process = Popen(["filterdiff", "--include=*.h",
-                                      "--include=*.cpp", "--include=*.c",
-                                      "--exclude-from-file=.clang-format-ignore"],
-                                     stdin=git_process.stdout, stdout=PIPE)
-            except OSError as e:
-                if e.errno == errno.ENOENT:
-                    print("Can't find filterdiff. Please install patchutils.")
-                else:
-                    print("OSError {0}: {1}".format(e.code, e.reason))
-                return 1
-
+	    diff_process = Popen(["git", "diff", "--no-color", "-U0", "HEAD","--","*.c","*.cpp","*.h"], stdout=PIPE)
         args = [sys.executable, clang_format_diff, "-p1"]
         if not show:
             args.append("-i")
         cf_process = Popen(args, stdin=diff_process.stdout)
         return cf_process.communicate()[0]
 
     def generate_path_list(self, paths):
         pathToThirdparty = os.path.join(self.topsrcdir,