Commit Graph

67 Commits

Author SHA1 Message Date
Mike Shal
5701a85794 Bug 1611006 - Convert python/mozbuild/mozbuild/test/action to python3; r=firefox-build-system-reviewers,rstewart
Differential Revision: https://phabricator.services.mozilla.com/D60769

--HG--
extra : moz-landing-system : lando
2020-02-28 20:56:31 +00:00
Daniel Varga
3d8a78a06f Backed out changeset 6851f568b173 (bug 1611006) for causing nightly bustages a=backout 2020-01-31 03:30:45 +02:00
Mike Shal
3fe87081bf Bug 1611006 - Convert python/mozbuild/mozbuild/test/action to python3; r=firefox-build-system-reviewers,rstewart
Differential Revision: https://phabricator.services.mozilla.com/D60769

--HG--
extra : moz-landing-system : lando
2020-01-30 09:52:25 +00:00
Edwin Takahashi
b66e852ab2 Bug 1592855 - run mach vendor python with python3 r=ahal
Differential Revision: https://phabricator.services.mozilla.com/D51414

--HG--
extra : moz-landing-system : lando
2019-11-05 15:29:44 +00:00
Ricky Stewart
16a6c7da5c Bug 1587232 - ./mach vendor rust leaves the tree in an unclear state if it would bring in a file that's too large r=firefox-build-system-reviewers,mshal
Add code to clean up Git and Hg repositories, and invoke that where `./mach vendor rust` would throw an error. Unfortunately, `cargo vendor` also updates the repo's root `Cargo.lock` file in-place and while we could `git checkout`/`hg revert` that file for the user, `Cargo.lock` may have had pre-existing changes that would be overwritten by such a change. Instead of a potentially destructive update in the error case, I've opted to add an extra error message to tell you how to deal with that one file.

Differential Revision: https://phabricator.services.mozilla.com/D49494

--HG--
extra : moz-landing-system : lando
2019-10-21 18:23:36 +00:00
Andrew Halberstadt
9067e54ba4 Bug 1586010 - [mozversioncontrol] Ensure env in appropriate format for subprocess, r=chmanchester
Environment should be bytes on Python 2 (to avoid Windows errors) and text on
Python 3. The 'ensure_subprocess' env utility function handles this.

Differential Revision: https://phabricator.services.mozilla.com/D48115

--HG--
extra : moz-landing-system : lando
2019-10-04 15:48:24 +00:00
Mike Hommey
b53fa7eb49 Bug 1561632 - Back out bug 1554987. r=ahal
Bug 1554987 made `mach try` use a transient remote, but that causes
problems with existing setups that happen to use the same remote name,
because of a combination of not-quite-as-documented-as-it-should
behavior of git.

- `git -c foo.bar=qux` doesn't override the value of `foo.bar` from the
  git configuration when `foo.bar` is an item that can take several
  values.
- `remote.$remote.url` and `remote.$remote.pushurl` take several values,
  allowing to give several URLs.

The combination of both means that if the git configuration already has
`remote.try.url` set, that value takes precedence (because git push
tries them one after the other, and takes the one from the command line
last)

One way we could increase the chances of things working out fine would
be to use `remote.try.pushurl`, which if already set, is more likely to
be right than an existing `remote.try.url`.

OTOH, it turns out, after more investigation, that bug 1554987 requires
a footgunny setup to happen in the first place. Namely, it requires
having run `git lfs install` from a git-cinnabar clone.

so we just go back to the previous status quo.

Differential Revision: https://phabricator.services.mozilla.com/D36149

--HG--
extra : moz-landing-system : lando
2019-06-28 15:58:36 +00:00
L. David Baron
f721ff614d Bug 1515105 - Adjust test for turning off git commit.gpgSign when making temporary commits for try pushes. r=ahal
Differential Revision: https://phabricator.services.mozilla.com/D35876

--HG--
extra : moz-landing-system : lando
2019-06-26 15:04:01 +00:00
L. David Baron
36f9d91fe8 Bug 1515105 - Turn off git commit.gpgSign when making temporary commits for try pushes. r=ahal
Differential Revision: https://phabricator.services.mozilla.com/D35726

--HG--
extra : moz-landing-system : lando
2019-06-25 17:21:47 +00:00
Mike Hommey
cff8fe1fbc Bug 1554987 - Invoke git push with a remote name for mach try. r=ahal
The git version shipped in some versions of OSX is patched by apple in a
way such that doing `git push hg::ssh://...` fails with an error message
like `Invalid remote name "hg::ssh://...`.

So instead, we define a named remote via inline configuration, and use
that remote's name for the push.

Differential Revision: https://phabricator.services.mozilla.com/D35351

--HG--
extra : moz-landing-system : lando
2019-06-24 21:36:31 +00:00
Dorel Luca
49c9b3a351 Backed out changeset 21826fb830de (bug 1554987) for py2 and py3 failures. CLOSED TREE 2019-06-25 00:28:50 +03:00
Kartikaya Gupta
e6c7a2e2b3 Bug 1519598 - Add a commit function in the repository helper. r=ahal
Differential Revision: https://phabricator.services.mozilla.com/D35205

--HG--
extra : moz-landing-system : lando
2019-06-24 20:50:04 +00:00
Mike Hommey
e5d8e3b235 Bug 1554987 - Invoke git push with a remote name for mach try. r=ahal
The git version shipped in some versions of OSX is patched by apple in a
way such that doing `git push hg::ssh://...` fails with an error message
like `Invalid remote name "hg::ssh://...`.

So instead, we define a named remote via inline configuration, and use
that remote's name for the push.

Differential Revision: https://phabricator.services.mozilla.com/D35351

--HG--
extra : moz-landing-system : lando
2019-06-24 14:40:21 +00:00
Aaron Klotz
ede6539296 Bug 1520309: Set HGPLAIN env var when running hg push-to-try; r=ahal
If there are a large number of untracked files in the working directory, hg
will attempt to print them all out with the default pager. This does not
interact very will with commands that are built atop this functionality. We
set HGPLAIN=1 so that the underlying hg will not attempt to use a pager.

Differential Revision: https://phabricator.services.mozilla.com/D26607

--HG--
extra : moz-landing-system : lando
2019-04-09 21:10:49 +00:00
Andrew Halberstadt
0e9c1caf7d Bug 1515261 - [mozversioncontrol] Fix unicode env string on Windows, r=sheehan
Differential Revision: https://phabricator.services.mozilla.com/D15727

--HG--
extra : moz-landing-system : lando
2019-01-07 16:26:49 +00:00
arthur.iakab
9830caa477 Backed out changeset 5f6139ef7c2c (bug 1515261) for causing Windows build bustages CLOSED TREE 2019-01-04 18:29:53 +02:00
Andrew Halberstadt
ca42ae34eb Bug 1515261 - [mozversioncontrol] Fix unicode env string on Windows, r=sheehan
Differential Revision: https://phabricator.services.mozilla.com/D15727

--HG--
extra : moz-landing-system : lando
2019-01-04 15:31:56 +00:00
Andrew Halberstadt
21dc8454f4 Bug 1472177 - Run mozversioncontrol tests under python 3 r=gps
This also enables the py2 linter which will help maintain compatibility
with both 2 and 3.

Differential Revision: https://phabricator.services.mozilla.com/D1884

--HG--
extra : moz-landing-system : lando
2018-07-24 21:21:46 +00:00
Gregory Szorc
4a88e570a0 Bug 1475649 - Always use --untracked-files; r=ahal
a35b188d0e44 inadvertently regressed behavior in the case where
the Git status.showUntrackedFiles config option was set and
we want to purge untracked files.

Differential Revision: https://phabricator.services.mozilla.com/D2141

--HG--
extra : moz-landing-system : lando
2018-07-16 13:19:09 +00:00
Andrew Halberstadt
5935acc8f0 Bug 1475649 - [mozversioncontrol] Make vcs.working_directory_clean() ignore untracked files by default r=jgraham
The doc string for the "working_directory_clean" function states:
> By default, untracked and ignored files are not considered.

But the git implementation for this function used to run:
git status --porcelain

Which *does* consider untracked files by default. Instead, we need to run:
git status --porcelain --untracked-files=no

Differential Revision: https://phabricator.services.mozilla.com/D2134

--HG--
extra : moz-landing-system : lando
2018-07-13 20:54:08 +00:00
Andrew Halberstadt
0ad2e9342d Bug 1413922 - [tryselect] Merge vcs.py into mozversioncontrol r=gps
Differential Revision: https://phabricator.services.mozilla.com/D1808

--HG--
rename : tools/tryselect/vcs.py => tools/tryselect/push.py
extra : moz-landing-system : lando
2018-07-10 19:22:00 +00:00
Andrew Halberstadt
812d9fb038 Bug 1413922 - [mozversioncontrol] Always use hglib.client if available and fall back to subprocesses if not, r=gps
Most HG commands use subprocesses, even if a context manager (and therefore an
hglib client) has been created. There are only two commands that make use of
the client, but they *only* work inside a context manager. I don't think
there are any technical reason these two commands *need* to use the context
manager.

This patch merges the HgRepository._run_in_client function with
HgRepository._run(). If a client exists, that will be used, otherwise a
subprocess will be used.

Differential Revision: https://phabricator.services.mozilla.com/D1809

--HG--
extra : moz-landing-system : lando
2018-07-10 20:41:49 +00:00
Coroiu Cristina
07726be245 Backed out 2 changesets (bug 1413922) for breaking Nightly L10n a=backout
Backed out changeset e7a1d749ff9a (bug 1413922)
Backed out changeset b3bead1f5729 (bug 1413922)

--HG--
rename : tools/tryselect/push.py => tools/tryselect/vcs.py
2018-07-10 03:11:28 +03:00
Andrew Halberstadt
23c2416671 Bug 1413922 - [tryselect] Merge vcs.py into mozversioncontrol r=gps
Differential Revision: https://phabricator.services.mozilla.com/D1808

--HG--
rename : tools/tryselect/vcs.py => tools/tryselect/push.py
extra : moz-landing-system : lando
2018-07-07 00:32:11 +00:00
Andrew Halberstadt
cd200f6d34 Bug 1413922 - [mozversioncontrol] Always use hglib.client if available and fall back to subprocesses if not, r=gps
Most HG commands use subprocesses, even if a context manager (and therefore an
hglib client) has been created. There are only two commands that make use of
the client, but they *only* work inside a context manager. I don't think
there are any technical reason these two commands *need* to use the context
manager.

This patch merges the HgRepository._run_in_client function with
HgRepository._run(). If a client exists, that will be used, otherwise a
subprocess will be used.

Differential Revision: https://phabricator.services.mozilla.com/D1809

--HG--
extra : moz-landing-system : lando
2018-06-26 00:13:58 +00:00
Andrew Halberstadt
9435736ade Bug 1471620 - Skip python-tests locally that don't run with python 3 in CI r=davehunt
This will make sure that when running |mach python-test --python 3| locally,
we only run the tests that also run in CI with python 3 (and therefore pass
presumably).

MozReview-Commit-ID: 3OBr9yLSlSq

--HG--
extra : rebase_source : 456340d0ecdddf1078f2b5b4ebb1eddf3813b26a
2018-06-27 11:10:02 -04:00
Dave Hunt
c65268bd7a Bug 1388013 - Support running |mach python-test| against Python 3 using pipenv; r=ahal
This patch allows executing |mach python-test| against Python 3 by specifying the optional |--three| command line option. When this option is present, pipenv will be used to manage a virtual environment using Python 3 and attempt to run the tests. When it is not present, pipenv will not be used, and everything will work as it did before this patch.

My original plan was to use pipenv regardless of the target version of Python, however I encountered several issues running some of the tests against our Python packages. Once all tests have been patched to run against Python 3, then we should be able to use pipenv when running them against Python 2.

Note that this patch allows tests to run against Python 3, but there are plenty of issues preventing them from passing. With this patch in place we can start to add Python 3 support to our packages and have the tests running in CI to ensure we don't regress back to just supporting Python 2.

MozReview-Commit-ID: BuU5gZK83hL


IHG: changed taskcluster/ci/source-test/python.yml

--HG--
extra : rebase_source : ca2b15d905f7a5c895a2fd8916144841f5d205de
2018-05-03 10:34:22 +01:00
Andreea Pavel
dd5cd1d832 Backed out 3 changesets (bug 1388013) for build bustages e.g. ../python/mozbuild/mozpack/test/test_files.py on a CLOSED TREE
Backed out changeset eea857170a41 (bug 1388013)
Backed out changeset c55bfefbd4e1 (bug 1388013)
Backed out changeset 3a163da2b21b (bug 1388013)
2018-05-31 11:48:19 +03:00
Dave Hunt
18568a8c94 Bug 1388013 - Support running |mach python-test| against Python 3 using pipenv; r=ahal
This patch allows executing |mach python-test| against Python 3 by specifying the optional |--three| command line option. When this option is present, pipenv will be used to manage a virtual environment using Python 3 and attempt to run the tests. When it is not present, pipenv will not be used, and everything will work as it did before this patch.

My original plan was to use pipenv regardless of the target version of Python, however I encountered several issues running some of the tests against our Python packages. Once all tests have been patched to run against Python 3, then we should be able to use pipenv when running them against Python 2.

Note that this patch allows tests to run against Python 3, but there are plenty of issues preventing them from passing. With this patch in place we can start to add Python 3 support to our packages and have the tests running in CI to ensure we don't regress back to just supporting Python 2.

MozReview-Commit-ID: BuU5gZK83hL


IHG: changed taskcluster/ci/source-test/python.yml

--HG--
extra : rebase_source : e1a64c0ffa8fe5cce71a041579601d4a72e37779
2018-05-03 10:34:22 +01:00
Andrew Halberstadt
5f3289da9a Bug 1405588 - [mozversioncontrol] Use base_ref instead of upstream as default outgoing comparison on git, r=gps
Detecting the upstream repository isn't always possible. Using 'git merge-base'
seems to be a more reliable way of detecting outgoing files.


MozReview-Commit-ID: 3zOdTRIcggw

--HG--
extra : rebase_source : 56dfd16bbddca38195f6a833dc5696cf509f3fa8
2017-11-01 12:57:03 -04:00
Andrew Halberstadt
6aca667eaf Bug 1405588 - [mozversioncontrol] Add ability to get base revision, r=gps
In addition to help fix this bug, having the base revision will allow us
to download the most likely relevant artifacts from CI. For example, in
|mach try| we can search for a 'full-taskgraph.json' artifact from the
most relevant decision task, even if not updated to the latest central.

The ability to find the base revision will also be needed when merging
tools/tryselect/vcs.py into mozversioncontrol.

MozReview-Commit-ID: 2WRRs4AoXcK

--HG--
extra : rebase_source : 28d759ffaece14dd260402fa730136288ab8111b
2017-10-26 17:04:22 -04:00
Andrew Halberstadt
98df27cb1b Bug 1401199 - [mozversioncontrol] Add property to get hash of HEAD revision, r=mshal
MozReview-Commit-ID: 9XWlLeGcPeQ

--HG--
extra : rebase_source : 89cf1dbe133d2ce4d8ffaad017aa151ed08491cd
2017-09-29 11:10:59 -04:00
Andrew Halberstadt
a73d388c79 Bug 1401309 - [mozlint] Remove vcs.py and use mozversioncontrol instead, r=gps
This also migrates the vcs.py test to mozversioncontrol and adds a new task for
it.

MozReview-Commit-ID: 9jTRkjNupVA

--HG--
extra : rebase_source : 400f27498e00ea45234ad7c951770b098e916b8e
2017-09-25 16:30:27 -04:00
Andrew Halberstadt
34a14440b5 Bug 1401309 - [mozversioncontrol] Add an option to make failed subprocess commands non-fatal, r=gps
Sometimes commands return non-zero even though everything is ok. For example,
'hg outgoing' returns 1 if there are no outgoing files. This adds a way for
specific function calls not to abort if something goes wrong. Instead, stderr
will be printed (if any) and an empty string is returned.

MozReview-Commit-ID: E089djeHrmr

--HG--
extra : rebase_source : be351f357705e09c3fe876cecefa7ddd9c48987e
2017-09-25 16:30:13 -04:00
Andrew Halberstadt
8bee138c46 Bug 1401309 - [mozversioncontrol] Add ability to get outgoing files, r=gps
This adds 'get_outgoing_files'. First it automatically attempts to find the
upstream remote the current change is based on, then returns all files changed
in the local branch.

If an upstream remote can't be detected, it raises MissingUpstreamRepo

MozReview-Commit-ID: 9zSB9EdwVU8

--HG--
extra : rebase_source : e352d6d471644ef9eda76b972b789d6b54449471
2017-09-20 10:15:09 -04:00
Andrew Halberstadt
13b127e919 Bug 1401309 - [mozversioncontrol] Merge get_modified_files and get_added_files into a single function, r=gps
There's currently a function for getting added files (A) and modified files
(M). We'll also eventually need the ability to get deleted files (D) and any
combination of the above, e.g (AM). Rather than creating a new function for
each possible case, let's have a single function where you can pass in which
modifiers you are interested in. With this patch, if you want all modified and
added files, you can do:

get_changed_files('AM')

By default 'ADM' is used.

This also adds a 'mode' option for git. This allows consumers to return staged
files, unstaged files or both. The default ('unstaged') keeps the current
behaviour in tact.

MozReview-Commit-ID: 9IA1bxaJS80

--HG--
extra : rebase_source : 160f650220ca9a35b4b116bc9fa13f28d84419fa
2017-09-20 10:06:11 -04:00
Andrew Halberstadt
8dd527bf64 Bug 1401309 - Add python/mozversioncontrol to flake8 linter, r=gps
MozReview-Commit-ID: KuyEYa3Mbgd

--HG--
extra : rebase_source : cd3c111432de83d19004946c491f10959fd6d675
2017-09-20 10:02:26 -04:00
Gregory Szorc
2cf6305161 Bug 1397406 - Add Repository method to determine if working directory clean; r=dustin
This is generally useful functionality to have. A consume will be
introduced in an upcoming commit.

MozReview-Commit-ID: 4arTMfJSiEC

--HG--
extra : rebase_source : 4bcf70f58b57b79b8dcb7a6eed633e1c7e42aca3
2017-09-06 12:15:12 -07:00
Gregory Szorc
0b25d43eaf Bug 1393242 - Use hglib for get_files_in_working_directory(); r=mshal
And convert consumers to context managers because hglib requires that.

MozReview-Commit-ID: Ckf1yBYeUlm

--HG--
extra : rebase_source : 985220032bced1a7077fd9b04ca8ad6de822c887
2017-08-23 15:21:16 -07:00
Gregory Szorc
8634ccb29c Bug 1393242 - Hook up hglib to HgRepository; r=mshal
Because hglib spawns a persistent process, we introduce a context
manager for Repository. It no-ops by default. On HgRepository it
controls the lifetime of the persistent hg process.

A helper method for running an hg command via hglib has been added.
We can't transition existing methods to hglib because hglib
requires a context manager, which no consumer is using yet.

MozReview-Commit-ID: 8z0fcGFeAm5

--HG--
extra : rebase_source : 1cbfe44a5aafe838c25bcde91cc1deaf5e7367de
2017-08-23 15:09:27 -07:00
Gregory Szorc
0b2782154b Bug 1393242 - Helper function to obtain a repository from a build config; r=mshal
Some callers already have a build config object. Let's not
make them call a function that imports buildconfig.

MozReview-Commit-ID: J22HhyVma9y

--HG--
extra : rebase_source : fe5151925aee76508d26a9368e7a2ebec7e23ddb
2017-08-23 15:03:36 -07:00
Gregory Szorc
276defc2a7 Bug 1393503 - Proper error handling for failure to find VCS tool; r=glandium,nalexander
``print()`` has no business being in library code like this. It was
a holdover from this code being copied from bootstrap. So remove it.

While we're here, replace the generic exception with a specific one.
We don't want to be swallowing bugs via ``except Exception``.

MozReview-Commit-ID: 49goUstfPBz

--HG--
extra : rebase_source : a821159bd12a449ed1a0edf21a1f9eb29711ad95
2017-08-24 17:09:09 -07:00
Gregory Szorc
ddb8b492b5 Backed out changesets 18d89d8ab860, ffe8bef74be0, 159028ef12d2, 217260fb6976, 0279960d71ab (bug 1393242)
For a test failure.

--HG--
extra : histedit_source : c5f4167443174fa3144f139e976ae504a8efdad3%2C43a2beb21406adf114e7b64a734ec71284e50cc5
2017-08-24 16:07:44 -07:00
Gregory Szorc
1184431374 Bug 1393242 - Use hglib for get_files_in_working_directory(); r=mshal
And convert consumers to context managers because hglib requires that.

MozReview-Commit-ID: Ckf1yBYeUlm

--HG--
extra : rebase_source : e76b2690bd02bc6889dbe0f4524d61669ba82367
2017-08-23 15:21:16 -07:00
Gregory Szorc
aaff94550d Bug 1393242 - Hook up hglib to HgRepository; r=mshal
Because hglib spawns a persistent process, we introduce a context
manager for Repository. It no-ops by default. On HgRepository it
controls the lifetime of the persistent hg process.

A helper method for running an hg command via hglib has been added.
We can't transition existing methods to hglib because hglib
requires a context manager, which no consumer is using yet.

MozReview-Commit-ID: 8z0fcGFeAm5

--HG--
extra : rebase_source : 914322f3647fb29406a22203811ac8cc0ac82420
2017-08-23 15:09:27 -07:00
Gregory Szorc
7360761282 Bug 1393242 - Helper function to obtain a repository from a build config; r=mshal
Some callers already have a build config object. Let's not
make them call a function that imports buildconfig.

MozReview-Commit-ID: J22HhyVma9y

--HG--
extra : rebase_source : fa013dc0d8f85d1767e5666107ea656a17d137a2
2017-08-23 15:03:36 -07:00
Gregory Szorc
5ce1624c85 Bug 1392886 - Determine if sparse checkout is being used; r=mshal
The Repository interface gains a new method to determine if a sparse
checkout is present. Mercurial's implementation is somewhat crude,
but it should work (Mercurial's sparse support is still experimental
and I only intend to support sparse checkout in Firefox CI until it
is less experimental). Git's always returns False (for now).

To prove it works and to expose the information more widely, we hook
it up to moz.configure. We do this by first implementing a function
that returns a Repository instance. Then we simply call a function on
it to resolve the sparse checkout flag.

MozReview-Commit-ID: AlsT5LdSPdZ

--HG--
extra : rebase_source : f1e9aaa7d15f11c7c5e8d268d4ad82468732103b
2017-08-22 20:26:46 -07:00
Gregory Szorc
ad141eef1b Bug 1392886 - Expose repository type as an instance property; r=mshal
This will remove the need to sniff class types. The 1 in-tree
consumer doing this has been converted.

MozReview-Commit-ID: I8cUa8J54VE

--HG--
extra : rebase_source : 4c24adaf7eb9d62678ac78604e819a7376d4073b
2017-08-22 20:04:55 -07:00
Gregory Szorc
f9bdc9486a Bug 1392886 - Use abstract base class for Repository; r=mshal
This makes the interface more formalized.

MozReview-Commit-ID: JOjgJjR5MZk

--HG--
extra : rebase_source : 20d015dbd6861ea0738828cf6da89723e2afb4e8
2017-08-23 08:33:56 -07:00
Mike Shal
a4e932605b Bug 1392304 - fix typo in mozversioncontrol for git; r=gps
MozReview-Commit-ID: 1r1Vl5WVhsd

--HG--
extra : rebase_source : 4d16b8133d11592911b5e8529e6a5259dce41f03
2017-08-18 21:06:08 -04:00