Open Bug 1574317 Opened 6 years ago Updated 2 years ago

If you try to back out a patch that includes some clang-format reformatting, the reformatting doesn't get backed out

Categories

(Developer Infrastructure :: Lint and Formatting, task)

Tracking

(Not tracked)

People

(Reporter: dholbert, Unassigned)

References

Details

Rough STR:

  1. Find some file with some latent clang-format reformatting to be done.
  2. Make some edit to that file and hg commit. This will automatically make mercurial address the unrelated clang-format reformatting in that file, as part of your commit.
  3. Back out that commit (hg backout $COMMIT)
  4. Inspect the final state of that file and the backout commit.

EXPECTED RESULTS:
The backout commit should fully revert the commit that it's backing out.

ACTUAL RESULTS:
Your backout commit will not back out the reformatting changes. It only backs out your non-reformatting changes. I assume this is because, as part of generating the backout-commit, our clang-format hook runs on the "changed" file and auto-reformats it and reapplies the formatting changes right after it reverts them.

This might be sort of a special case of bug 1556088.

In my case (using a local tree with autoland cloned), here's some specific STR that you should be able to do:

hg pull autoland   # this step won't be needed in a day or so, after stuff's been merged around.
hg export 4d8eb840fc2e   # notice all the clang-format formatting changes in this patch, all the SCROLLABLE_XUL_FCDATA stuff
hg up -r 4d8eb840fc2e
hg backout 4d8eb840fc2e
# my terminal tells me the ID for the backout commit
hg export [whatever the backout commit ID is]

This shows that the backout commit is much smaller than 4d8eb840fc2e (i.e. it doesn't fully back it out). None of the SCROLLABLE_XUL_FCDATA formatting changes are in there.

(This probably requires that you have the clang-format hg extension enabled in your .hgrc, BTW.)

Product: Firefox Build System → Developer Infrastructure
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.