Summary: This lets you select on substrings in fields and paths.
Reviewed By: quark-zju
Differential Revision: D7788826
fbshipit-source-id: f92b8cc646fd36f4cb3b8a4dc6116576db80eb42
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
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
Summary:
check-seclevel.py complains about using section markers inside a container.
The help text about sparse file format and config options can be put at
extension-level.
Reviewed By: mjpieters
Differential Revision: D7776355
fbshipit-source-id: 0b7d813c5eee352a054b21897682f6064f384829
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
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
Summary:
Update `fbsparse.reposetup()` to avoid attempting to wrap the localrepo object
in Eden repositories. The fbsparse extension is normally disabled in Eden
repositories, but this ensures the code does the correct thing even if the
fbsparse extension has been explicitly loaded.
Reviewed By: ryanmce
Differential Revision: D7642679
fbshipit-source-id: d0a229091d794fb326ab1db1c01e5a0a271092c4
Summary:
Update the sparse command to fail early if the repository in question is not a
sparse repository.
Reviewed By: ryanmce
Differential Revision: D7642680
fbshipit-source-id: eaf765d38b45acf17d7c755f95083371f43f7259
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
Summary: Tweak the help output to reflect the now-complete subcommand information.
Differential Revision: D7667900
fbshipit-source-id: a5a04e8bcbfe4a90266c30e25ffd705de0bdc8a9
Summary: The attribute is called 'hex', not 'hash'. Oops.
Reviewed By: markbt
Differential Revision: D7600689
fbshipit-source-id: 027031000e6481f353ceaad79c7dc2c46a16a3cf
Summary: These matchers provide better values than the default now provided by mercurial.match.basematcher.
Reviewed By: quark-zju
Differential Revision: D7635868
fbshipit-source-id: c826390b3a5e3a2da897eeb54be22850e14403f6
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
Summary: A followup diff will add more in the way of testing; this is easier with an actual usecase.
Reviewed By: quark-zju
Differential Revision: D7553020
fbshipit-source-id: a6e8b86154d802f8cdbc846f5ea14fa809ac5264
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
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
Summary:
`len()` on a hybrid manifest wrapping a treemanifest would raise an attribute error. But if there is no treemanifest or there is *only* a treemanifest, then a TypeError is raised. Using `len()` on an object that doesn't support length should always raise `TypeError`, consistently.
Instead of looking up the `__len__` attribute, use the built-in `len()` function, which will raise `TypeError` if the wrapped manifest in a hybrid doesn't have a `__len__` method. This ensures that we get a consistent exception.
Reviewed By: farnz
Differential Revision: D7485510
fbshipit-source-id: 4132d6b383171cde8dd99dd60098716d4aedc527
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
Summary:
The hg sparse help page was overwhelming, and out of date. With subcommands, we
can break up the information a bit more.
* Subcommand help is the place for details on that command. Reduce the main
help info to an overview.
* Move configuration switches to a `verbose` container to hide it by default.
* Add documentation on the sparse profile format.
* Mark the command-line switches with subcommands as deprecated so they are
hidden by default.
Reviewed By: quark-zju
Differential Revision: D7432862
fbshipit-source-id: ffddd27e0ee4216f7e743e63e8efaed4eeaac582
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
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
Summary:
This gives us access to the specifics of a subcommand, including switches
(still stubbed out). Note: `hg sparse <subcommand> -h` doesn't work yet, as the
`-h` command line switch would need intercepting as well.
Reviewed By: quark-zju
Differential Revision: D7413859
fbshipit-source-id: 02534f1255a11985ebe8636b26946fbeffc6fe09
Summary:
When updating a working copy that is limited by a sparse profile, do not abort on case collisions outside of the current working copy view.
Performance-wise, this isn't a big change; previously `_checkcollision()` would convert the whole manifest to a set, now we filter first with the matcher, then convert the remainder to a set. Either the original set conversion or the filtering can take O(size-of-manifest) time.
Reviewed By: ryanmce
Differential Revision: D7350251
fbshipit-source-id: efb8e270631f0aaa75c34c7b68189c60efe45984
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
Summary: Now all commands can be subcommands. The command-line switches will be hidden in a next commit (but remain available for backwards compatibility).
Reviewed By: ryanmce
Differential Revision: D7365393
fbshipit-source-id: 29b8ed2ac6bffccda41ed3f738087dde23312a8c
Summary:
This means we can
- count on the minirst module to format longer lines correctly,
- show subcommands when an error occurs (so full is false),
- add verbose help when the -v switch
Reviewed By: ryanmce
Differential Revision: D7365392
fbshipit-source-id: c8711bd19a6d992ad86f24f3c07b381f69d02121
Summary:
We take help info from the docstring but that'd disallow multiple registrations for a single function that can handle multiple subcommands. Refactor to let the decorator set an override.
So before you'd do this:
```
subcmd('foo')
def _foocmd(...):
"Help for foo command"
# implementation for foo
subcmd('bar')
def _barcmd(...):
"Help for bar command"
# implementation for bar
```
but you could not *combine* the implementations into one function and decorate both, because there is only the single docstring.
Now you can do:
```
subcmd('foo', help="Help for foo command")
subcmd('bar', help="Help for bar command")
def _fooandbarcmd(cmd, ...):
"This docstring is no longer used"
# implementation for foo and bar, combined, switching on the value of cmd
```
Reviewed By: ryanmce
Differential Revision: D7365390
fbshipit-source-id: 3d41542f1f197137ef13458e8d850cda8f53da74
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
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
Summary:
On a large repo, this can take seconds. Let the user see progress
during this time.
Differential Revision: D7211460
fbshipit-source-id: bfa9ad658a1c190399f9e33de7ddfbe006d6cbfb
Summary:
During testing, I discovered that a ctrl-c while `hg sparse --refresh`
was waitign on the wlock would cause a traceback. This fixes that.
Differential Revision: D7211459
fbshipit-source-id: dde006208f688cc7e2509e822443dececd59c08d
Summary: Put titles, if present, into a second 'column' in the plain output.
Differential Revision: D7258046
fbshipit-source-id: dedbb04ecbf0b2262c4c507683262e4b7bef8d70
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
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
Summary:
- Include line numbers for error messages
- Handle sections via a mapping, for ease of extending
- Use identity to test for the excludes section, because even if the contents
matched we'd want this to be an error.
Reviewed By: quark-zju
Differential Revision: D7239581
fbshipit-source-id: 36cf79102ed01758b809009bcbe470714ddd27e4
Summary: This makes it easier to add metadata later on, and code that needs only a single entry becomes cleaner.
Reviewed By: quark-zju
Differential Revision: D7239580
fbshipit-source-id: 8900b4fd4883e68ac599396e4a80063d11bbf07c
Summary:
attrs is more flexible than a namedtuple, and we don't need indices on these objects.
The object is still immutable and has a low memory profile, but now we can trivially validate values. It's easier to extend the class now to add metadata.
Reviewed By: quark-zju
Differential Revision: D7239584
fbshipit-source-id: cbd0b38c54f08ed19d5a7e05811356e4694d7d19
Summary:
Sparse profile files are INI files, and semicolons are the traditional comment line starter.
There are already profiles that use the semicolon as a comment, see diffusion/FBS/browse/master/tools/scm/sparse/fbobjc/sandcastle and diffusion/FBS/browse/master/tools/scm/sparse/fbandroid/sandcastle
Reviewed By: farnz
Differential Revision: D7181613
fbshipit-source-id: a42171f6bd6213147c6363f8f359f885af38b8af
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
Summary:
The current code iterates over all files in the manifest, filtering against a prefix.
But a manifest supports using a matcher directly, and efficient implementations like the treemanifest will prune the tree to a much smaller subset rapidly based on the path in a matcher. Switching to using a matcher dramatically improves --cwd-list performance in fbsource, when treemanifests are available.
Reviewed By: quark-zju
Differential Revision: D7056650
fbshipit-source-id: 2bf62ea93680323a49c9282266118805881d7b02
Summary:
There is no need to strip path separators from the normalised path; normpath
will never leave any.
We also ensure that the path prefix we test ends in a path separator, to avoid
matching on sibling paths that happen to share a prefix.
Reviewed By: ryanmce
Differential Revision: D7056649
fbshipit-source-id: 10b78a78ba44fbc8d9c05fb7ffd0ffd1c1496a67
Summary: Adds output to hg sparse --refresh for long running calculations, --verbose adds more notes on progress.
Reviewed By: ryanmce
Differential Revision: D6886545
fbshipit-source-id: 9fe176724bec0cb56bc8da4939f42a6e7745cf41
There's no need to do this and not doing so speeds up IMM tremendously when the sparse profile had to be adjusted.
(This is the grafted version from the fb-hgext repo)
Test Plan:
I ran an IMM before and after this change. Both succeeded but the later version was
much faster.
Differential Revision: https://phab.mercurial-scm.org/D1805
Summary:
These fixes are related to documentation-related check-style tests.
Depends on D6675344
Test Plan: - more tests pass
Reviewers: #sourcecontrol
Differential Revision: https://phabricator.intern.facebook.com/D6675351
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