Commit Graph

34 Commits

Author SHA1 Message Date
Shravya Reddy Kuchikulla
3c9328d1ee sparse: add a --cwd-list option
This diff adds an option --cwd-list to hg sparse. This will return the
contents of the current directory.  The files that are in the sparse profile are
annotated with a '-' indicator.

Test Plan:
Tested by running the command 'hg sparse --cwd-list' in various folders.

Differential Revision: https://phab.mercurial-scm.org/D731
2017-10-01 05:45:27 -07:00
Kostia Balytskyi
099d4692bb sparse: use correct cwd-prepending with patterns
Summary:
Change fb-hgext's sparse to treat patterns correctly (this was brought to
my attention by @martinvonz on the mailing list).

This patch makes sure that:

```
  reporoot/subdir$ hg --include **/file
```

results in `subdir/**/file` being included rather than `subdir/`.

Test Plan: rt

Reviewers: mjpieters, durham, #fbhgext

Subscribers: martinvonz

Differential Revision: https://phab.mercurial-scm.org/D225
2017-08-04 06:16:45 -07:00
Kostia Balytskyi
6203a99ed4 sparse: also apply relative-path logic to --delete
Summary: Add `--delete` to the list of sparse options that understand cwd-relative paths.

Test Plan: rt

Reviewers: mjpieters, #fbhgext

Differential Revision: https://phab.mercurial-scm.org/D197
2017-07-30 08:42:40 -07:00
Kostia Balytskyi
99b1950cd9 sparse: make path absoluteness checks cross-platform
Summary: Let's be friendlier to our friends on Windows.

Test Plan: rt

Reviewers: mjpieters, #fbhgext

Differential Revision: https://phab.mercurial-scm.org/D194
2017-07-28 06:23:52 -07:00
Kostia Balytskyi
475c6c93fd sparse: add a config option to decide if paths are reporoot-relative
Summary:
Adding a knob to control how we perceive supplied paths is a good intermediated
step towards getting every user to use cwd-relative paths.

Test Plan: - rt

Reviewers: mjpieters, #fbhgext

Differential Revision: https://phab.mercurial-scm.org/D175
2017-07-25 10:43:55 -07:00
Kostia Balytskyi
6b62dd3f52 sparse: properly error out when absolute paths are used
Summary: Current behavior does not even do what it says, let alone the right thing.

Test Plan: - rt

Reviewers: #fbhgext

Differential Revision: https://phab.mercurial-scm.org/D174
2017-07-24 02:12:37 -07:00
Mateusz Kwapich
760d982e3e tests: change the name of backup files
Summary: Looks like the upstream has changed it on us.

Reviewers: quark

Reviewed By: quark

Subscribers: quark

Differential Revision: https://phab.mercurial-scm.org/D40
2017-07-11 09:44:53 -07:00
Martijn Pieters
b302fcecbc testing: fix spacing for merge conflict markers
Summary: Yay for arbitrary single space changes.

Test Plan: Run the two affected tests to show they now pass again.

Reviewers: simonfar, rmcelroy, quark, stash

Reviewed By: stash

Subscribers: mjpieters, #mercurial

Differential Revision: https://phabricator.intern.facebook.com/D4244213

Signature: t1:4244213:1480431919:ba4837619652023005faeb00a93a351c7ca0411a
2016-11-29 07:23:32 -08:00
Kostia Balytskyi
8bf34fd038 tests_: fix tests in accordance with the core changes
Differential Revision: https://phabricator.intern.facebook.com/D3967244
2016-10-04 05:25:28 -07:00
Jun Wu
8cf88a152b test-sparse: fix the test
Summary: Seems the output has changed somehow and needs an update.

Test Plan: Run the test

Reviewers: #sourcecontrol, rmcelroy, mjpieters

Reviewed By: rmcelroy

Subscribers: mitrandir, rmcelroy, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D3955443

Signature: t1:3955443:1475332010:d2a0e33b509d198312d71458aaf0dfd7f5ce73d7
2016-09-29 18:36:16 -07:00
Jun Wu
8a3a99ba21 hgext: move single file extensions to hgext3rd
Summary:
Be a better citizen under system python path.

Fix all tests issues and change setup.py to use glob pattern to include
all extensions.

Test Plan:
Run tests and `make local`.
Also build and install the package and run `hg sl` in major repos.

Reviewers: #mercurial, ttung, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, durham, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D3534311

Signature: t1:3534311:1468275426:fe122646c8bd6c541e1889e73e9df28f86747ff2
2016-07-08 13:15:42 +01:00
Martijn Pieters
5b77967854 Backed out changeset 0aa2b8139243
Summary:
The upstream change has now been *properly* landed at
https://selenic.com/repo/hg//rev/6ee50bdeeb32.

Once again, Mea Culpa, yesterday I apparently was in clowntown mode with these
patches.

Test Plan:
Run all affected tests:

  $HGSRC/tests/run-tests.py -l test-pull-createmarkers* test-pushrebase* test-pushvars*

Reviewers: #sourcecontrol, ttung, quark

Reviewed By: quark

Subscribers: mjpieters, durham

Differential Revision: https://phabricator.intern.facebook.com/D3462832

Signature: t1:3462832:1466513182:58d6187c04e0e567a026aba90bf753c76f4949a7

Blame Revision: D3460645
2016-06-21 13:58:55 +01:00
Durham Goode
ec171a5a29 backout: backout e61bd9d5e8ca about file descriptor cache
Summary:
e61bd9d5e8ca requires a change to core that has been accepted but not yet
pushed. This breaks the build, so let's revert it until upstream pushes the
dependency.

Test Plan: Ran the tests

Reviewers: ttung, mjpieters, #sourcecontrol, mitrandir

Reviewed By: mitrandir

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D3460645

Signature: t1:3460645:1466465904:cd521a989e475f9987237307a7d4d672d58ba615
2016-06-20 16:38:48 -07:00
Martijn Pieters
08afaea81e Get rid of getfilecache now that it is no longer needed
Summary:
Now that my upstream patch for filedescriptor class access has landed the helper function to bypass the descriptor protocol can go altogether.

Depends on D3454878

Test Plan:
Run affected extension tests:

  $HGSRC/tests/run-tests.py -l test-sqldirstate-* test-reflog* test-sparse*

Reviewers: #sourcecontrol, ttung

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D3456368
2016-06-20 12:12:32 +01:00
Martijn Pieters
9b160b48c6 Use one function to access the filecache descriptor, and wrapfunction to patch
Summary:
There were 3 clowntowny versions of the wrapfiledescriptor function, 2 being
dangerously wrong about how they scan the class hierarchy. All because
`classobj.descriptorname` invokes the descriptor protocol and the filecache
descriptor is not set up for that access.

Instead of one function to do it all, use one utility function to retrieve
the descriptor object from the class __dict__ to avoid the descriptor protocol
kicking in, and use mercurial.extensions.wrapfunction to do the actual
wrapping.

I've sent a patch upstream to fix accessing the filecache descriptor on the
class; if accepted we can drop the getfilecache utility function altogether,
leaving only the wrapfunction calls.

Test Plan:
Run affected extension tests:

   $HGSRC/tests/run-tests.py -l test-sqldirstate-* test-reflog* test-sparse*

Reviewers: #sourcecontrol, ttung

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D3454878
2016-06-20 12:12:32 +01:00
timeless@gmail.com
cd35432d91 spelling: fix numerous spelling errors 2016-04-04 12:48:01 -07:00
Christian Delahousse
6f47ee3475 sparse: make debugrebuilddirstate --minimal sparse aware
Summary:
This diff makes debugrebuilddirstate --minimal sparse aware. The included tests cover
the cases outlined in the `debugrebuild --minimal`.

This diff depends on commit 0b73d3e75ef7 in core hg.

Test Plan:
  12/07 16:52 cdelahousse@dev4253 ~/local/fb-hgext/tests
  $ ./run-tests.py -j 40 test-sparse* --with-hg=~/local/hg-repo/hg
  ....
  # Ran 4 tests, 0 skipped, 0 warned, 0 failed.



Reviewers: #sourcecontrol, durham

Reviewed By: durham

Differential Revision: https://phabricator.fb.com/D2594568

Tasks: 8832753

Signature: t1:2594568:1447480370:ca70a9330ff89a74afe2f6e9d7e5ea1fa4e8f15f
2015-12-07 16:57:17 -08:00
Laurent Charignon
b5178471a0 sparse: forbid paths starting with /
Summary:
Forbit paths starting with / in sparse file and using the command
line arguments. Also fix a typo (util.abort vs util.Abort)

Test Plan: added test

Reviewers: durham

Differential Revision: https://phabricator.fb.com/D2696541
2015-12-01 13:17:31 -08:00
Martijn Pieters
20dca7abe1 Avoid infinite loop on absolute paths
Summary:
`os.path.dirname('/')` returns `'/'`, so for an absolute path you end up with
infinite recursion here. Switch to testing for a basename instead (works on Windows with drive letters too). Absolute directories outside of the repository are rejected elsewhere.

Added a testcase that demonstrates absolute paths now work and paths outside the repository are rejected to detect future regressions.

Test Plan:
Run the test suite:

  cd tests && python run-tests.py test-sparse*

Reviewers: rmcelroy, durham

Reviewed By: rmcelroy

Differential Revision: https://phabricator.fb.com/D2690822

Tasks: 9156031

Signature: t1:2690822:1448475411:108ac635951cdb9d05329e0b91a9db6c24e8a75f
2015-11-25 22:06:33 +00:00
Christian Delahousse
3bdbe85126 unittest: fixing merge conflict output in tests
Summary:
Some changes in core made the output for merge conflicts change. I just made
certain tests reflect that.

Test Plan: ran the tests

Reviewers: #sourcecontrol, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy

Differential Revision: https://phabricator.fb.com/D2566237

Tasks: 8797924

Signature: t1:2566237:1445456815:d5a1560bd3421de6b9955e44a8dd2698f0462f51
2015-10-21 12:11:44 -07:00
Durham Goode
8fbe1e4ea1 sparse: make sparse extension work on non-sparse repos
Summary:
It's possible that the sparse extension might be loaded, even if the sparse
extension is not enabled for the particular repo (like if you're cloning from a
sparse repo to a non-sparse repo on the same machine). Previously it broke,
because we assumed all repo's had sparsematch(). Now we check for it before
using it.

Test Plan:
Added a test. The old test wasn't sufficient since it didn't have any
commits, so the dirstate was not interacted with

Reviewers: #sourcecontrol

Differential Revision: https://phabricator.fb.com/D2278657
2015-07-24 13:03:09 -07:00
Durham Goode
5b01596008 sparse: move hgwatchman integration test to test-sparse-extensions.t
We now have a test file explicitly for extension integrations. So let's move the
hgwatchman test.  Includes some minor changes to make it work.
2015-06-15 17:44:39 -07:00
Durham Goode
b34a9af1d5 Fix repo's where sparse is present but not enabled
Summary:
There can be situations where the sparse extension has run uisetup, but the repo
object doesn't have sparse enabled so it doesn't run reposetup. We need to make
sure all the work uisetup does can condition on whether reposetup has done it's
work or not.

Test Plan: Added a test

Reviewers: lcharignon, pyd, ericsumner, sid0, rmcelroy

Reviewed By: rmcelroy

Differential Revision: https://phabricator.fb.com/D2129966

Signature: t1:2129966:1433522840:90029011ac8bbb2e1efbaf9fb317c1e55aa18737
2015-06-04 16:50:18 -07:00
Ryan McElroy
099010405c sparse: alphabetize sparse config for test stability
Test Plan: Updated tests, ran tests many times with no more failures

Reviewers: ttung, durham, mitrandir, #sourcecontrol

Reviewed By: durham, mitrandir, #sourcecontrol

Differential Revision: https://phabricator.fb.com/D2003040

Signature: t1:2003040:1430327993:b5b439becb928f45a7594fb727b1335f95f992d0
2015-04-17 14:32:04 -07:00
Ryan McElroy
949908801c sparse: introduce flag on 'hg add' to update sparse config
Summary:
We want to be able to more seamlessly update sparse profiles when adding files.
This patch adds a `--sparse` flag to `hg add` that ensures the directory of the
added file is included in the sparse profile.

Test Plan: updated test

Reviewers: ttung, durham, #sourcecontrol

Reviewed By: durham, #sourcecontrol

Differential Revision: https://phabricator.fb.com/D2003039

Tasks: 6733090

Signature: t1:2003039:1430327770:295f1ac9960ca9dcb4ce84f76458faad68106272
2015-04-17 14:29:23 -07:00
Durham Goode
be7516e6bc sparse: integrate with hgwatchman's ignore hash
Summary:
hgwatchman keeps a hash of the ignore matcher. Since we wrap the ignore
matcher to simulate a sparse checkout, we need to provide a hash that changes
as well.

Test Plan:
Adds a test. Verified the test failed without the change, and passed
with it.

Reviewers: rmcelroy, lcharignon, ericsumner, sid0

Reviewed By: sid0

Differential Revision: https://phabricator.fb.com/D2022219

Signature: t1:2022219:1429912457:51bf4677e1894ecca6da47a9fa6c4110f132c937
2015-04-24 12:29:31 -07:00
Durham Goode
5cd2a69ed5 Fix status on files in included subdirs
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
2015-04-24 09:52:00 -07:00
Durham Goode
599649e115 sparse: add log --sparse
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
2015-04-17 10:01:55 -07:00
Durham Goode
933f828bb1 sparse: add temporarily included files when merging
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
2015-04-09 17:17:03 -07:00
Eric Sumner
34002e0224 hgext: fix many tests, run-tests, writecg2 for hg3.3
Summary: Still need to fix pushrebase

Test Plan: ##run-tests.py##

Reviewers: sid0, daviser, davidsp, mitrandir, akushner, rmcelroy, pyd, mpm, durham

Reviewed By: durham

Differential Revision: https://phabricator.fb.com/D1813630

Signature: t1:1813630:1422573745:c5ea2a8acdfda0e555d1ae56a16f4fb5e5618174
2015-01-29 15:06:06 -08:00
Durham Goode
2b4b3831c8 Fix rebase with no-op changes
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.
2015-01-14 16:31:01 -08:00
Durham Goode
b638332657 Update sparse to match upstream
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.
2015-01-06 11:38:33 -08:00
Durham Goode
acbfa0551c Fix sparse strip -r . -k
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
2014-12-16 11:35:41 -08:00
Durham Goode
08d5465b17 sparse: add sparse checkout extension
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
2014-12-01 11:02:08 -08:00