Closed Bug 1525725 Opened 1 year ago Closed 1 year ago

Improve clang-format hg hook support by using an hg extension

Categories

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

enhancement
Not set

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: Sylvestre, Assigned: Sylvestre)

References

(Blocks 1 open bug)

Details

Attachments

(6 files)

We want to update the content of the pending changes.
And this isn't as trivial I was expecting with hg.

See Also: → 1514770
Attachment #9041937 - Attachment description: Bug 1525725 - Add a new hg extension to run clang-format at the commit step r?sheehan → hgext: Add a new hg extension to run clang-format at the commit step (Bug 1525725) r?sheehan
Attachment #9041932 - Attachment description: Bug 1525725 - Add clang-format to the bootstrap process r?sheehan → hgext: Add clang-format to the bootstrap process (Bug 1525725) r?sheehan
Attachment #9043441 - Attachment description: Bug 1525725 - Add a test for the clang-format extension r?sheehan → hgext: Add a test for the clang-format extension (Bug 1525725) r?sheehan
Attachment #9043442 - Attachment description: Bug 1525725 - Ride along: rename pull/push to wrappedpull/wrappedpush r?sheehan → hgext: Ride along: rename pull/push to wrappedpull/wrappedpush (Bug 1525725) r?sheehan

Pushed by cosheehan@mozilla.com:
https://hg.mozilla.org/hgcustom/version-control-tools/rev/b5bd6cdbb737
hgext: Add a new hg extension to run clang-format at the commit step r=sheehan
https://hg.mozilla.org/hgcustom/version-control-tools/rev/79d0d5b4b4a0
hgext: Add clang-format to the bootstrap process r=sheehan
https://hg.mozilla.org/hgcustom/version-control-tools/rev/148d671f1adf
hgext: Add a test for the clang-format extension r=sheehan
https://hg.mozilla.org/hgcustom/version-control-tools/rev/c277b6bd2680
hgext: Ride along: rename pull/push to wrappedpull/wrappedpush r=sheehan

Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Assignee: nobody → sledru

This will allow us to use the logic again in a child commit.

This commit adds support for hg commit --amend to the clang-format
extension. cmdutil.amend is wrapped and some of the basic logic
(such as building the matcher object and creating the list of files
to be amended) is pulled into the wrapper function to determine if
clang-format should be applied.

cmdutil.amend should be safe to wrap here since it is only called
from within the amend code branch of the commit command.

While we add the --amend test to test-clang-format.t, we also
add some spacing to other lines in the test to improve readability.

Pushed by cosheehan@mozilla.com:
https://hg.mozilla.org/hgcustom/version-control-tools/rev/37349596868f
hgext/clang-format: move call to `mach clang-format` to separate function r=sylvestre
https://hg.mozilla.org/hgcustom/version-control-tools/rev/692fd8eec939
hgext/clang-format: wrap `cmdutil.amend` to run clang-format during `hg commit --amend` r=sylvestre
Depends on: 1529691
Summary: Improve clang-format hg hook support → Improve clang-format hg hook support by using an hg extension
Depends on: 1535829
Regressions: 1541409
Duplicate of this bug: 1511904
No longer regressions: 1541409
Depends on: 1542632
You need to log in before you can comment on or make changes to this bug.