Bug 1387036 : ./mach clang-format , removed filterdiff and added "git diff -- *" for restricting diff to a given set of file extensions. draft
authorPrithviraj Pawar
Tue, 08 Aug 2017 19:52:50 +0530
changeset 642670 a6061df41ac0ef945a3bcc0f30468c19f23fb97c
parent 642518 a921bfb8a2cf3db4d9edebe9b35799a3f9d035da
child 725070 091ff42aa7844fbb8c046211d0452f8ca96a954e
push id72835
push userbmo:prithviraj10pawar@gmail.com
push dateTue, 08 Aug 2017 16:54:32 +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: 3JdYdFkmnKv
tools/mach_commands.py
--- a/tools/mach_commands.py
+++ b/tools/mach_commands.py
@@ -262,28 +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
+            git_process = Popen(["git", "diff", "--no-color", "-U0", "HEAD^","--","*.cpp","*.c","*.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):