Bug 1324382 - Update mach to download clang-format 4.0 r=gps

MozReview-Commit-ID: INeMSbEloA3

--HG--
extra : rebase_source : 35dc4214a243d87e35b769f5a624b0f30bb9f208
This commit is contained in:
Sylvestre Ledru 2016-12-19 15:28:16 +01:00
parent 57a8e37fef
commit c731ba1568

View File

@ -231,12 +231,11 @@ class FormatProvider(MachCommandBase):
import urllib2
plat = platform.system()
fmt = plat.lower() + "/clang-format-3.5"
fmt_diff = "clang-format-diff-3.5"
fmt = plat.lower() + "/clang-format-4.0"
fmt_diff = "clang-format-diff-4.0"
# We are currently using a modified version of clang-format hosted on people.mozilla.org.
# This is a temporary work around until we upstream the necessary changes and we can use
# a system version of clang-format. See bug 961541.
# We are currently using an unmodified snapshot of upstream clang-format.
# This is a temporary work around until clang 4.0 has been released with our changes.
if plat == "Windows":
fmt += ".exe"
else:
@ -267,7 +266,7 @@ class FormatProvider(MachCommandBase):
"--include", "glob:**.c", "--include", "glob:**.cpp", "--include", "glob:**.h",
"--exclude", "listfile:.clang-format-ignore"], stdout=PIPE)
else:
git_process = Popen(["git", "diff", "-U0", "HEAD^"], stdout=PIPE)
git_process = Popen(["git", "diff", "--no-color", "-U0", "HEAD^"], stdout=PIPE)
try:
diff_process = Popen(["filterdiff", "--include=*.h", "--include=*.cpp",
"--exclude-from-file=.clang-format-ignore"],
@ -287,9 +286,10 @@ class FormatProvider(MachCommandBase):
return cf_process.communicate()[0]
def locate_or_fetch(self, root):
import urllib2
target = os.path.join(self._mach_context.state_dir, os.path.basename(root))
if not os.path.exists(target):
site = "https://people.mozilla.org/~ajones/clang-format/"
site = "https://people.mozilla.org/~sledru/clang-format/"
if self.prompt and raw_input("Download clang-format executables from {0} (yN)? ".format(site)).lower() != 'y':
print("Download aborted.")
return 1