Граф коммитов

137 Коммитов

Автор SHA1 Сообщение Дата
Connor Sheehan 02b9156f7c Bug 1857512: use `utf-8` encoding for mozversioncontrol VCS commands r=zeid
`mozversioncontrol` runs currently use `universal_newlines`, which
is an alias for `text`. This forces the command output file object
to be opened in text mode using the platform's default encoding. On
Windows the default encoding is usually a single-byte encoding such
as `cp-1252`, which can cause issues when parsing patches that include
multi-byte sequences. Add an `encoding` option to `_run` with `utf-8`
as the default option and change the `check_output` call to use it.
Callers can revert to the previous behaviour quite easily by setting
`encoding=None` if necessary.

Differential Revision: https://phabricator.services.mozilla.com/D190710
2023-10-11 21:26:41 +00:00
Connor Sheehan c1c2126fce Bug 1835962: add support for `mach try` to submit to Lando r=zeid,mach-reviewers,ahochheiden
Add support for submitting stacks of commits to Lando for queueing
on Try, instead of pushing to hg.mozilla.org directly. This patch
implements the Device Code Authorization flow for Auth0, simple changeset
discovery and patch gathering, and submissing to Lando via HTTP POST.

Add a `try.txt` virtualenv site that contains packages from the common
virtualenv as well as the `auth0-python` package for verifying Auth0
JWTs. Use this new virtualenv for `mach try` and related subcommands.
Add a `--push-to-lando` flag that controls whether the push will be made
via the Lando API or using the VCS to hg.mozilla.org directly.

Create a `lando.py` module in the `tryselect` package that handles the
details around submitting to Lando. Authentication is handled by the
Device Code Authorization flow, and the returned access token is saved
to the mozbuild state directory. Auth0 details are added to the `.lando.ini`
file in the repo root, and a `LANDO_TRY_USE_DEV` environment variable can
be set to control submitting to the prod or dev Lando environments.
This module also includes patch stack gathering and discovery via `mozversioncontrol`.

mozversioncontrol's `Repository` subclass is extended with helper functions
to gather patch files from Mercurial and Git. We also add a `try_config_commit`
context manager that creates a temporary commit to hold try syntax commit
messages and/or a `try_task_config.json` file, which is removed from version
control on submission.

The `mach try` cram tests now use a separate virtualenv that must be built
before running, causing unexpected output in the tests. Run `mach try --help`
in the test setup to force the virtualenv to be built before running any
test.

`mach try chooser` would previously install packages for a small web application
from a `requirements.txt` file when run. Install these via the new `try.txt`
site environment instead. The required dependencies are also added to the
`python-test.txt` site since they will cause some tests to fail due to the
missing dependencies.

Differential Revision: https://phabricator.services.mozilla.com/D187641
2023-10-02 14:31:43 +00:00
Steve Fink 422ae077bf Bug 1853252 - Allow running `mach bootstrap` from more subdirs r=ahochheiden
Differential Revision: https://phabricator.services.mozilla.com/D188302
2023-09-18 19:13:38 +00:00
Sandor Molnar fd89296e58 Backed out changeset a8d1b2a81511 (bug 1853184) for causing python vcs failures CLOSED TREE 2023-09-19 01:46:40 +03:00
Connor Sheehan 2ec4c75d12 Bug 1853184: use `--initial-branch main` when creating Git repos in mozversioncontrol tests r=ahochheiden
Differential Revision: https://phabricator.services.mozilla.com/D188278
2023-09-18 16:11:11 +00:00
ahochheiden 79b5d0acb8 Bug 1835943 - Properly construct CallerProcessError in `_push_to_try_with_log_capture` r=ahal
Differential Revision: https://phabricator.services.mozilla.com/D179982
2023-06-12 22:22:21 +00:00
andrej 83b857cb58 Bug 1826162 - mach try perf gitcinnibar issues. r=perftest-reviewers,kshampur
Issue:
When using git cinnibar it does the appropriate pushes but gives a perf compare url of:
https://treeherder.mozilla.org/perfherder/compare?originalProject=try&originalRevision=None&newProject=try&newRevision=None

Resolution:
It turns out that when the data related to the try push is returned from try it returns and displays it using stderr not stdout, our logic of monitoring the stdout stream does not find the data and returns None as a result for the revision.
Modifying the output stream of stderr to go to stdout resolved the issue

Differential Revision: https://phabricator.services.mozilla.com/D177816
2023-05-15 16:43:18 +00:00
nicklas boman c3f1952ebe Bug 1798746 - Ensure checking for mercurial/git only if its a hg/git clone, not release source r=ahochheiden
Differential Revision: https://phabricator.services.mozilla.com/D162461
2023-05-09 16:33:36 +00:00
Cosmin Sabou 6f28253d4c Backed out changeset fab57c6553f4 (bug 1798746) for causing win aarch64 build bustages. CLOSED TREE 2023-05-09 08:25:18 +03:00
nicklas boman 641e4e6803 Bug 1798746 - Ensure checking for mercurial/git only if its a hg/git clone, not release source r=ahochheiden
Differential Revision: https://phabricator.services.mozilla.com/D162461
2023-05-09 02:15:30 +00:00
Iulian Moraru 5f08dc66c3 Backed out changeset 02cc74634f7d (bug 1798746) for causing build bustages. CLOSED TREE 2023-05-03 20:54:50 +03:00
nicklas boman 9871455d0d Bug 1798746 - Ensure checking for mercurial/git only if its a hg/git clone, not release source r=ahochheiden
Differential Revision: https://phabricator.services.mozilla.com/D162461
2023-05-03 15:45:36 +00:00
Andrew Halberstadt 441546dc79 Bug 1811850 - [lint] Replace isort linter with ruff, r=taskgraph-reviewers,linter-reviewers,marco,jcristau
This results in some changes from our current `isort` configuration. I'm
unclear if it's because ruff isn't at 100% parity with isort, they choose
different defaults or if I missed some configuration.

Either way, the changes all look reasonable to me (see child commit), so I'm
inclined to just accept the new import format it imposes.

Differential Revision: https://phabricator.services.mozilla.com/D172348
2023-03-20 13:06:27 +00:00
Cristian Tuns c1b52fd95e Backed out 5 changesets (bug 1811850) for causing linting bustages(bugzilla) CLOSED TREE
Backed out changeset e8fcfc7f8108 (bug 1811850)
Backed out changeset f8950d716c9e (bug 1811850)
Backed out changeset f650123cc188 (bug 1811850)
Backed out changeset d96f90c2c58b (bug 1811850)
Backed out changeset c3b0f9666183 (bug 1811850)
2023-03-16 22:16:30 -04:00
Andrew Halberstadt 8b4f890651 Bug 1811850 - [lint] Replace isort linter with ruff, r=taskgraph-reviewers,linter-reviewers,marco,jcristau
This results in some changes from our current `isort` configuration. I'm
unclear if it's because ruff isn't at 100% parity with isort, they choose
different defaults or if I missed some configuration.

Either way, the changes all look reasonable to me (see child commit), so I'm
inclined to just accept the new import format it imposes.

Differential Revision: https://phabricator.services.mozilla.com/D172348
2023-03-17 01:53:59 +00:00
Ho Cheung 48e73c8aac Bug 1633662 - Remove unused mozversioncontrol functions r=saschanaz,firefox-build-system-reviewers,glandium
Remove unused mozversioncontrol functions in code

Differential Revision: https://phabricator.services.mozilla.com/D167352
2023-01-20 08:40:00 +00:00
Marco Castelluccio d766c93a2a Bug 1801836 - Remove no longer necessary 'from __future__' imports under python/. r=linter-reviewers,glandium,ahal DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D165398
2022-12-23 01:26:15 +00:00
Marco Castelluccio 54ee6457a1 Bug 1790816 - Reformat python/ with isort. r=#linter-reviewers CLOSED TREE
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D162656
2022-12-21 09:56:15 +00:00
ahochheiden 194843dc59 Bug 1801153 - If "pip check" fails, try purging all first-party ".egg-info" dirs then run "pip check" again r=firefox-build-system-reviewers,glandium
Differential Revision: https://phabricator.services.mozilla.com/D162807
2022-11-24 05:53:12 +00:00
Greg Mierzwinski 35261aea3a Bug 1754823 - Add a flag to allow capturing the push-to-try logs. r=ahal,AlexandruIonescu
This patch adds a `capture_log` flag that will allow a user to capture the logs produced when running the `push_to_try` methods. Currently, we use `subprocess.check_call` which causes hg to hang when we attempt to redirect and gather stdout. Using `subprocess.run` is better as it lets us capture the logs, but the log output is very slow and can easily lead people to believe that hg is hanging when it's not. This results in corrupted repos. Using Popen, the logs are output slower than `check_call`, but faster than `run` so you know something is happening. The speed at which these logs are printed is also why I have this log capturing behind a flag.

This functionality will be used in the `./mach try perf` selector to capture the child revisions produced for the try task config file changes and allow us to produce a PerfCompare link to provide the user.

Differential Revision: https://phabricator.services.mozilla.com/D155980
2022-11-03 20:32:46 +00:00
ahochheiden 700d2d5ffb Bug 1777414 - Replace all uses of `distutils.version.LooseVersion` with `looseversion.LooseVersion` r=firefox-build-system-reviewers,glandium
Differential Revision: https://phabricator.services.mozilla.com/D151064
2022-08-26 23:05:25 +00:00
Mitchell Hentges 8d5bcd86f6 Bug 1732795: Resolve upcoming pytest deprecations r=webdriver-reviewers,ahal,whimboo
Following the pytest "deprecations and removals" docs [1], this patch:
* Replaces `@pytest.yield_fixture` with `@pytest.fixture`.
* Replaces `.funcargnames` with `.fixturenames`.
* Uses `Pathlib` parameter instead of the `py.path.local` one in
  associated `pytest_*` hooks.
* Replaces `--strict` with `--strict-markers`

[1] https://docs.pytest.org/en/latest/deprecations.html

Differential Revision: https://phabricator.services.mozilla.com/D138815
2022-02-18 14:27:18 +00:00
Mitchell Hentges 559abbbdc0 Bug 1753259: Try finding VCS tool if build config is outdated r=ahal
Though not a panacea, this patch addresses existing usages of
`get_repository_from_build_config()` to fall back to
`get_repository_object()` if `MissingVCSTool` was encountered.

Ideally, we'd update `substs["HG"]` when we detect that it's changed,
but we don't have infrastructure to incrementally change configure
output.

So, other issues may creep up that will still warrant a fresh
`./mach configure`.

Differential Revision: https://phabricator.services.mozilla.com/D137675
2022-02-02 19:33:52 +00:00
ahochheiden c50783cfa7 Bug 1750693 - Minimum changes necessary in mozversioncontrol/test to facilitate Pathlib migration r=firefox-build-system-reviewers,mhentges
The py.path allowed adding arbitrary fields to it, while a pathlib.Path
does not. To replicate the behavior with as few changes as possible, I
made a test fixture wrapper class (RepoTestFixture) to add the same
arbitrary fields to, while now containing a Pathlib path instead.

Also added a utility functions to make the running of tests a
bit cleaner ('execute_next_step')

Differential Revision: https://phabricator.services.mozilla.com/D136302
2022-01-31 15:26:17 +00:00
ahochheiden d4958f0b9c Bug 1750693 - Update string paths to Pathlib objects in Mozversioncontrol module r=firefox-build-system-reviewers,mhentges
Differential Revision: https://phabricator.services.mozilla.com/D136301
2022-01-31 15:26:17 +00:00
ahochheiden ab4c0058ee Bug 1750693 - Removed `update_git_repo` function since it is unused r=firefox-build-system-reviewers,mhentges
Differential Revision: https://phabricator.services.mozilla.com/D136644
2022-01-31 15:26:17 +00:00
ahochheiden 7e01ef8ced Bug 1750693 - Update tests in mozversioncontrol to be compatible with Windows r=firefox-build-system-reviewers,mhentges
Note: In `test_commit.py` For date formatting, the `%s` did not work on Windows.
On Linux it gives the time in seconds. The switch to the rfc822date format for
both hg and git `%aD` made the expected output in the check later work for both
git and hg, and made it platform agnostic.

Differential Revision: https://phabricator.services.mozilla.com/D136209
2022-01-28 17:04:33 +00:00
Makoto Kato 50557c9458 Bug 1746770 - "mach vendor rust" fails when crate has the directory name that uses space character. r=firefox-build-system-reviewers,mhentges
Differential Revision: https://phabricator.services.mozilla.com/D134241
2021-12-21 01:26:21 +00:00
Barret Rennie 023a32e855 Bug 1742480 - Don't anger watchman r=mhentges
If watchman is invoked (as part of hg's fsmonitor) with a path whose case does
not match the on-disk case (e.g., for case-insensitive file systems like NTFS),
it will get angry and throw a RootResolveError (although it will still work).
When doing `./mach try`, we end up invoking watchman several times which leads
to it getting very angry and throwing lots of errors.

This is all due to how we compute virtualenv paths -- by normcase()-ing them in
`mach.pth` -- which results in `push.py` having a lowercase path *even if* your
mozilla-central checkout has a non-lowercase on-disk path.

Calling Path.resolve() on the resulting path returns it to its on-disk
representation and no longer angers watchman.

Differential Revision: https://phabricator.services.mozilla.com/D133397
2021-12-10 06:04:46 +00:00
Mitchell Hentges 8f1fac4258 Bug 1739594: Don't hit network to resolve VCS-changed files r=ahal
Unless an upstream is specified, we should be able to detect which files
are changed on our local branch without hitting the network.

Differential Revision: https://phabricator.services.mozilla.com/D130684
2021-11-09 21:52:07 +00:00
surajeet310 ec79e93bd5 Bug 1717651 - Removed instances of 'ensure_subprocess_env' from python/mozversioncontrol r=mhentges
Since Python 2 is no longer used in python/mozversioncontrol, hence 'ensure_subprocess_env' is obsolete.

Differential Revision: https://phabricator.services.mozilla.com/D119905
2021-07-15 21:34:08 +00:00
Andrew Halberstadt 002c099fc4 No Bug - [mozversioncontrol] xfail 'test_branch.py' with git < 2.22.0, r=bhearsum
The 'git branch --show-current' flag didn't exist prior to that version.

Differential Revision: https://phabricator.services.mozilla.com/D112043
2021-04-14 20:49:26 +00:00
Andrew Halberstadt 408f22ce3b No Bug - [mozversioncontrol] Add a test for vcs.branch, r=bhearsum
Differential Revision: https://phabricator.services.mozilla.com/D112015
2021-04-14 14:03:10 +00:00
Ben Hearsum 93969911bd No bug: ensure ./mach taskgraph --diff returns you to your starting branch when using git. r=ahal
Differential Revision: https://phabricator.services.mozilla.com/D111848
2021-04-14 13:49:01 +00:00
Mitchell Hentges 9043e515e9 Bug 1645425: Annotate Sentry reports with base revision r=sheehan
To track whether issues being reported are for old versions, we attach
an hg revision hash as a release version with each report.

We use the base_ref because:
* It's a public revision that we can look up, and
* Since we only submit Sentry events when mach is unmodified,
  it's essentially acting as a version identifier.

Differential Revision: https://phabricator.services.mozilla.com/D108307
2021-03-30 16:22:58 +00:00
Andrew Halberstadt 572bdc8e0e Bug 1409733 - [mozversioncontrol] Add ability to update/checkout another revision, r=firefox-build-system-reviewers,mhentges
The specific use case here will be to help implement a new |mach taskgraph
--diff| command later on in this stack.

Differential Revision: https://phabricator.services.mozilla.com/D107270
2021-03-09 16:18:23 +00:00
Butkovits Atila de782976bf Backed out changeset 5153f0eaf518 (bug 1676533) as requested by glandium. CLOSED TREE 2020-12-02 07:58:47 +02:00
Ricky Stewart c9720a8ee7 Bug 1676533 - Consult the base revision for file hashes instead of the on-disk files in `mach artifact` r=ahal
This enables `mach artifact` and `mach bootstrap` to not fail due to local changes.

Differential Revision: https://phabricator.services.mozilla.com/D96892
2020-11-20 18:58:51 +00:00
Cristina Coroiu e1be39b9e8 Backed out changeset 101792a18a59 (bug 1676533) on request by Ricky for causing regressions 2020-11-18 18:10:04 +02:00
Ricky Stewart ddc8d97c34 Bug 1676533 - Consult the base revision for file hashes instead of the on-disk files in `mach artifact` r=ahal
This enables `mach artifact` and `mach bootstrap` to not fail due to local changes.

Differential Revision: https://phabricator.services.mozilla.com/D96892
2020-11-16 18:51:03 +00:00
Ricky Stewart 02a7b4ebdf Bug 1654103: Standardize on Black for Python code in `mozilla-central`.
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.

To produce this patch I did all of the following:

1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.

2. Run ./mach lint --linter black --fix

3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.

4. Make some ad-hoc manual updates to `testing/marionette/client/setup.py`, `testing/marionette/harness/setup.py`, and `testing/firefox-ui/harness/setup.py`, which have hard-coded regexes that break after the reformat.

5. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).

# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-26 18:34:53 +00:00
Bogdan Tara da1098d4aa Backed out 10 changesets (bug 1654103, bug 1672023, bug 1518999) for PanZoomControllerTest.touchEventForResult gv-junit failures CLOSED TREE
Backed out changeset ff3fb0b4a512 (bug 1672023)
Backed out changeset e7834b600201 (bug 1654103)
Backed out changeset 807893ca8069 (bug 1518999)
Backed out changeset 13e6b92440e9 (bug 1518999)
Backed out changeset 8b2ac5a6c98a (bug 1518999)
Backed out changeset 575748295752 (bug 1518999)
Backed out changeset 65f07ce7b39b (bug 1518999)
Backed out changeset 4bb80556158d (bug 1518999)
Backed out changeset 8ac8461d7bd7 (bug 1518999)
Backed out changeset e8ba13ee17f5 (bug 1518999)
2020-10-24 03:36:18 +03:00
Ricky Stewart c0cea3b0fa Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.

To produce this patch I did all of the following:

1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.

2. Run ./mach lint --linter black --fix

3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.

4. Make some ad-hoc manual updates to `testing/marionette/client/setup.py`, `testing/marionette/harness/setup.py`, and `testing/firefox-ui/harness/setup.py`, which have hard-coded regexes that break after the reformat.

5. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).

# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-23 20:40:42 +00:00
Dorel Luca 1ff59cb7a3 Backed out changeset 7558c8821a07 (bug 1654103) for multiple failures. CLOSED TREE 2020-10-22 03:51:06 +03:00
Ricky Stewart 50762dacab Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.

To produce this patch I did all of the following:

1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.

2. Run ./mach lint --linter black --fix

3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.

4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).

# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-21 21:27:27 +00:00
Mitchell Hentges 3d3a31abb7 Bug 1667750: safely handle unexpected hg ui.username format r=firefox-build-system-reviewers,rstewart
If the "ui.username" config option doesn't have a value in the expected
format, assume that the user email address is unknown instead of
throwing an exception.

Differential Revision: https://phabricator.services.mozilla.com/D91626
2020-09-28 19:02:35 +00:00
Ricky Stewart 9ad232391e Bug 1659602 - Fix type error in `mozversioncontrol` for Windows+`hg`+Python 3 r=dmajor
These arguments will get converted to `bytes` later on if necessary; if we don't defer to `hglib`, then we need proper strings.

Differential Revision: https://phabricator.services.mozilla.com/D87440
2020-08-18 12:51:49 +00:00
Ricky Stewart 9719a9a5a9 Bug 1636797 - In `hash.py`, enumerate files from the VCS rather than searching the filesystem directly r=ahal
This resolves a long-standing issue in development where `mach artifact` (and therefore `mach bootstrap`) would fail unpredictably if you had dirty, but ignored, files in your checkout. Resolving this problem often required unwieldy `hg purge`/`git ignore` incantations that are easy to get wrong.

This patch addresses the problem by doing what we "should" have been doing all along, and consulting the VCS to list tracked files rather than listing EVERY file on disk and applying heuristics to determine whether they should be included in the hash.

Differential Revision: https://phabricator.services.mozilla.com/D86780
2020-08-17 15:19:34 +00:00
Ricky Stewart f6051c3aa8 Bug 1658626 - When listing files from git in `mozversioncontrol`, ignore empty paths r=froydnj,mhentges
Without this patch, the last "path" in this list will always be the empty string due to how the `-z` option to `git` works. This mirrors what we already do in the `get_files_in_working_directory` implementation for `hg`.

Differential Revision: https://phabricator.services.mozilla.com/D86752
2020-08-12 00:10:43 +00:00
Mitchell Hentges b88610e3b1 Bug 1645196: Tune git settings to improve performance r=rstewart
Also adds a warning if a user's git version is older than 2.24

Differential Revision: https://phabricator.services.mozilla.com/D82128
2020-07-10 12:54:24 +00:00