Summary:
dirstate.drop() is used in two different situations. 1. To make a
tracked file become untracked, and 2. To remove a file from the dirstate
entirely. In the treestate case, this difference matters, so let's split drop
into two functions, one to mark something as untracked, and the other to remove
it entirely.
In this first patch we just rename drop to untrack. The next patch will
introduce the new delete function.
Reviewed By: ikostia
Differential Revision: D10317738
fbshipit-source-id: 85950ab1b1a10cd481edcfbba6da445b3dbf6397
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
Summary:
Update most locations in the hg extensions to use `repo.localvfs` instead of
`repo.vfs`.
Reviewed By: quark-zju
Differential Revision: D9699153
fbshipit-source-id: 48d5f9678caa4961063db30477d6fbe0d6f34347
Summary: This step could take a long time. Therefore add a progress bar.
Reviewed By: DurhamG
Differential Revision: D9375200
fbshipit-source-id: f7eb3d3bb750b873df90eb950098a743e24c6440
Summary:
While investigating T30931730, I wondered why Eden importer needs to access
dirstate. Turned out the sparse extension would construct it in `reposetup`.
Changing that to a cheaper test - `repo.local()` to avoid loading dirstate.
A local repo always has a dirstate.
Reviewed By: simpkins
Differential Revision: D8669930
fbshipit-source-id: b738f7d888fe8ad62c9a29bd910230f62278a7af
Summary: When wrapping the repo object, use local variable if possible.
Reviewed By: chadaustin
Differential Revision: D8676284
fbshipit-source-id: d35d9b7b9357a8e16d4eb10032911ecbdc34b907
Summary:
Some folks might attempt to load this extension despite it
not being useful with eden. The extension knows not to hook in to
the repo when eden is in used, but the various commands to manipulate
the sparse config do not.
This diff adds a little helper function to show a more reasonable
error message than an ugly stack trace when attempting to use them.
Reviewed By: simpkins
Differential Revision: D8328229
fbshipit-source-id: d7cc4c7047b11f8da96e26ab70bd522b52546151
Summary: Mostly empty lines removed and added. A few bugfixes on excessive line splitting.
Reviewed By: quark-zju
Differential Revision: D8199128
fbshipit-source-id: 90c1616061bfd7cfbba0b75f03f89683340374d5
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
Summary: This lets you find profiles that'll include a given filename.
Reviewed By: markbt
Differential Revision: D7876496
fbshipit-source-id: 3b375e5d8257a80853f854a6be27c74f805687e3
Summary:
Replace the monkey-patched subcommands in fbsparse with the new subcommand
infra.
Reviewed By: mjpieters
Differential Revision: D7849195
fbshipit-source-id: 7f1fc21f555dc2bea49d3a80efdbfd42a6e70cb5
Summary:
Add generalised support for subcommands. This is similar to the monkey-patched
version in `fbsparse`, but fully supported by the command infrastructure.
Subcommands are the same structure as normal commands, but are attached to a
table in the `subcommands` attribute of the main command. Normally, if no
subcommand is provided, the normal command function is called. This can be
made into an error by setting `subonly` on the top-level command.
In order to make `fbsparse` continue to work, I've temporarily hacked how it
handles help text. This will be fixed in a later diff that switches fbsparse
to use this infrastructure.
Reviewed By: mjpieters
Differential Revision: D7849476
fbshipit-source-id: b988edabb17da77bf91a278e0faa2feecd0c1db9
Summary:
The logic was added by D2594568 and is intentional for "repairing" dirstate.
It's O(working copy). That makes absorb super slow. Therefore let's use the
new "exact" flag to skip the slow path.
Reviewed By: mitrandir77
Differential Revision: D7818728
fbshipit-source-id: a3a7d6074bd0240b9e1919e18d3e0b95daf74a64
Summary: This is a hint for performing certain fast paths.
Reviewed By: mitrandir77
Differential Revision: D7818730
fbshipit-source-id: 4adcf8724b462d8d652e8e580d6a36eebc46a0f8
Summary:
There is a proper way [1] to skip the dict check-code check. Let's use it.
[1]: a61ed1c2d7
Reviewed By: DurhamG
Differential Revision: D7831336
fbshipit-source-id: a5e654e9e94cbfb1c5a07b047eb6e5451904c48e
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