We disable various extensions when running `hg` commands as part
of `mach mercurial-setup` because they can interfere with operations.
e.g. if the extension isn't compatible with your version of hg, you
will get an error.
For some reason "mozext" wasn't part of this list. Fix that.
DONTBUILD (NPOTB)
This grabs the list of changed and added files that match the set we expect to
be able to lint and runs them through eslint displaying simple messages on error.
Running old extensions with newer versions of Mercurial may crash `hg`
due to the old extension accessing something or doing something that has
been changed in the new release.
To minimize the risk of this happening, we disable common 3rd party
extensions when cloning or pulling as part of `mach mercurial-setup`. We
don't want to disable everything because some extensions (like
remotenames) provide features the user may want enabled as part of the
clone/update. This leaves the door open for more failures. Hopefully
this approach is sufficient. We can always revisit later.
This can speed up performance significantly.
Only support OS X for now because on Linux we have to adjust inode
limits to support mozilla-central and I don't feel like scope bloating.
bundleclone is the Mozilla-specific precursor to the "clonebundles"
feature in Mercurial 3.6. Change the wizard to recognize when
clonebundles is available and to favor it. Activating clonebundles will
also disable bundleclone, as bundleclone is redundant with clonebundles.
(If both are enabled, bundleclone detects this and gets out of the way.)
Main reason for recommending 3.5 is bundle2. The protocol is faster and
we can do things like put extra data in the server exchange. It also
enables generaldelta to be exchanged without pain.
And of course there are tons of performance improvements and bug fixes.
All extensions in version-control-tools should support Bugzilla API Keys
now. MozReview requires them. We'll likely remove support for passwords
and cookie auth in the future. This commit transitions the Mercurial
setup wizard to API Keys exclusively.
DONTBUILD (NPOTB)
Having multiple version-control-tools repositories references in your
hgrc could lead to one repository importing code from another, depending
on how sys.path modification works from version-control-tools
repositories. Detect it and issue a warning.
Users may want to know what the wizard is changing before they answer
prompts. Add the names of impacted config options to messages so people
can make more informed decisions.
~/.hgrc files are likely created with the user's default umask, which
commonly gives default permissions of 644. If the hgrc config contains
sensitive information (such as Bugzilla credentials), these file
permissions could result in others stealing sensitive data.
Detect when the group and other file mode bits are set and prompt to
remove these permissions.
Bugzilla credentials are optional. Make this more obvious by adding
"optional" to the prompt.
Bugzilla credentials are stored in plain text. Explicitly call this out
in the help text so users can make informed decisions about whether to
capture the credentials.
configobj doesn't support semicolon comments. Why, I don't know, since
they are pretty common in ini files.
Do a static check for semicolon comments and print a more actionable
error message.
An upcoming commit will display the path of the config file in the error
message. In order to do this, the calling scope needs to know the path
to the config file.
The creation of the directory used to be handled by the running of the
wizard. Now, since we touch the state file first, we need to create the
directory manually. Derp.
While not common, there are a few cases where `mach mercurial-setup`
fails. When checking the last time this command was executed, it is
sufficient to record the intent to run the command, not the fact that it
executed to completion.
This removes ambiguity as to which modules are being imported, making
import slightly faster as Python doesn't need to test so many
directories for file presence.
All files should already be using absolute imports because mach command
modules aren't imported to the package they belong to: they instead
belong to the "mach" package. So relative imports shouldn't have been
used.
We're about to deploy this to release automation. We might as well have
normal people start using it as well. We could perhaps even have the
extension print out information on how to resume interrupted downloads
someday, so it will pay to have this enabled so they can utilize that
feature some day in the future.
DONTBUILD (NPOTB)
We dropped support for Mercurial 3.0 in version-control-tools. Bump
minimum versions in extensions to reflect this.
We highly recommend people run a modern Mercurial. Bump the minimum
non-legacy version to reflect that.
Currently we only mark the version-control-tools repo as needing updating, if
we did not pass a path param to prompt_external_extension(). This is because if
no path is passed, the extension is used from the version-control-tools repo,
and so if _no_ path is passed, it's presumed the extension is external to the
repo. However this is not always the case - eg if we need to specify a specific
file for an extension (vs the entire directory), we have to do so be passing in
the path. We hit this case for reviewboard.
With this change, we always mark the version-control-tools repo as needing an
update, no matter where the extension was located.
mqext was moved into the version-control-tools repo some time ago, but mach
mercurial-setup was still pointing at the old repo location, which is no longer
being updated.
This is needed for compatibility with an upcoming release of
MozillaBuild, which distributes Mercurial as a Python package, not as a
standalone Windows program. As a result, it introduces "hg" into $PATH,
which "which" will happily prefer as the "hg" binary. This upsets
subprocess. So, we explicitly prefer "hg.exe" over "hg".
We could accomplish the same thing by calling which.whichall() and
sorting results. But this is more code and IMO not worth the effort to
implement.