Closed Bug 1510458 Opened Last year Closed Last year

clang-format with --show edits file given by --path

Categories

(Firefox Build System :: Lint and Formatting, enhancement)

enhancement
Not set

Tracking

(firefox65 fixed)

RESOLVED FIXED
mozilla65
Tracking Status
firefox65 --- fixed

People

(Reporter: agashlin, Assigned: Sylvestre)

References

(Blocks 1 open bug)

Details

Attachments

(3 files)

The command:

./mach clang-format --show --path widget/windows/nsWindow.cpp

will modify nsWindow.cpp, as well as showing the diff. I think the combination should only show the diff for that file.

I think there just needs to be a check for show here:
https://searchfox.org/mozilla-central/rev/0859e6b10fb901875c80de8f8fc33cbb77b2505e/python/mozbuild/mozbuild/mach_commands.py#2836
I agree with you.
Ehsan, ok with you too?
Assignee: nobody → sledru
Blocks: clang-format
Flags: needinfo?(ehsan)
Actually, it is harder than expected because "--show" is lazy: it calls a {hg,git} diff to show the diff on the file.
And this is the goal of "./mach clang-format" => update the code.

Maybe I would just wontfix it.
No I think the bug as filed is valid.  We should fix it.  --show is documented to "Show diff output on instead of applying changes" in ./mach clang-format --help.  :-)
Flags: needinfo?(ehsan)
1) Creates a temp directory
2) Copy the files
3) Run clang-format on then
4) Diff the files
Pushed by sledru@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/72412ffdc228
Show the diff without doing the change r=Ehsan
https://hg.mozilla.org/mozilla-central/rev/72412ffdc228
Status: NEW → RESOLVED
Closed: Last year
Resolution: --- → FIXED
Target Milestone: --- → Firefox 65
Pushed by sledru@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c9f6a7c04316
Ride along: declare import shutil once r=ahal
https://hg.mozilla.org/integration/autoland/rev/25282bb38b69
Ride along: simplify the declaration (else after a return) r=ahal
Target Milestone: Firefox 65 → mozilla65
You need to log in before you can comment on or make changes to this bug.