Bug 1387035 - Update clang-format methods to use mozversioncontrol for hg/git detection r=gps

MozReview-Commit-ID: IZTPYtTxuKu

--HG--
extra : rebase_source : dda9f730cad1635874842a043a1b83450995d236
This commit is contained in:
Xavier ALT 2017-08-15 23:23:30 +02:00
parent 8a8c2c50b0
commit 53bbc12c9a

View File

@ -17,6 +17,7 @@ from mach.decorators import (
)
from mozbuild.base import MachCommandBase, MozbuildObject
import mozversioncontrol
@CommandProvider
@ -261,7 +262,7 @@ class FormatProvider(MachCommandBase):
# Note that this will potentially miss a lot things
from subprocess import Popen, PIPE
if os.path.exists(".hg"):
if isinstance(self.repository, mozversioncontrol.HgRepository):
diff_process = Popen(["hg", "diff", "-U0", "-r", ".^",
"--include", "glob:**.c", "--include", "glob:**.cpp",
"--include", "glob:**.h",
@ -323,7 +324,7 @@ class FormatProvider(MachCommandBase):
cf_process = Popen(args)
if show:
# show the diff
if os.path.exists(".hg"):
if isinstance(self.repository, mozversioncontrol.HgRepository):
cf_process = Popen(["hg", "diff"] + path_list)
else:
cf_process = Popen(["git", "diff"] + path_list)