Bug 1348982 - Make 'mach clang-format' format the current revision instead of the tip. r=gps

Currently the mach clang-format command is formating '-r tip^', which is
everything in the tip revision, plus changes. Often this does what you want,
but if you're using changeset evolution or history rewriting this doesn't work
so well.  If you `hg up $rev` to some other revision with the intention of
clang-formating that revision, you don't get that revision formated when you
run clang-format. You get the lines touched by the changeset with the "tip"
bookmark formatted. We really want to have clang-format format '-r .^' which
means "the current revision in the working dir, plus any uncommited changes".

This results in the expected behaviour, and means clang-format can be used to
re-format commits which are work-in-progress and/or being evolved.


MozReview-Commit-ID: iv82HENxiA

--HG--
extra : rebase_source : a1d05472f499f5a68bcaab9ce260d60ecbca067d
This commit is contained in:
Chris Pearce 2017-03-21 10:31:15 +13:00
Родитель 9a54a919a0
Коммит 106fa550f9
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -260,7 +260,7 @@ class FormatProvider(MachCommandBase):
from subprocess import Popen, PIPE
if os.path.exists(".hg"):
diff_process = Popen(["hg", "diff", "-U0", "-r", "tip^",
diff_process = Popen(["hg", "diff", "-U0", "-r", ".^",
"--include", "glob:**.c", "--include", "glob:**.cpp",
"--include", "glob:**.h",
"--exclude", "listfile:.clang-format-ignore"], stdout=PIPE)