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
--- 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,