Closed Bug 1348982 Opened 4 years ago Closed 4 years ago

mach clang-format doesn't format the current revision

Categories

(Firefox Build System :: Mach Core, enhancement)

enhancement
Not set
normal

Tracking

(firefox55 fixed)

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: cpearce, Assigned: cpearce)

Details

Attachments

(1 file)

The `mach clang-format` command doesn't work well with history rewriting.

If I have three commits A, B, C, where C is the tip. If I `hg up A` and `./mach clang-format` (with the intention of following up with `hg amend ; hg evolve `) stuff changed in C gets formatted.

This is because clang-format's CommandProvider uses "-r tip^" to express the changes to be formatted. It should be using "-r .^" as that means "the current revision and any changes in the working dir", which is what we're trying to format.
Comment on attachment 8849291 [details]
Bug 1348982 - Make 'mach clang-format' format the current revision instead of the tip.

https://reviewboard.mozilla.org/r/122110/#review124732

Good catch.

Strictly speaking `hg diff -c .` is probably semantically better. But I don't think it really matters in this case.
Attachment #8849291 - Flags: review?(gps) → review+
Pushed by gszorc@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/6270b8fc98ab
Make 'mach clang-format' format the current revision instead of the tip. r=gps
https://hg.mozilla.org/mozilla-central/rev/6270b8fc98ab
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.