Commit Graph
164 Commits
Author SHA1 Message Date
Stanca Serban fe08f82751 Bug 190831 - Fix lint failure. 2024-07-18 02:12:32 +03:00
Mike Hommey 2c1983f012 Bug 1908311 - Fix GitRepository.branch with older versions of git. r=sheehan
Differential Revision: https://phabricator.services.mozilla.com/D216786
2024-07-17 22:05:11 +00:00
Narcis Beleuzu 1a849f28bc Backed out changeset 387a97f5aa42 (bug 1908311) for python failure on test_branch.py. CLOSED TREE 2024-07-18 00:37:35 +03:00
Mike Hommey 8693fe94ff Bug 1908311 - Fix GitRepository.branch with older versions of git. r=sheehan
Differential Revision: https://phabricator.services.mozilla.com/D216786
2024-07-17 21:06:48 +00:00
Mike Hommey 604b98edbf Bug 1906930 - Fix SrcRepository.get_files when the SrcRepository is given a path other than the current directory. r=firefox-build-system-reviewers,ahochheiden
Differential Revision: https://phabricator.services.mozilla.com/D216502
2024-07-13 22:48:22 +00:00
Mike Hommey c84a1c44b8 Bug 1904903 - Don't let subprocess.check_output munge line endings. r=sheehan
It turns out subprocess functions have the annoying behavior of changing
line endings in `input` when using `text=True` or `universal_newlines=True`,
or even `encoding="utf-8"`. And git fast-import doesn't like `\r\n`.

Differential Revision: https://phabricator.services.mozilla.com/D215158
2024-06-28 02:51:13 +00:00
Mike Hommey 10356e831a Bug 1500188 - Don't modify working tree, index or HEAD when pushing to try with git. r=releng-reviewers,sheehan,ahal
Differential Revision: https://phabricator.services.mozilla.com/D214215
2024-06-24 23:07:29 +00:00
Mike Hommey 6a29083f11 Bug 1500188 - Change the API to create a try commit. r=releng-reviewers,sheehan,ahal
Currently, the caller potentially prepares files, add them to the VCS,
and then calls the function to create the commit, does whatever it wants
to do with it, then undoes it.

With the ultimate goal of not doing local changes to the work tree to
act on that try commit (for a push), this change in API makes it so
that everything except what do do with the commit is handled by one
function, that now takes paths and file contents for the files that were
previously created by the caller.

Differential Revision: https://phabricator.services.mozilla.com/D214214
2024-06-24 23:07:29 +00:00
Mike Hommey 1a0720f219 Bug 1903175 - Skip long pause at the end of mach try when using git. r=sheehan
Differential Revision: https://phabricator.services.mozilla.com/D214061
2024-06-18 07:23:38 +00:00
Norisz Fay efb37b410d Backed out changeset 97d38c9c9b5f (bug 1903175) for causing python failures on test_push_to_try.py CLOSED TREE 2024-06-18 08:49:46 +03:00
Mike Hommey 7508dd859c Bug 1903175 - Skip long pause at the end of mach try when using git. r=sheehan
Differential Revision: https://phabricator.services.mozilla.com/D214061
2024-06-18 03:28:13 +00:00
Malte Juergens 0cf663e6c5 Bug 1896978 - Return empty list of changed files instead of nothing in SrcRepository r=ahochheiden
Differential Revision: https://phabricator.services.mozilla.com/D210561
2024-05-29 20:16:14 +00:00
Matthew Gaudet d3d69d76f2 Bug 1898777 - Throw MissingUpstreamRepo from SrcRepository when calling get_outgoing_files r=ahochheiden
Differential Revision: https://phabricator.services.mozilla.com/D211579
2024-05-24 19:09:17 +00:00
ahochheiden a213434a41 Bug 1872242 - Change how the last segment of milestone_winversion is generated to improve uniqueness r=firefox-build-system-reviewers,glandium
The previous implementation used days since Jan 1 2000 for the last
16-bit segment. This was not unique enough and caused issues with
Antivirus software if two different channels were built on the same day.

The new approach uses hours since the last milestone bump and uses the
VCS to determine how long ago that was relative to the build time. This
means it will always reset when a new cycle begins, but still be unique
since the digits in the first 3 segments have incremented.

We also now use two of the 16-bits to encode the channel (nightly, beta,
ESR, and release). So two channels built within the same hour will still
be unique.

Using only 14-bits to store the 'hours since version bump', we have
about ~682 days from a version bump before we reach the maximum value we
can store. If a build is done after that point, the segment value will
always be the maximum value for that channel.

Differential Revision: https://phabricator.services.mozilla.com/D200989
2024-05-15 16:00:33 +00:00
Cristian Tuns fdc81b299a Backed out changeset b685d0db4248 (bug 1872242) for causing py3 failures in test_commit.py CLOSED TREE 2024-04-29 13:27:46 -04:00
ahochheiden 01bfbae2db Bug 1872242 - Change how the last segment of milestone_winversion is generated to improve uniqueness r=firefox-build-system-reviewers,glandium
The previous implementation used days since Jan 1 2000 for the last
16-bit segment. This was not unique enough and caused issues with
Antivirus software if two different channels were built on the same day.

The new approach uses hours since the last milestone bump and uses the
VCS to determine how long ago that was relative to the build time. This
means it will always reset when a new cycle begins, but still be unique
since the digits in the first 3 segments have incremented.

We also now use two of the 16-bits to encode the channel (nightly, beta,
ESR, and release). So two channels built within the same hour will still
be unique.

Using only 14-bits to store the 'hours since version bump', we have
about ~682 days from a version bump before we reach the maximum value we
can store. If a build is done after that point, the segment value will
always be the maximum value for that channel.

Differential Revision: https://phabricator.services.mozilla.com/D200989
2024-04-29 16:48:10 +00:00
Sandor Molnar e44d6c70d5 Backed out changeset 344524bd7c75 (bug 1872242) for causing bug 1879519 CLOSED TREE 2024-02-15 23:04:14 +02:00
ahochheiden e77c3ff321 Bug 1872242 - Change how the last segment of milestone_winversion is generated to improve uniqueness r=firefox-build-system-reviewers,RyanVM,glandium
The previous implementation used days since Jan 1 2000 for the last
16-bit segment. This was not unique enough and caused issues with
Antivirus software if two different channels were built on the same day.

The new approach uses hours since the last milestone bump and uses the
VCS to determine how long ago that was relative to the build time. This
means it will always reset when a new cycle begins, but still be unique
since the digits in the first 3 segments have incremented.

We also now use two of the 16-bits to encode the channel (nightly, beta,
ESR, and release). So two channels built within the same hour will still
be unique.

Using only 14-bits to store the 'hours since version bump', we have
about ~682 days from a version bump before we reach the maximum value we
can store. If a build is done after that point, the segment value will
always be the maximum value for that channel.

Differential Revision: https://phabricator.services.mozilla.com/D200989
2024-02-08 07:00:48 +00:00
ahochheiden 2d453b8630 Bug 1875052 - Change various RegEx patterns to raw strings to remove syntax warnings on Python 3.12 r=firefox-build-system-reviewers,glandium
Differential Revision: https://phabricator.services.mozilla.com/D199946
2024-02-02 20:52:24 +00:00
Eemeli Aro 941b40ea4b Bug 1877101 - Add git source support to l10n lint. r=bolsson,flod,linter-reviewers,sylvestre
Adds a CLI option `--l10n-git` that uses the firefox-l10n-source git repo instead of the gecko-strings hg repo when linting localization files.

When we complete the migration, the option and mercurial repo support should be removed.

Differential Revision: https://phabricator.services.mozilla.com/D199866
2024-02-02 12:25:28 +00:00
Connor Sheehan eee70aada3 Bug 1869733: consider all official remotes when finding base ref and patches r=zeid
A previous patch added parsing `git remote -v`, preferring
`mozilla-unified` as the official upstream remote and falling
back to the first official-looking remote if unified was not
found. We assumed that a developer is either using mozilla-unified,
or is using a single-headed repo like central. This overlooks
the fact that it is possible to clone from central, and then
pull other repos in, creating a repo with multiple official
remotes.

Update the `get_upstream_remote` function to find all official
looking remotes instead of a single official remote, and change
the `get_remote_arg` function to return a list of `--remotes`
arguments to be passed to various Git commands. This allows
Git to take all official remotes into consideration and more
precisely find the commits which are not present on any official
upsteams.

Add a test for `get_mozilla_remote_args` while we are here.

Differential Revision: https://phabricator.services.mozilla.com/D199637
2024-01-25 20:04:09 +00:00
serge-sans-paille 573c09ea67 Bug 1874843 - Remove invalid escaping met during mach clobber r=jcristau
Differential Revision: https://phabricator.services.mozilla.com/D198673
2024-01-16 13:22:04 +00:00
Connor Sheehan a6c83034fd Bug 1856590: create a function to return --remotes arg and use in get_branch_nodes r=ahochheiden
In bug 1866395 I added a function to return the canonical Firefox
remote and use it when determining the base ref. I overlooked
that this also needs to be used for `get_branch_nodes` to avoid
returning a set of branch nodes that doesn't begin from the same
base ref. Move the building of the `--remotes` arg to a separate
function and use it in `get_branch_nodes`.

Differential Revision: https://phabricator.services.mozilla.com/D198032
2024-01-09 18:04:09 +00:00
Joel Maher 93a74ef1b8 Bug 1869430 - Batch 19.2 convert python unittest .ini -> .toml. r=gbrown,taskgraph-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D196124
2023-12-12 17:40:03 +00:00
Andrew Halberstadt 255518ea5c Bug 1867990 - Fix black formatting errors that snuck in due to regression, r=linter-reviewers,taskgraph-reviewers,releng-reviewers,bhearsum,sylvestre
These were not caught due to bug 1865672.

Depends on D195431

Differential Revision: https://phabricator.services.mozilla.com/D195432
2023-12-04 14:51:39 +00:00
Connor Sheehan 4db8d52a9b Bug 1866395: add get_mozilla_upstream_remote and use it to find Git base ref r=ahochheiden
Add a `get_mozilla_upstream_remote` method for `GitRepository` that
scans the output of `git remote -v` for an official Mozilla URL. Use
this URL in `base_ref` to limit the remotes considered for remote
branches, defaulting to `--remotes` without an argument if one can't
be found.

Differential Revision: https://phabricator.services.mozilla.com/D194881
2023-11-30 22:23:01 +00:00
Connor Sheehan 4e254deb24 Bug 1867036: use --always to force headers for empty commits r=gerard-majax
Git versions before 2.41 don't display headers for empty commits
in `git format-patch`. Force headers to display with `--always`,
so Lando can properly apply the patch when pushing to try.

Differential Revision: https://phabricator.services.mozilla.com/D194911
2023-11-29 15:24:38 +00:00
Connor Sheehan d2c6cc06f5 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 6c53680dc2 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 e11bdf3e90 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 0d18b15cd8 Backed out changeset a8d1b2a81511 (bug 1853184) for causing python vcs failures CLOSED TREE 2023-09-19 01:46:40 +03:00
Connor Sheehan 347b832046 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 2a45eb4c58 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 dc83322a06 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 e5840e22ec 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 95f053c9e0 Backed out changeset fab57c6553f4 (bug 1798746) for causing win aarch64 build bustages. CLOSED TREE 2023-05-09 08:25:18 +03:00
nicklas boman 1e2abf67bd 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 0da7934c25 Backed out changeset 02cc74634f7d (bug 1798746) for causing build bustages. CLOSED TREE 2023-05-03 20:54:50 +03:00
nicklas boman 434444c558 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 83bc2ca934 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 e0f5dfb939 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 f661e9875a 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 1f86313eb3 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 f2004b2001 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 9905632fd2 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 d727302513 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 e27dd67d9d 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 5744b3fc73 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 e576359295 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 f0d3b29efe 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