Commit Graph

25 Commits

Author SHA1 Message Date
Mark Thomas
06a462bb89 fbsparse: add switchprofile command
Summary:
Add the `sparse switchprofile` command, which lets users specify a set of
sparse profiles they would like to switch to.  This is equivalent to `hg sparse
reset` followed by `hg sparse enableprofile`, but in a single step.

Reviewed By: farnz

Differential Revision: D10141938

fbshipit-source-id: 5a1e547d21e3246237fffb17f3b512da18fac804
2018-10-02 03:35:49 -07:00
Martijn Pieters
59b960eade sparse: filter on file containment
Summary: This lets you find profiles that'll include a given filename.

Reviewed By: markbt

Differential Revision: D7876496

fbshipit-source-id: 3b375e5d8257a80853f854a6be27c74f805687e3
2018-05-04 07:31:06 -07:00
Martijn Pieters
a9f4167218 sparse: add filtering on field contents
Summary: This lets you select on substrings in fields and paths.

Reviewed By: quark-zju

Differential Revision: D7788826

fbshipit-source-id: f92b8cc646fd36f4cb3b8a4dc6116576db80eb42
2018-04-30 14:16:44 -07:00
Martijn Pieters
796523487a sparse: add a hint about using --verbose on hg sparse list
Summary: Calculation on how many profiles were hidden is only done when the hint is actually shown.

Reviewed By: quark-zju

Differential Revision: D7774192

fbshipit-source-id: a7196b2cc5640d0a7cb9c4d572e1a31ebfa41598
2018-04-30 14:16:44 -07:00
Martijn Pieters
2c10ce3145 sparse: add filtering options for fields present or missing
Summary:
This lets us produce a list of profiles with the title set, or find all profiles that are missing a description.

Convert the 'hidden' filter to use this feature, rather than special-case it in `_discover()`.

Reviewed By: quark-zju

Differential Revision: D7774029

fbshipit-source-id: 3bcba75e6da97bf0e560e11ce1ae7cbcee49ee45
2018-04-30 14:16:44 -07:00
Martijn Pieters
ed857415c5 sparse: allow listing of profiles at a different revision
Summary: This is needed to be able to list profiles via SCMQuery, where there is a working copy at the null revision.

Reviewed By: quark-zju

Differential Revision: D7745434

fbshipit-source-id: b5ac236c36f9bafc9e0f305bc0892e0cd8bec628
2018-04-25 08:50:27 -07:00
Martijn Pieters
51dae5969e sparse: ignore non-existing profiles when listing
Summary: If there is a non-existing sparse profile active in .hg/sparse, skip it rather than bail out.

Reviewed By: quark-zju

Differential Revision: D7744957

fbshipit-source-id: 4e6a046c95f5fe6cf49a7093d3443340f70e8e2a
2018-04-24 10:21:22 -07:00
Martijn Pieters
f07e9c14b6 fbsparse: add hint to sparse explain about the verbose flag
Summary:
```
$ hg sparse explain some/profile
[...]
hint[sparse-explain-verbose]: use 'hg sparse explain --verbose some/profile' to include the total file size for a give profile
hint[hint-ack]: use 'hg hint --ack sparse-explain-verbose' to silence these hints
```

Differential Revision: D7669896

fbshipit-source-id: c700fbc2f42044a9b15371278305f03e9e6c989f
2018-04-18 10:38:35 -07:00
Martijn Pieters
0b9356d3f2 sparse: update all subcommands with proper arguments / synopsis info
Summary: Tweak the help output to reflect the now-complete subcommand information.

Differential Revision: D7667900

fbshipit-source-id: a5a04e8bcbfe4a90266c30e25ffd705de0bdc8a9
2018-04-18 10:38:35 -07:00
Martijn Pieters
3f7758625a sparse: Add support for specifying a revision to sparse explain
Summary: We need this to support producing sparse profile stats in a null-revision working copy.

Reviewed By: quark-zju

Differential Revision: D7553022

fbshipit-source-id: b1643f443de5a748bf81ff2df16ace984d59a2c2
2018-04-13 21:51:50 -07:00
Martijn Pieters
440232e553 sparse: fix the accidental recursive handling of profiles
Summary:
hg sparse explain wasn't supposed to recurse, not without additional support.

It was the process of gathering stats that overwrote shared mutable structures.
Prevent this from happening again by making these structures immutable.

Differential Revision: D7516570

fbshipit-source-id: 247c60b4bd8d2d22b42c41871e1eb15988820025
2018-04-13 21:51:50 -07:00
Martijn Pieters
62ec76397b sparse: fix broken signature calculation for sparse profiles
Summary:
We were ignoring the actual profile data, and all profiles were given the same .hg/sparse-based hash signature instead.

Error introduced in D7415720

Differential Revision: D7514087

fbshipit-source-id: 56288aaaa2065b031318e7c065ec6310f6cecd37
2018-04-13 21:51:50 -07:00
Martijn Pieters
bf9eb9018e sparse: add the option to hide certain profiles
Summary:
Some profiles are not for general consumption; they are usually profiles aimed at CI subsystems or similar. These can be hidden from listings by default using a `hidden` key.

The value of the key doesn't matter but can be used to explain why it is hidden.

Reviewed By: quark-zju

Differential Revision: D7433781

fbshipit-source-id: 877cd8698d50dc64cec8da706ab005e1fd786de4
2018-04-13 21:51:39 -07:00
Martijn Pieters
a4952f4bfa sparse: add a hg sparse files command
Summary: This command mostly echoes how `hg files` works, albeit simplified somewhat. Given a profile and optional patterns, the files that profile matches are listed.

Reviewed By: quark-zju

Differential Revision: D7431522

fbshipit-source-id: 8e9d1f0d2aa31335f53269f3005875a0cc2e65bf
2018-04-13 21:51:38 -07:00
Martijn Pieters
4c93c15316 sparse: include sparse profile impact
Summary:
Show the 'impact' of a profile, relative to a non-sparse working copy.

By default, this is the percentage of the total file count; adding --verbose will show the file sizes too.

The defined matchers have been refactored to reuse more of mercurial.match.basematcher, making it easier to reuse these in a wider mercurial context and avoiding repetition of common methods.

Reviewed By: quark-zju

Differential Revision: D7415720

fbshipit-source-id: 4ac3492c61aa70ee71d4bdf8c201b905a345a9d1
2018-04-13 21:51:38 -07:00
Martijn Pieters
6414c84571 sparse: show individual profile details
Summary: This shows basic details about a template, including base metadata. Once we have support for per-subcommand switches we can add further filtering.

Reviewed By: ryanmce

Differential Revision: D7365794

fbshipit-source-id: 3dd362f099e7f4d6db73c9bda7c24a9f4f2f90ee
2018-04-13 21:51:37 -07:00
Martijn Pieters
85eb89e007 sparse: make listing profiles a subcommand
Summary:
This is based on the hg show implementation. hg sparse --list-profiles is not yet widely known, so now is the time to move it to a subcommand.

This is the first step in untangling the mess that is the `hg sparse` forest of options.

Currently, all switches on the command are mutually exclusive, except for `—force` and `—template`, which each only apply to a subset of the actions the other switches affect.

Subcommands are the right pattern for mutually-exclusive actions that can accept their own individual switches.

Reviewed By: quark-zju

Differential Revision: D7350928

fbshipit-source-id: d03014cf7edd2f089f670d11465c70940d96c070
2018-04-13 21:51:35 -07:00
Martijn Pieters
36a3e5b595 sparse: use -l as the short option for --list-profiles
Summary: There's a precedent for `-l` for listing: `hg shelve -l`, `hg undo -l`, `hg resolve -l`.

Reviewed By: ryanmce

Differential Revision: D7337527

fbshipit-source-id: 3d9c340590e9756e39cad3bfdd0b017f45fd3a6e
2018-04-13 21:51:31 -07:00
Martijn Pieters
efd45069e3 sparse: use relglob to exclude readme files
Summary: Although the old glob *should* work, in practice the treemanifest matcher seems to have issues with glob:**/ paths, where relglob: works.

Reviewed By: ryanmce

Differential Revision: D7287992

fbshipit-source-id: d3802e730d937eeca7059dac691d8dac5a5de262
2018-04-13 21:51:31 -07:00
Martijn Pieters
37547cff41 sparse: list profile titles
Summary: Put titles, if present, into a second 'column' in the plain output.

Differential Revision: D7258046

fbshipit-source-id: dedbb04ecbf0b2262c4c507683262e4b7bef8d70
2018-04-13 21:51:28 -07:00
Martijn Pieters
a8786716bf sparse: load metadata from profiles
Summary:
Profiles can now have a [metadata] section, with key-value pairs defining some metadata to be associated with the profile.

This supports multiline entries by starting a continuation line with some whitespace:

```
[metadata]
title = Some cool title
description = A longer description
 will be joined with newlines
 provided you start with a space
 or a tab.
```

Differential Revision: D7257628

fbshipit-source-id: d6b09161d54cb6824f691d07caee83d0f8bd0a84
2018-04-13 21:51:28 -07:00
Martijn Pieters
8bb4e6a0ec sparse: include a filename when reporting sparse profile parsing issues
Summary: We regularly parse multiple profiles, through includes or when discovering. Be clear what profile file caused the issue.

Differential Revision: D7257636

fbshipit-source-id: 1203c13f6c6a4e4d1397ace818aee21b9db38550
2018-04-13 21:51:28 -07:00
Martijn Pieters
15383f0bd3 sparse: use manifest matcher when discovering profiles
Summary:
This echos the change in D7056650; there is no need to special-case
treemanifests here; delegation to the manifest .match method allows the
manifest to apply optimisations when available.

Differential Revision: D7100363

fbshipit-source-id: 66a35850a132f804efb407712d2e4db737c10cff
2018-04-13 21:51:22 -07:00
Kostia Balytskyi
b27a46c987 fb-hgext: fix copied fb-hgext tests
Summary:
This is a big bulk of generally almost-obvious fixes to the moved tests. Mostly
these fixes have to do with correct importing of the actual extensions.

Depends on D6675329

Test Plan:
- ./run-tests.py fails less after this commit
- see further commits for more test fixes

Reviewers: #sourcecontrol

Differential Revision: https://phabricator.intern.facebook.com/D6675344
2018-01-09 03:06:09 -08:00
Kostia Balytskyi
e75b9fc1b1 fb-hgext: move most of hgext3rd and related tests to core
Summary:
This commit moves most of the stuff in hgext3rd and related tests to
hg-crew/hgext and hg-crew/test respectively.

The things that are not moved are the ones which require some more complex
imports.


Depends on D6675309

Test Plan: - tests are failing at this commit, fixes are in the following commits

Reviewers: #sourcecontrol

Differential Revision: https://phabricator.intern.facebook.com/D6675329
2018-01-09 03:03:59 -08:00