Closed Bug 1510458 Opened 6 years ago Closed 6 years ago

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

Categories

(Developer Infrastructure :: Lint and Formatting, enhancement)

enhancement
Not set
normal

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
Depends on D13708
Pushed by sledru@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/72412ffdc228 Show the diff without doing the change r=Ehsan
Status: NEW → RESOLVED
Closed: 6 years ago
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
Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: