Summary:
The hgwatchman extension relies on being able to compute a hash for the ignore
matcher. Let's add hash functions to all our matcher wrappers. Once the
upstream code freeze is over we'll move some of this up into mercurial core.
Test Plan: This gets exercised by a test in a future patch
Reviewers: rmcelroy, mitrandir, lcharignon, ericsumner, sid0
Reviewed By: sid0
Differential Revision: https://phabricator.fb.com/D2022211
Signature: t1:2022211:1429912406:0be0dc280c8b3f465006eb79fb596c0c9b833342
Summary:
Previously we replaced dirstate.ignore with a function that acted like a
matcher. It turns out that the hgwatchman extension relies on dirstate.ignore
being a matcher for computing hashes.
This changes our wrapping to use a matcher instead. In a future patch we'll add
a hash function to allow hgwatchman to continue to work.
Test Plan: This gets exercised by a test in a later diff.
Reviewers: rmcelroy, mitrandir, lcharignon, ericsumner, sid0
Reviewed By: sid0
Differential Revision: https://phabricator.fb.com/D2022208
Signature: t1:2022208:1429912354:588071e4930c81b36789bc84e9e00de788eaeda7
Summary:
There was a bug where if you included 'dir1/dir2/' in your sparse checkout, then
status would not show newly added files in that directory. The problem is that
dir1 is considered ignored, so the status walker would not walk down dir1.
The fix is to explicitly match subdirectories of specified include patterns.
Test Plan: Added a test
Reviewers: pyd, rmcelroy, lcharignon, sid0
Reviewed By: sid0
Differential Revision: https://phabricator.fb.com/D2021037
Tasks: 6773875
Signature: t1:2021037:1429899282:3e305afa9ed395473dbe11d80abc43becb9eaa4a
Summary:
Adds a --sparse option to log that limits the output to commits that
affect the working copy.
Test Plan: Added a test.
Reviewers: sid0, lcharignon, pyd, ericsumner, rmcelroy
Reviewed By: rmcelroy
Differential Revision: https://phabricator.fb.com/D2002484
Signature: t1:2002484:1429299577:a66f88157acc7136be9fe3b60f7fb02f830ae447
Summary:
Now that we store a list of temporarily include files, and the ability to
clean them up, we now add the logic to add them in the first place. This watches
the actions provided by calculateupdates and adds any missing files to the
sparse checkout temporarily
Mucking with the dirstate and files on disk in the middle of calculateupdates
seems a little risky, but it seems to work.
Test Plan: Added new tests that require bringing in non-sparse changes as part of the merge. Tests both the merge and rebase scenarios, using both normal checkouts and profiles.
Reviewers: sid0, pyd, lcharignon, rmcelroy
Reviewed By: rmcelroy
Differential Revision: https://phabricator.fb.com/D1982951
Signature: t1:1982951:1428636508:e5bcf4e6fbd635d49ff1ce7a90e9b5e1378537c9
Summary:
If a commit or update happens, check if the working copy is clean, and if it is,
delete all the temporarily included files. This calls hg status, which may have
perf implications, but since we're dealing with sparse checkouts, hopefully it
won't be too bad for now.
Test Plan: Ran the tests
Reviewers: sid0, pyd, lcharignon, rmcelroy
Reviewed By: rmcelroy
Differential Revision: https://phabricator.fb.com/D1982949
Signature: t1:1982949:1428635990:29ddacdf3f32a38ce0e725ed9db7e13e98e0f21e
Summary:
Now that we store a list of temporary included files, add them to the sparse
matcher using our new forceincludematcher.
Test Plan: Ran the tests
Reviewers: sid0, pyd, lcharignon, rmcelroy
Reviewed By: rmcelroy
Differential Revision: https://phabricator.fb.com/D1982948
Signature: t1:1982948:1428635825:b8d2dcd94df5d75946b96cf2ac1ad29691d54066
Summary:
The tempsparse file can now be used to contain a list of files that should be
temporarily included in the sparse checkout. This is useful for bringing in
merge conflicts to be dealt with.
Future patches will populate and prune the set of temporary includes.
Test Plan: Ran the tests
Reviewers: sid0, pyd, lcharignon, rmcelroy
Reviewed By: rmcelroy
Differential Revision: https://phabricator.fb.com/D1982947
Signature: t1:1982947:1428635211:e92ed0b48aed55217dac1b864214f924dc672828
Summary:
Previously I just returned a function as the matcher in certain cases. This
failed in a bunch of places because Mercurial expects the matcher to have
functions on it like isexact() and always(). Let's switch to a matcher class
that does the same thing.
Also add a new matcher that will be used to force certain files to always return
true. This will be useful for temporarily adding certain files to the working
copy during a merge.
We may want to send these kinds of things upstream once they're more robust.
Test Plan: Ran the tests
Reviewers: sid0, pyd, lcharignon, rmcelroy
Reviewed By: rmcelroy
Differential Revision: https://phabricator.fb.com/D1982945
Signature: t1:1982945:1428634767:613984f99be8bdc05f82bae11cf4ee28d5922ac1
Summary:
As part of a larger refactor, I did some minor fix ups. In one case I change the
default value from [] to set(), because the non-default values are set()
already, so this makes it more consistent.
In the other case I just moved something into a better scope for readability
since I'll be adding a very similar piece of code later.
Test Plan: Ran the tests (though this code path is unused right now)
Reviewers: sid0, pyd, lcharignon, rmcelroy
Reviewed By: rmcelroy
Differential Revision: https://phabricator.fb.com/D1982943
Signature: t1:1982943:1428634617:b3449acd6bc08c53daf1de7be8f44f0dc543ef1c
Summary:
Previously, hg update would fail if your sparse profile was not present in the
destination of the update. This had the affect of preventing users from rebasing
newly created sparse profiles. Let's allow it (with a warning). This will allow
them to perform the rebase as long as all of the files they've changed exist in
the other sparse rules they have enabled. If they have no others, the sparse
profile will revert to a full checkout.
Test Plan: Added a test
Reviewers: rmcelroy, pyd, lcharignon, sid0
Reviewed By: sid0
Differential Revision: https://phabricator.fb.com/D1967834
Signature: t1:1967834:1428106927:04ef3a91a0f9f57f0a917d3a48e62e5e38341264
The sparse checkout extension had a pretty bad flaw where rebasing across
certain no-op file changes would fail the rebase. This was due to Mercurial
adding a 'keep' action on those files and that action getting translated to a
'remove' by the sparse extension, then failing to edit the dirstate during the rebase
branchmerge.
The fix is to only issue 'remove' actions if we're not in a branchmerge
and the file in question is in the workingcopy but shouldn't be.
I also added more validation for the branchmerge scenario to make sure we aren't
losing any dirstate data. It will basically abort if any action besides 'keep'
is performed on a file outside the sparse checkout.
Upstream Mercurial has changed the return value of merge.calculateupdates in two
ways: 1) actions is now a file->action mapping instead of a
actiontype->list-of-files mapping, 2) it now returns actions, diverge,
renamedelete where the last two are just used for displaying to the user and can
be pretty much ignored by the sparse extension.
Summary:
strip -r . -k rebuilds the dirstate and was inserting filtered entries
into the dirstate. This fixes rebuild to exclude sparse files.
Test Plan: Added a test
Reviewers: sid0, pyd, davidsp, mitrandir, rmcelroy
Differential Revision: https://phabricator.fb.com/D1743331
Summary:
Adds a sparse checkout extension that allows you to checkout just part of the
working copy. This only affects the working copy, it does not affect history,
or what is pushed and pulled from the server.
The basic api is:
hg sparse --include PATTERN... # add a pattern to the sparse checkout
hg sparse --exclude PATTERN... # excludes files from the sparse checkout
hg sparse --delete PATTERN... # deletes an include/exclude rule
hg sparse --enable-profile # enables a predefined sparse profile
hg sparse --disable-profile # disables a predefined sparse profile
hg sparse --reset # makes the repository full again
hg sparse --refresh # refreshes the working copy if .hg/sparse was
modified manually
hg sparse # show the current sparse rules
Test Plan:
Added tests. Ran them. Also deploy it to a couple users for a bit
without major issues.
Reviewers: pyd, sid0, rmcelroy, davidsp, mpm
Subscribers: mitrandir, akushner
Differential Revision: https://phabricator.fb.com/D1698824