Commit Graph

146 Commits

Author SHA1 Message Date
Stanislau Hlebik
1eebe223d0 tests: register some config options
Previously test-treemanifest-treeonly.t was hanging. Now it doesn't hang (but
still fails).

It obviously doesn't fix the real issue, but at least it doesn't make test
hang.

Test Plan:
Run test-treemanifest-treeonly.t

Differential Revision: https://phab.mercurial-scm.org/D1205
2017-10-23 10:07:38 -07:00
David Soria Parra
d6a9a2bcaa lfs: implement remotefilelog prefetch
When calling prefetch in remotefilelog, also prefetch lfs
files.

We are using the same hook mechanism that remotefilelog is already using
for LFS by having remotefilelog call into LFS.

Test Plan:
run tests on test-lfs-remotefilelog-prefetch.t

Differential Revision: https://phab.mercurial-scm.org/D732
2017-09-20 14:02:58 -07:00
Durham Goode
8bb86ab225 shallowbundle: handle changegroup3
Upstream has changed local bundles to use the highest available changegroup
version, which means we're using changegroup3 for strips now. So we need to
handle that in shallowbundle.
2017-09-19 16:48:19 -07:00
Mihails Smolins
cb788cc931 remotefilelog: create delay for background prefetches
Summary:
This functionality allows to add delays between background prefetches after
operations that change the working copy parent. By default background
prefetches will be run no often than every 2 minutes, but this is configurable.
This allows to reduce the load on CPU(because prefetch is followed by repack).

Test Plan:
Tested manually on fbsource repo by running hg co bookmark several
times and ensuring that only 1 background prefetch is running if 2 minute
timeout has not expired.

Reviewers: durham, simonfar, ryanmce, #fbhgext

Reviewed By: simonfar, #fbhgext

Differential Revision: https://phab.mercurial-scm.org/D712
2017-09-15 07:28:07 -07:00
Kostia Balytskyi
62e1ad3898 remotefilelog: make style-checker happy
Summary: `test-check-code-hg.t` complains about long lines here.

Test Plan: - rt, make sure it does not complain anymore

Reviewers: durham, #fbhgext

Differential Revision: https://phab.mercurial-scm.org/D697
2017-09-13 08:42:08 -07:00
Durham Goode
d476572384 remotefilelog: make backwards compatible with older changegroup api
Upstream has changed the changegroup API, and we updated to use it. Let's also
support the old API though.
2017-09-12 12:30:24 -07:00
Durham Goode
b5deda8de4 changegroup: update to match upstream makechangegroup change
Upstream has refactored the changegroup creation APIs so we need to update our
usages.
2017-09-12 10:10:06 -07:00
Durham Goode
364ef7af41 tree: don't download flat manifests when cloning in tree only mode
Summary: Prevents downloading any manifest revlogs when the client is in treeonly mode.

Reviewers: #fbhgext, simonfar

Reviewed By: #fbhgext, simonfar

Differential Revision: https://phab.mercurial-scm.org/D575
2017-08-31 11:14:39 -07:00
Mihails Smolins
de2fbf4ada remotefilelog: keepset tuple bug fix
Summary:
Keepset computation algorithm added tuples to the keepset that are the results
of diffs between two manifests. Now it has been fixed and only new node from
the tuple is added to the keepset.

Test Plan:
* Run hg gc on www, fbsource
* Ensure the unit tests pass

Reviewers: simonfar, durham, #fbhgext, ryanmce

Reviewed By: #fbhgext, ryanmce

Subscribers: ryanmce

Differential Revision: https://phab.mercurial-scm.org/D519
2017-08-25 10:06:43 -07:00
Durham Goode
7d2bdf6f8e repack: fix incremental repack for large quantities of packs
Summary:
Previously incremental repack would only take the top 3 packs in a generation of
packs. For instance, if there were 100 packs between 1KB and 1MB, it would only
repack the first 3, instead of repacking a whole bunch because it's cheap. This
patch fixes it to grab as many packs in a generation as it can fit under the
limit (default of 100MB of pack data).

This will fix an issue where we're seeing users with 100's of tiny pack files
that aren't getting repacked fast enough.

Test Plan: Added a test

Reviewers: #fbhgext, quark

Reviewed By: #fbhgext, quark

Subscribers: quark

Differential Revision: https://phab.mercurial-scm.org/D500
2017-08-24 09:31:10 -07:00
Jun Wu
805ddc8422 codemod: be compatible with upstream change
D319 renamed `peer.pipe[ioe]` to `peer._pipe[ioe]`.
D320 removed `peer.batch`.
D331 renamed `subprocess` to `_subprocess`.
D336 renamed `_capabilities` to `capabilities`.

Let's be compatible with those changes.

Differential Revision: https://phab.mercurial-scm.org/D425
2017-08-21 15:10:41 -07:00
Mihails Smolins
c4e13682c5 remotefilelog: efficient keepset computation
Summary:
New keepset computation algorithm yields 50% time improvement on a small set of
commits and about 90% time improvement on a large set of commits. Currently it
takes about 1m10s to compute a keepset of 10 commits with treemanifest
usecunionstore flag unset and 3 seconds with cunionstore config set, provided
all trees are prefetched.

Test Plan: * Ensure that unit tests pass, in particular *-gc.t and *-gcrepack.t

Reviewers: ryanmce, simonfar, durham, #fbhgext

Reviewed By: ryanmce, #fbhgext

Differential Revision: https://phab.mercurial-scm.org/D442
2017-08-21 09:08:19 -07:00
Mihails Smolins
a2bdf68679 remotefilelog: limit number of changesets to be prefetched
Summary:
Added config option 'prefetchdays' which indicates that commits older than
'prefetchdays' days should not be prefetched. This option is necessary to avoid
prefetch of huge amount of data. The default value is set to 14 days.

Test Plan: Ensure that unit tests pass

Reviewers: ryanmce, simonfar, durham, #fbhgext, simpkins

Reviewed By: #fbhgext, simpkins

Subscribers: simpkins

Differential Revision: https://phab.mercurial-scm.org/D420
2017-08-16 13:21:31 -07:00
Mihails Smolins
cf3cd8e4cb remotefilelog: change revset computation
Summary:
repo.revs cannot resolve aliased revisions such as 'top' or 'bottom', therefore
it is substituted by scmutil.revrange for any user provided inputs.

Test Plan:
* Test on www repo by running hg pull with remotefilelog.pullprefetch='bottom'(or any other aliased rev)
* Ensure that unit tests pass

Reviewers: simonfar, rmcelroy, durham

Reviewed By: durham

Subscribers: medson, mjpieters, #mercurial

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

Signature: t1:5602536:1502386617:b632f778da4ddef54d7283b60c7c1a24c6b38028
2017-08-10 10:39:08 -07:00
Mihails Smolins
4bbe319f4c remotefilelog: add repack to hg gc
Summary: Now on hg gc incremental repack is run if configured

Test Plan: Added a test case

Reviewers: simonfar, durham

Reviewed By: durham

Subscribers: medson, mjpieters, #mercurial

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

Tasks: 19727557

Signature: t1:5583902:1502221690:dce09112207e9e4595458d61a7b73f1210d3b012
2017-08-09 11:04:46 -07:00
Mihails Smolins
2f4474e9ab remotefilelog: update hg gc keepset
Summary:
Now hg gc keepset includes pullprefetch and bgprefetchrevs revsets to avoid
garbage collection of prefetched in background data.

Test Plan: Added test case, also tested in *-gcrepack.t

Reviewers: durham, simonfar

Reviewed By: simonfar

Subscribers: medson, mjpieters, #mercurial

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

Tasks: 19727557

Signature: t1:5583184:1502208410:c247d802cf27c0143b6d7e2d95029bad5f344499
2017-08-08 09:11:39 -07:00
Mihails Smolins
bbd44be472 remotefilelog: garbage collection on repack
Summary:
Implemented initial version of a garbage collector for repack. Garbage
collection is only performed if gcrepack flag is set in config. Currently
data that is old and not in keepset is garabage collected. The age of data at
which point it will be garbage collected can be specified in config as well.

Test Plan: Added a test case

Reviewers: durham

Reviewed By: durham

Subscribers: rmcelroy, medson, mjpieters, #mercurial

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

Tasks: 19727521

Signature: t1:5548194:1501882489:cc775ec95aa6fafc462a46f99d790f231139ce27
2017-08-07 11:30:53 -07:00
Mihails Smolins
f506a362bd remotefilelog: change prefetch default behaviour
Summary:
Now hg prefetch with no revs specified by default fetches '. + draft() +
pullprefetch + bgprefetchrevs' revisions. Prefetch will block until other
background prefetches terminate.

Test Plan: Added test cases

Reviewers: durham, stash, simonfar

Reviewed By: simonfar

Subscribers: medson, mjpieters, #mercurial

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

Tasks: 19727474

Signature: t1:5488573:1500987699:f0a12c9fdf21c52a7313182596bb89a9f710cebf
2017-07-25 06:35:16 -07:00
Mihails Smolins
6c06199dbb remotefilelog: add bgprefetch to update and commit
Summary:
If bgprefetchrevs is specified in config, background prefetch will be executed on
update and commit commands as well as on other commands which use update or
commit. Background prefetch will fetch revisions specified in config and if the
repack flag is set will also execute a repack.

Test Plan: Added test cases

Reviewers: simonfar, durham

Reviewed By: durham

Subscribers: medson, mjpieters, #mercurial

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

Tasks: 19727407

Signature: t1:5454939:1500551182:e9cce84f6dc98182b5cb30faeb811fd7fa5e22b0
2017-07-20 04:54:44 -07:00
Mihails Smolins
9a121651cc remotefilelog: enable background prefetch for pull
Summary:
Previously prefetch on pull ran in foreground. Now it can run in background
if specified. Optionally background prefetch can be followed by background
repack.

Test Plan: Added a test case

Reviewers: simonfar, durham

Reviewed By: simonfar

Subscribers: medson, mjpieters, #mercurial

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

Tasks: 19727343

Signature: t1:5406626:1500059334:207b4100cca536cbe33f6c6dfad596d03a6fa14f
2017-07-17 03:04:22 -07:00
Jun Wu
e9147da58e remotefilelog: fix changelog.add when node exists
Summary:
When committing a node which already exists, the linkrev provided to filelog
is actually wrong (len(changelog)). The upstream Mercurial will not update
existing file revisions but remotefilelog will.

The fact that linkrev being wrong triggers the ProgrammingError added by
D5061330. This diff detects that case and avoid writing bad linkrevs or
raise ProgrammingError.

Test Plan: Added a test.

Reviewers: #mercurial, durham

Reviewed By: durham

Subscribers: medson, mjpieters

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

Signature: t1:5278060:1497910883:b8c3b6281ad9c0a516b942ba8ca41c51801b2d6b
2017-06-19 15:35:23 -07:00
Durham Goode
e34660b057 commands: update to use registrar instead of cmdutil
Summary: Upstream has deprecated cmdutil.commands() in favor of registrar.commands()

Test Plan: Ran the tests

Reviewers: #mercurial, quark

Reviewed By: quark

Subscribers: mjpieters

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

Signature: t1:5106486:1495485074:0e20f00622cc651e8c9dda837f84dd84cc51099e
2017-05-22 13:38:37 -07:00
Durham Goode
1b18d802ad packs: add packs.maxchainlen config
Summary:
Previously our data packs would have incredibly long delta chains, where to read
the last entry in the file you had to read every previous delta all the way to
the beginning. This was very expensive for chains of 2+ million deltas. Let's
add a config option to limit how long the deltas get, and for now we'll default
it to 1000.

Test Plan: Added a test

Reviewers: #mercurial, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, mjpieters

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

Signature: t1:5095603:1495213707:737d63129cf459ad6927a1f4deb0dda5a8ce0a7f
2017-05-21 17:09:08 -07:00
Jun Wu
b1a694579e remotefilelog: wrap flog.addrawrevision instead of flog.add
Summary:
remotefilelog needs to wait for changelog creation to get the commit hash so
all filelog appending operations are pending if linkrev is an integer.

That is better done in the `addrawrevision` layer since it will catch more code
paths. Besides, that means remotefilelog won't need to hash a same revision
twice.

Test Plan: arc unit

Reviewers: #mercurial, durham

Reviewed By: durham

Subscribers: mjpieters

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

Signature: t1:5061330:1494871717:a7224ebdc0f221fbaabbd2a58de975caec0e4b05
2017-05-16 16:23:37 -07:00
Jun Wu
0d6151f530 remotefilelog: add lfs integration test
Summary:
The test covers common workflows like clone, commit, push, update, pull. It
exercises the remotefilelog plain store and Python datapack store to make sure
they won't lose the revlog flag. The test also tries to verify rename works
correctly.

Since the lfs extension may be eventually upstreamed, it seems a good idea to
make remotefilelog call `lfs.wrapfilelog` so lfs is free from remotefilelog
code.

Test Plan: Added a test

Reviewers: #mercurial, durham

Reviewed By: durham

Subscribers: mjpieters

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

Signature: t1:4904281:1492560308:5fd9f214ada6de795735ea7d737d30c1bf39812a
2017-04-26 19:55:02 -07:00
Jun Wu
635683876d codemod: fix compatibility with the upstream revset refactoring
Summary:
`mercurial.revset` was recently split into `revset + revsetlang + smartset`.
Update our code accordingly.

D4604848 has fixed the `revsetlang` part. This patch fixes the remaining
`smartset` part.

Also fixes some test failures introduced by D4547080.

Test Plan: `arc unit`

Reviewers: #mercurial

Subscribers: jeroenv, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D4595417
2017-02-23 13:09:59 -08:00
Adam Simpkins
9d76f8392d remotefilelog: don't define a sparsematch() method
Summary:
The remotefilelog extension previously unconditionally added a sparsematch()
method to repository objects, which just called super.sparsematch() if this is
a sparse repository, and returned None if this isn't a sparse repository.

However, defining a sparsematch() method that returns None confuses the sparse
extension.  The sparse extension expects that all repositories that define
sparesmatch() are actually sparse repositories, and never expects this method
to return null.

This updates the remotefilelog code to call its method maybesparsematch()
instead.

Test Plan:
Confirmed existing remotefilelog unit tests pass, and that the sparse extension
no longer crashes when it is used with non-sparse repositories.  (This happens
when using the share extension, if the current working directory is non-sparse
but the sharedpath repository configuration loads the sparse extension.)

Reviewers: tja, durham

Reviewed By: durham

Subscribers: net-systems-diffs@, yogeshwer, mjpieters

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

Signature: t1:4466108:1485451483:287a519151e35bdb99f5be0d9287b4698386183e
2017-01-26 11:01:31 -08:00
Jun Wu
f08e17d3ed testedwith: change testedwith to "ships-with-fb-hgext"
Summary:
Using `testedwith = 'internal'` is not a good habit [1]. Having it
auto-updated in batch would also introduce a lot of churn. This diff makes
them "ships-with-fb-hgext". If we do want to fill the ideal "testedwith"
information, we could put it in a centric place, like a "fbtestedwith"
extension rewriting those "ships-with-fb-hgext" on the fly.

Maybe having in-repo tags for tested Mercurial releases is also a good idea.

[1]: www.mercurial-scm.org/repo/hg/rev/2af1014c2534

Test Plan: `arc lint`

Reviewers: #sourcecontrol, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, mjpieters

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

Signature: t1:4244689:1480440027:3dc18d017b48beba1176fbfd120351889259eb4b
2016-11-29 13:24:07 +00:00
Martijn Pieters
d574fb13ed import mercurial.debugcommands if present
Summary:
The debugindex and debugindexdot commands have moved and are not registered
unless you import the new mercurial.debugcommands module.

Test Plan:
Run

   hg --config=extensions.remotefilelog=fb-hgext/remotefilelog help

and observe that you get help info, rather that the error

   hg: unknown command 'debugindex'

then run the fb-hgext test suite.

Reviewers: rmcelroy, quark, simonfar

Reviewed By: simonfar

Subscribers: mjpieters, #mercurial

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

Signature: t1:4244047:1480427216:dcaa1ca441ea189bdf68f1f619b4078d8c1d09dc
2016-11-29 13:48:59 +00:00
Jun Wu
77d215b481 remotefilelog: check file existence in _revertprefetch
Summary: This is to address a crash report: P56804194.

Test Plan: `arc unit`

Reviewers: durham, #sourcecontrol, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, mjpieters

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

Signature: t1:4141002:1478547571:2a06a48c3687ce91f6a52b59ddc01a17466782a8
2016-11-07 18:30:10 +00:00
Durham Goode
36ec03fd19 remotefilelog: improve robustness of hg gc loop
Summary:
We've gotten reports of hg gc failing on some service machines because
`peer._repo.name` complains that repo has no attribute 'name'. I'm not sure how
this could happen, but it makes sense to make the hg gc loop more robust to the
possibility that the repos in the 'repos' file have changed their configuration
since they were added to the file.

Test Plan: Ran the tests

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: mjpieters

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

Signature: t1:4072719:1477385020:24d532b9442292ce8234cc91bc7de503d3b0c88f
2016-10-25 12:30:59 -07:00
Durham Goode
fe06171422 remotefilelog: fix inconsistency with nonoverlap in upstream
Summary:
Upstream changed the signature of computenonoverlap. Let's change our wrapping
of it to be more robust to signature changes.

Test Plan: ./run-tests.py test-remotefilelog* test-check*

Reviewers: #mercurial, quark

Reviewed By: quark

Subscribers: mjpieters

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

Tasks: 14037455

Signature: t1:4062705:1477096049:5a011a7a5edf9bb01475694777c738cdb02453f5
2016-10-21 17:29:06 -07:00
Durham Goode
f43ba75915 remotefilelog: fix pyflakes and module import errors
Summary:
This fixes all the pyflaks and module errors for the main remotefilelog
code base.

Test Plan: ./run-tests.py test-check* test-remotefilelog*

Reviewers: #mercurial, quark

Reviewed By: quark

Subscribers: mjpieters

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

Signature: t1:4055537:1477049663:ee904d311d17d3659e055e2c109c68c9023cfd1f
2016-10-21 11:02:09 -07:00
Jun Wu
6007cd6e15 remotefilelog: remove duplicated testedwith
Summary: There is a line `testedwith = ''` below.

Test Plan: Code Review

Reviewers: #mercurial, ttung, rmcelroy

Reviewed By: rmcelroy

Subscribers: mjpieters

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

Signature: t1:3886521:1474301901:cceadfc1d5b181435362d7ae75014bad1a75576f
2016-09-19 15:52:20 +01:00
Adam Simpkins
e25889f60f fix crash in "hg pull" when remotefilelog not enabled
Summary:
764cd9916c94 recently introduced code that was unconditionally checking the
repo.includepattern and repo.excludepattern attributes on a local repository
without first checking if this is a shallow repository.  These attributes only
exist on shallow repositories, causing "hg pull" to crash on non-shallow
repositories.  This crash wouldn't happen in simple circumstances, since the
remotefilelog extension only gets fully set up once a shallow repository object
has been created, however when using chg you can end up with scenarios where a
non-shallow repository is used in the same hg process after a shallow one.

This refactors the code to now store the local repository object on the remote
peer rather than trying to store the individual shallow, includepattern, and
excludepattern attributes.

Overall this code does still feel a bit janky to me -- the rest of the peer API
is independent of the local repository, but the _callstream() wrapper cares
about the local repository being referenced.  It seems like we should ideally
redesign the APIs so that _callstream() receives the local repository data as
an argument (or we should make the peer <--> local repository assocation more
formal and explicit if think it's better to force an association here).

Test Plan: Added a new test which triggered the crash, but passes with these changes.

Reviewers: ttung, mitrandir, durham

Reviewed By: durham

Subscribers: net-systems-diffs@, yogeshwer

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

Tasks: 12823586

Signature: t1:3756493:1471971600:9666e9c31bf59070c3ace0821d47d322671eb5b1
2016-08-23 14:14:42 -07:00
Durham Goode
baaff31090 repack: move background repack into requirement check
Previously we were kicking off background repacks even for non remotefilelog
repos. Moving the repack to be inside the remotefilelog requirement check will
prevent this.
2016-08-05 10:00:22 -07:00
Olivier Trempe
51e02acf2c filelogrevset: Return revset.baseset instead of plain list. Add test for kind in path. 2016-08-02 09:40:50 -07:00
Tony Tung
9e557758b0 [datapack] add --node as a parameter to dump extra data about a node
Summary:
It obtains the deltachain and dumps the chain to the console.

Depends on D3627117.

Test Plan:
```
[andromeda]:~/work/mercurial/facebook-hg-rpms/remotefilelog:3266095> hg debugdatapack d864669a5651d04505ec6e5e9dba1319cde71f7b --node ba5fbf1aba48f25d46228626917b2705adc9e7c8

arcanist/__phutil_library_map__.php
Node                                      Delta Base                                Delta SHA1                                Delta Length
ba5fbf1aba48f25d46228626917b2705adc9e7c8  0000000000000000000000000000000000000000  df442a6f976b946c266f76b0f63a198e8aabf809  3993
[andromeda]:~/work/mercurial/facebook-hg-rpms/remotefilelog:3266095>
```

Reviewers: durham

Reviewed By: durham

Subscribers: mitrandir

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

Signature: t1:3627119:1469738313:d61726585a020ed4cbabbb1f623eb202ccd51b9f
2016-07-28 17:15:21 -07:00
Tony Tung
7111de0994 [datapack] allow for long hashes to be printed
Summary:
This will help verify the C datapack reader.

Depends on D3627112.

Test Plan:
```
[andromeda]:~/work/mercurial/facebook-hg-rpms/remotefilelog:4063a65> hg debugdatapack --long  d864669a5651d04505ec6e5e9dba1319cde71f7b  | head -n 15

arcanist/__phutil_library_map__.php
Node                                      Delta Base                                Delta Length
ba5fbf1aba48f25d46228626917b2705adc9e7c8  0000000000000000000000000000000000000000  1265

arcanist/canary/FacebookConfigeratorArcanistCanaryWorkflow.php
Node                                      Delta Base                                Delta Length
142f9991fca1a16c6544cb6e5a0071296e712268  0000000000000000000000000000000000000000  6546

arcanist/lint/FacebookConfigeratorLintEngine.php
Node                                      Delta Base                                Delta Length
c8630501c45f1bc1dc47df2ee2ad354993438cdb  0000000000000000000000000000000000000000  2811

arcanist/lint/linter/FbcodePyFlake8Linter.php
Node                                      Delta Base                                Delta Length
[andromeda]:~/work/mercurial/facebook-hg-rpms/remotefilelog:4063a65> hg debugdatapack   d864669a5651d04505ec6e5e9dba1319cde71f7b  | head -n 15

arcanist/__phutil_library_map__.php
Node          Delta Base    Delta Length
ba5fbf1aba48  000000000000  1265

arcanist/canary/FacebookConfigeratorArcanistCanaryWorkflow.php
Node          Delta Base    Delta Length
142f9991fca1  000000000000  6546

arcanist/lint/FacebookConfigeratorLintEngine.php
Node          Delta Base    Delta Length
c8630501c45f  000000000000  2811

arcanist/lint/linter/FbcodePyFlake8Linter.php
Node          Delta Base    Delta Length
[andromeda]:~/work/mercurial/facebook-hg-rpms/remotefilelog:4063a65>
```

Reviewers: durham

Reviewed By: durham

Subscribers: mitrandir

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

Signature: t1:3627117:1469735318:103e9a21be082749332572c9c4f9942ea9c1c248
2016-07-28 17:07:04 -07:00
Olivier Trempe
a2ce732706 fileserverclient: fixed lingering ssh connection due to reference cycle on pull operations
Calling wrapfunction on the remotefilepeer(sshpeer) object in exchangepull
function introduces a reference cycle. Hence, this object will not be deleted
until the process dies. This is not a big issue for processes having a short
lifetime(e.g. lauched by command line.)
However, for persistent processes (e.g. TortoiseHg), this can lead to multiple
lingering ssh connections to the server(actually one by pull operation).

The fix is to not wrap the remotefilepeer._callstream. This method is defined
right into the remotefilepeer object. The required repo data is made available
in the remotefilepeer object by monkeypatching this object in the exchangepull
function.
2016-07-22 13:47:02 -07:00
Olivier Trempe
0368ca40fc Fix filelogrevset not properly handling "kind" in path 2016-07-22 13:09:48 -07:00
Durham Goode
df65096278 pull: add more requirement checking
In some situations the remotefilelog setup logic could be called, which will
wrap certain functions, and then later a call will happen to a repo that wasn't
remotefilelog which will run some remotefilelog code because of the wrapping.

Normally we take care of this by checking for the remotefilelog requirement. We
missed it in this one spot though.
2016-07-22 12:33:56 -07:00
Martin von Zweigbergk
adcdb9289c commands: tell @command decorator about arguments
Before this patch, debugremotefilelog and verifyremotefilelog would
crash if not given a path. Also, many commands would accept arguments
they then ignored.
2016-06-30 10:14:17 -07:00
Martin von Zweigbergk
c9390fde26 debugdatapack: make function name match command 2016-06-30 10:11:37 -07:00
Durham Goode
6f3d6c53f5 utils: unify cachepath access through a util function
Summary:
Previously a bunch of different places accessed the cachepath through ui.config
directly. This is a problem because we need to resolve any environment variables
in the path, and some spots didn't do this. So let's unify all accesses through
a helper function that takes care of the environment variables.

Test Plan: Added a test

Reviewers: mitrandir, lcharignon, #sourcecontrol, ttung, simonfar

Reviewed By: simonfar

Subscribers: simonfar

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

Signature: t1:3385583:1464971813:5b9ee5ed3d6ff9f1a78cb9e0269e433844758c9d
2016-06-03 09:45:58 -07:00
Durham Goode
01595d2684 repack: allow background repacks to repack non-pack stores
Previously, background repacks would only repack pack files, which meant there
was no automated way to repack loose remotefilelog files without manually
running 'hg repack'. This allows incremental repacks to also pack the loose
files.

It also changes the config knob for background repacks, so we can enable pack
file usage without the server having to support it just yet.
2016-06-01 10:06:35 -07:00
Durham Goode
93fbca3e39 repack: add automatic incremental background repacking after pull
Summary:
This runs the incremental background repacking logic after hg pull.

As part of adding tests, I also added a 'hg debugwaitonrepack' function that
will wait until any pending repack is done before returning, so the tests can
wait on repacks without so many sleeps.

Test Plan: Adds a test

Reviewers: mitrandir, #mercurial, ttung, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy

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

Signature: t1:3306526:1463696933:9e27daf0c08076468e8f365a3c372fa7d4f56bde
2016-05-20 09:31:28 -07:00
Durham Goode
7227563c61 repack: add incremental repack
Summary:
This adds a --incremental flag to the hg repack command. This flag causes repack
to look at the distribution of pack files in the repo and performs the most
minimal repack to keep the repo in good shape. Currently it's only implemented
for datapacks.

The new remotefilelog.datagenerations config contains a list of the sizes for
the different generations of pack files. For instance:

  [remotefilelog]
  datagenerations=1GB
    100MB
    1MB

Designates 4 generations - packs over 1GB, packs over 100MB, packs over 1MB, and
implicitly packs undex 1MB. The incremental algorithm will try to keep each
generation to less than 3 pack files (prioritizing the larger generations
first). When performing a repack it will grab at least 2 packs, and will grab
more if the total pack size is less than 100MB (since repacking at that level is
pretty cheap).

I have no idea if this is a good algorithm. We'll how to see and iterate.

Test Plan: Adds a test

Reviewers: mitrandir, #mercurial, ttung, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy

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

Signature: t1:3306523:1463697129:c87f4a397ef357b5ca4a80d01e9a6ca4d61f9d3d
2016-05-20 09:31:25 -07:00
Durham Goode
a36b9bd403 repack: move repack logic to static functions
Summary:
A future patch will be adding incremental repack, so let's move our repack logic
to the repack module so it's easier to refactor and extend.

Also adds a message for when a background repack kicks off (since we'll be
calling that from other places eventually).

Test Plan: Adds a test

Reviewers: mitrandir, #mercurial, ttung, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy

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

Signature: t1:3306521:1463602886:cece3d517f0672b829702866482c902812f9ae27
2016-05-20 09:31:22 -07:00
Olivier Trempe
66b95b7f12 windows: PWD environment variable not available
The PWD environment variable isn't available on windows, so let's just not
bother checking the current directory for repos in that case.
2016-05-20 08:33:34 -07:00