Closed Bug 1507711 Opened 6 years ago Closed 6 years ago

Add hg-formatsource to mozversioncontrol extensions

Categories

(Firefox Build System :: General, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: andi, Assigned: andi)

References

Details

Attachments

(1 file)

There is a big problem when trying to merge unformulated code into a formatted repo, this hg extenssion, hg-formatsource [1], tries to mitigate this issue. 
There are two parts that need to be completed in order to have this:

1. Download the extension through bootstrap
2. Provide a .hgrc setup in order to use the extension, with it enabled an configured. 

[1] https://pypi.org/project/hg-formatsource/
My vote is to vendor the extension into version-control-tools then integrate it with the configwizard extension also in that repo.

https://hg.mozilla.org/hgcustom/version-control-tools/
https://hg.mozilla.org/hgcustom/version-control-tools/file/default/hgext/configwizard

This is easiest since it keeps everything in a single repo. We do have the ability to install extensions from other sources (we do this for evolve). But having fewer moving parts and being able to run the extension's tests as part of the other "upgrade Mercurial" processes we perform in version-control-tools every 3 months makes things much simpler to maintain.

Regardless of whether we vendor or not, configwizard is where we want to integrate setting it up. That's what runs when you run `mach vcs-setup`.
gps thank you for the hints! Do you know if it's possible to also automate the generation of the configuration for this extension during the time that we enable it? I'm asking this because it's configuration should point to mach from m-c, but I'm not sure that vcs can be aware of the mozilla repo, since we can have multiple repos. Maybe I can do this from the bootstrap command itself from mach, after the 'configure_mercurial' [1] finishes it's execution.

[1] https://dxr.mozilla.org/mozilla-central/source/python/mozboot/mozboot/bootstrap.py#462
Flags: needinfo?(gps)
See Also: → 1502068
Depends on: 1508635
> There is a big problem when trying to merge unformulated code into a
> formatted repo, this hg extenssion, hg-formatsource [1], tries to mitigate
> this issue. 

Andi, can you evaluate using the builtin `fix` extension (mentioned in bug 1502068) to solve these problems before proceeding any further? Unless there is some limitation to that extension that makes it infeasible for our purposes, I'd prefer we WONTFIX this bug and continue work over there. I don't see any point in taking on the maintenance work for this extension (which hasn't been updated since it's initial release and likely has bugs on modern versions of Mercurial) when we can just use the out-of-the-box, community maintained tool that performs the same function.

> gps thank you for the hints! Do you know if it's possible to also automate
> the generation of the configuration for this extension during the time that
> we enable it? I'm asking this because it's configuration should point to
> mach from m-c, but I'm not sure that vcs can be aware of the mozilla repo,
> since we can have multiple repos. Maybe I can do this from the bootstrap
> command itself from mach, after the 'configure_mercurial' [1] finishes it's
> execution.

To answer for gps, we should be able to do this. :)

If we are planning on using `mach clang-format` or `mach lint` as the formatting command, then both this bug and bug 1502068 are blocked on bug 1508635 (`hg fix` also requires file content on stdin and fixed content on stdout). There will need to be some sort of test that shows the extension working correctly with `mach` as it's underlying command.
Flags: needinfo?(gps) → needinfo?(bpostelnicu)
Stealing Andi's needinfo.

As you saw, the deadline for the clang-format change is 8 days. hg-formatsource does the job (which has been confirmed by a few folks) and supports older version of hg (unlike hg fix if I understood correctly).

Therefore, I think we should go ahead with hg-formatsource for the big-patch and evaluate hg fix in the future as it is part of a bigger discussion. Deal?
Flags: needinfo?(bpostelnicu)
Attachment #9026050 - Attachment description: Bug 1507711 - Add hg-formatsource to mozversioncontrol extenssions. r?gps → extensions: Add `hg-formatsource` extension (Bug 1507711) r?sheehan
Pushed by cosheehan@mozilla.com:
https://hg.mozilla.org/hgcustom/version-control-tools/rev/8935c2899be3
extensions: Add `hg-formatsource` extension r=sheehan
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Pushed by cosheehan@mozilla.com:
https://hg.mozilla.org/hgcustom/version-control-tools/rev/4afbd287b0b1
format-source: add the extension name to the prompt
Summary: Add hg-formatsource to mozversioncontrol extenssions → Add hg-formatsource to mozversioncontrol extensions
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: