Commit Graph

116 Commits

Author SHA1 Message Date
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
ahochheiden
4aef51dc7c 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
f7baa21a2e 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
1bbc1f0978 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
21aa69e113 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
8ccd98e2dc 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
fa861d1c31 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
22cf0ed857 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
c40c8d3c7c 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
50ed570441 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
24c6e794f2 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
02bd2587b7 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
1071e4086b 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
cf6bd72f7f 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
27cfdf79f2 Backed out changeset 5153f0eaf518 (bug 1676533) as requested by glandium. CLOSED TREE 2020-12-02 07:58:47 +02:00
Ricky Stewart
0263368864 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
08aa104e9c Backed out changeset 101792a18a59 (bug 1676533) on request by Ricky for causing regressions 2020-11-18 18:10:04 +02:00
Ricky Stewart
dd5c783588 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
31b8ca9716 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
612312a64c 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
065d2eb893 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
95b44c982f Backed out changeset 7558c8821a07 (bug 1654103) for multiple failures. CLOSED TREE 2020-10-22 03:51:06 +03:00
Ricky Stewart
43baed3c18 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
99f26a2e2d 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
9665739ec6 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
85c1a8c229 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
2c063cc3d4 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
f15445a4a4 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
Sebastian Hengst
f4e1ce210a Backed out changeset d72c64af2c23 (bug 1645196) for very frequently failing remote(pup) task 2020-07-10 12:13:10 +02:00
Mitchell Hentges
086bea1406 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-07 18:29:37 +00:00
Mitchell Hentges
03b47de7b3 Bug 1649565: Sentry setup should support user-less VCS setups r=rstewart
Differential Revision: https://phabricator.services.mozilla.com/D81792
2020-07-02 18:31:05 +00:00
Mitchell Hentges
2e7585008f Bug 1646832: Don't report Sentry issues for build team members r=rstewart
Differential Revision: https://phabricator.services.mozilla.com/D80913
2020-06-29 17:58:06 +00:00
Kagami Sascha Rosylight
47c29ca063 Bug 1643192 - Use git log to get base ref r=glandium
Since there are still needs for .base_ref(), this uses git log way to get base commit.

Differential Revision: https://phabricator.services.mozilla.com/D78183
2020-06-18 06:39:55 +00:00
Mitchell Hentges
91b9a1e385 Bug 1640815: Raise helpful error if no non-public commits on bootstrap r=rstewart
Differential Revision: https://phabricator.services.mozilla.com/D77505
2020-05-29 18:35:35 +00:00
Ricky Stewart
bb665b3996 Bug 1637333 - Ensure we don't pass bad environment variables to subprocess.check_call() in mozversioncontrol r=ahal
Differential Revision: https://phabricator.services.mozilla.com/D74888
2020-05-12 16:58:21 +00:00
Andrew Halberstadt
ca409532f6 Bug 1637305 - [mozversioncontrol] Don't use bytes in HGRepository.working_directory_clean, r=rstewart
Differential Revision: https://phabricator.services.mozilla.com/D74880
2020-05-12 16:49:24 +00:00
Ricky Stewart
85535579f8 Bug 1633494 - Augment hg command used to get commit time r=glandium
`hg` gives us some additional levers to tweak when determining which commits are public and non-public. All the better, because `hg`'s default behavior under a rebase is to preserve the original commit time, so if you rebase a month-old commit on the latest version of central, you might still get the "revision too old" error despite your tree actually being completely up-to-date. Here we replace the original logic with something a little bit more robust to that scenario.

As before, this is a best-effort check that might have false positives or false negatives; this commit doesn't change that, but hopefully it decreases the amount of false positives under `hg`.

Differential Revision: https://phabricator.services.mozilla.com/D74745
2020-05-12 15:53:14 +00:00
Ricky Stewart
8a88a03153 Bug 1632916 - Run JS/web-platform/ipdl build machinery in Python 3 r=jgraham,nika,glandium
Differential Revision: https://phabricator.services.mozilla.com/D72478
2020-05-05 20:32:12 +00:00
Bogdan Tara
c405bd1997 Backed out 6 changesets (bug 1632916, bug 1599658, bug 1633037, bug 1633039, bug 1633016, bug 1632920) for SA bustages CLOSED TREE
Backed out changeset 332ce0963b4e (bug 1633039)
Backed out changeset a9904cbc40d9 (bug 1633037)
Backed out changeset d06b0ec349f8 (bug 1599658)
Backed out changeset 8fd300cad80f (bug 1633016)
Backed out changeset f8820941c703 (bug 1632916)
Backed out changeset ac9c2c8746ed (bug 1632920)
2020-05-02 01:49:29 +03:00
Ricky Stewart
eaeec40ca7 Bug 1632916 - Run JS/web-platform/ipdl build machinery in Python 3 r=jgraham,nika,glandium
Differential Revision: https://phabricator.services.mozilla.com/D72478
2020-05-01 16:31:21 +00:00
Kagami Sascha Rosylight
8327fe0008 Bug 1543872 - Use git log --not --remotes r=glandium
The current way to get outgoing files in Git passes every branch to merge-base, which generates a way too long command that fails on Windows. This patch tries using `git log --not --remotes` instead of passing merge-base value.

Differential Revision: https://phabricator.services.mozilla.com/D71802
2020-04-28 07:27:51 +00:00
Tom Prince
50a4035f02 Bug 1632688: [mozversioncontrol] Don't try to add files if none are provided; r=ahal,rstewart a=tomprince
Differential Revision: https://phabricator.services.mozilla.com/D72414
2020-04-24 12:18:26 -06:00
Ricky Stewart
9872513891 Bug 1630668 - Fix incompatible type signatures in subclasses of Repository r=dmajor
Differential Revision: https://phabricator.services.mozilla.com/D71200
2020-04-16 17:07:19 +00:00
Ricky Stewart
6725d8c09e Bug 1630317 - Add a warning if there is an attempt to mach bootstrap from an "old commit" r=nalexander
Differential Revision: https://phabricator.services.mozilla.com/D71076
2020-04-15 20:58:58 +00:00
Tom Prince
b73397d0b5 Bug 1630047 - Allow mozversioncontrol to add or remove multiple files at once; r=ahal
Differential Revision: https://phabricator.services.mozilla.com/D70938
2020-04-15 22:16:49 +00:00
Steve Fink
d3913d9ab7 Bug 1621322 - Implement mach lint --revset=REV r=ahal
In the process, fixed a few bugs:
 - the template eg `{file_adds % "\n{file}"}` produced a leading blank line,
   which led to everything being linted.
 - 'd' was replaced with 'r' in diff_filters, but the replacement was discarded.
 - as a result of the above, `hg status -d` was being used ("show only deleted (but tracked) files") and now it is `hg status -r` ("show only removed files"). I *think* this is what was intended?

Differential Revision: https://phabricator.services.mozilla.com/D66714
2020-03-22 22:12:18 +00:00
Steve Fink
4a62f6a23c Bug 1621322 - mozversioncontrol: pre-existing bug fix, do not run git test under hg r=ahal
Differential Revision: https://phabricator.services.mozilla.com/D67584
2020-03-22 22:11:55 +00:00
Geoff Brown
114f36652f Bug 1622789 - Remove mozversioncontrol dependency on distutils; r=ahal
Use mozfile.which instead of distutils.

Differential Revision: https://phabricator.services.mozilla.com/D67194
2020-03-18 17:12:14 +00:00
Mike Shal
4f0269a072 Bug 1611006 - Convert python/mozbuild/mozbuild/test/action to python3; r=firefox-build-system-reviewers,rstewart
Differential Revision: https://phabricator.services.mozilla.com/D60769
2020-02-28 20:56:31 +00:00