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

36 Коммитов

Автор SHA1 Сообщение Дата
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
Gregory Szorc e4480eabc7 Bug 1377216 - Use configure-derived VCS info to find repository; r=glandium
For reasons I can't explain, Windows builds are failing intermittently
because they are unable to locate the `hg` binary when running
some SpiderMonkey test processes. These processes use
mozversioncontrol.get_repository_from_env() to locate the
current repository.

We now store VCS info in configure. This makes it available to anything
running in a build system context.

This commit teaches mozversioncontrol.get_repository_from_env()
to import the "buildconfig" module to locate VCS info. If the module
can be imported, it is the sole source of VCS info. Otherwise, we
fall back to the existing detection mechanisms.

This should get rid of the intermittent failure. If it doesn't,
it is still a step in the right direction because it will allow
build system processes to consistently use a well-defined VCS
binary.

MozReview-Commit-ID: DMxXheJLRqH

--HG--
extra : rebase_source : a9c599934c8c08da1fbb92a9105f5c7cba0867b3
2017-07-18 15:46:47 -07:00
Ryan VanderMeulen 741a7a5ea3 Backed out 6 changesets (bug 1377216) for SM(pkg) bustage on a CLOSED TREE.
Backed out changeset b5701f3ce506 (bug 1377216)
Backed out changeset 1f37aebe0f43 (bug 1377216)
Backed out changeset c8931588f674 (bug 1377216)
Backed out changeset ded5328ba74c (bug 1377216)
Backed out changeset 6cb234539746 (bug 1377216)
Backed out changeset ce836965fd58 (bug 1377216)
2017-07-19 22:14:03 -04:00
Gregory Szorc 2e6b49383d Bug 1377216 - Use configure-derived VCS info to find repository; r=glandium
For reasons I can't explain, Windows builds are failing intermittently
because they are unable to locate the `hg` binary when running
some SpiderMonkey test processes. These processes use
mozversioncontrol.get_repository_from_env() to locate the
current repository.

We now store VCS info in configure. This makes it available to anything
running in a build system context.

This commit teaches mozversioncontrol.get_repository_from_env()
to import the "buildconfig" module to locate VCS info. If the module
can be imported, it is the sole source of VCS info. Otherwise, we
fall back to the existing detection mechanisms.

This should get rid of the intermittent failure. If it doesn't,
it is still a step in the right direction because it will allow
build system processes to consistently use a well-defined VCS
binary.

MozReview-Commit-ID: DMxXheJLRqH

--HG--
extra : rebase_source : a9c599934c8c08da1fbb92a9105f5c7cba0867b3
2017-07-18 15:46:47 -07:00
Ted Mielczarek a1155285c8 bug 1367329 - fix error handling code in mozversioncontrol. r=gps
MozReview-Commit-ID: Bu5FA9PhxJY

--HG--
extra : rebase_source : 4aa19c087cd4f9e03f2fd385e0d0052cca9bc954
2017-06-22 12:54:25 -04:00
Gregory Szorc 2b1957d1e5 Bug 1361172 - Rewrite code for finding files in VCS checkout; r=glandium
We're getting an intermittent failure running `hg manifest` in CI. I
have no clue why.

What I do know is that we now have the mozversioncontrol Python package
for containing utility code for interacting with version control. It is
slightly more robust and I'm willing to support it more than I am
check_utils.py.

This commit adds a new API to our abstract repository class to obtain the
files in the working directory by querying version control.

Since I suspect cwd was coming into play in automation, I've also
added a utility function to mozversioncontrol to attempt to find
a version control checkout from the current working directory. It
simply traces ancestor paths looking for a .hg or .git directory.

Finally, I've ported all callers of the now-deleted API to the new
one. The old code had some "../.." paths in it, meaning it only
worked when cwd was just right. Since we resolve the absolute path
to the checkout and store it on the repo object, I've updated the
code so it should work no matter what cwd is as long as a repo can
be found. I'm not 100% confident I found all consumers assuming cwd.
But it's a start.

I'm not 100% confident this will fix the intermittent issues in CI. But
at least we should get a better error message and at least we'll be
running less hacky code.

MozReview-Commit-ID: AmCraHXcTEX

--HG--
extra : rebase_source : 815ae369776577ad374333920fd645d412a55148
2017-05-18 16:06:49 -07:00
Nathan Froyd f466efaa92 Bug 1306078 - part 2 - add Repository.get_added_files; r=ted.mielczarek
Figuring out the files that have been added is also something that you
want to do with a source code repository.
2017-02-14 16:12:19 -05:00
Nathan Froyd 7e71a9a29e Bug 1306078 - part 1 - add forget_add_remove_files to mozversioncontrol Repository objects; r=gps
This command is useful for users who wish to perform something like the
following:

1. Add/remove a bunch of files;
2. Examine the additions/removals/modifications for interesting changes;
3. Reject the add/remove if it doesn't meet some set of conditions.
2017-02-14 16:12:19 -05:00
Nathan Froyd deb4dfaf07 Bug 1334556 - make GitRepository.get_modified_files slightly more idiomatic; r=gps
Having to munge the output of `git status --porcelain` is unseemly when
there are approaches that will give us what we want directly.
2017-01-27 13:51:58 -05:00
Kartikaya Gupta ab17b42149 Bug 1313446 - Detect a git repository when inside a git worktree. r=glandium
MozReview-Commit-ID: 8ngY6kNcp05
2016-12-08 08:28:36 -10:00
Ted Mielczarek 93587924f6 bug 1294565 - add some more helpers to mozversioncontrol, add MozbuildObject.repository. r=gps
I wanted to be able to do some VCS interaction from a mach command, and we
didn't have anything suitable, so I tore up mozversioncontrol and replaced
it with a framework to hang new features off of. I've only implemented
the bits I need currently (get_modified_files and add_remove_files),
but it should be straightforward to add more functionality there.

This patch also adds a `repository` property to `MozbuildObject`, which will
return a `Repository` object for the topsrcdir to make using these helpers
even easier for `MozbuildObject`-derived classes.

MozReview-Commit-ID: Gw6Ixp1ltiN

--HG--
extra : rebase_source : e619d6642eb86c3f96e679ac22a3e561dfdbb56a
2016-09-29 06:48:37 -04:00
Gregory Szorc ee27b8ebce Bug 1225599 - Pull Mercurial repos with common 3rd party extensions disabled; r=dminor
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.

--HG--
extra : rebase_source : 92e7d8fe227f29fc64c0f69021bd731ba762faf3
2015-12-15 10:47:33 -08:00
Birunthan Mohanathas bc29413b87 Bug 1197527 - Consolidate obtaining hg path into mozversioncontrol.get_hg_path; r=gps
DONTBUILD

--HG--
extra : commitid : LsREOYJSAa7
extra : amend_source : 6f19087188d9c6c009a817c3499c7fd9165bfc6a
extra : histedit_source : 36aa6d1a3e78367d50a3e65ac6f61872b7a635d4
2015-08-24 14:37:42 -04:00
Gregory Szorc 243db8e774 Bug 1128586 - Properly look for Mercurial version; r=RyanVM
`mercurial version` doesn't always print the version number. `mercurial
--version` does. Use the latter.

--HG--
extra : rebase_source : 6f3c305ce8b38599a60c01d9cee410b724bfc37f
extra : amend_source : 430a3cf66094a62fabee59dbf4a486d4392a8c47
2015-04-27 10:43:25 -07:00
Andrew Halberstadt dcafcc6e89 Bug 1092149 - Use LooseVersion instead of StrictVersion in |mach mercurial-setup| so release candidates work, r=gps 2014-10-31 15:09:39 -04:00
Gregory Szorc c5c6819b0f Bug 1033656 - Add reviewboard to mach mercurial-setup; version checking; r=smacleod
We want to make it turnkey for people to use reviewboard. So, we add
reviewboard and related functionality to |mach mercurial-setup|.

Since the reviewboard extension only works in Mercurial 3.0 and newer,
we add some version detection for the Mercurial version. This should
have been done months ago. We now have it.

I also took the opportunity to inform |mach bootstrap| that Mercurial
2.x is no longer modern.

I also updated the messaging around mq to encourage fewer new users to
use it. You may find this controversial. People can always ignore the
message.

Finally, I also added a histedit prompt to the mix, since a lot of
people don't know about that and many find it useful.

I could have broken this into multiple patches. Meh.

--HG--
extra : rebase_source : d33f8abcabb6ad6511c2f9e202283d43613fafc4
extra : amend_source : 3a56bc4d49ee6200cbdd0e87b4f28489518fee79
2014-07-02 14:05:42 -07:00
Gregory Szorc f3d929fdf3 Bug 941833 - mach mercurial-setup should define host fingerprints during repo operations; r=nalexander
DONTBUILD (NPOTB)

--HG--
extra : rebase_source : 64bfe02d9f27009ab896b09c54fe7e48953a280d
2013-11-21 12:19:32 -08:00
Gregory Szorc c079fd38e7 Bug 794580 - mach mercurial-setup; r=nalexander
DONTBUILD (NPOTB)

--HG--
extra : rebase_source : b5cfc81d1a0537b5ae25a76c3ccc604383f60f6c
2013-07-29 16:58:40 -07:00