Commit Graph

47 Commits

Author SHA1 Message Date
Pierre-Yves David
2c956d95e2 revert: only pre-fetch files that needs to be touched
Summary:
With recent version of mercurial (>= 3.2, 4dfcf21a6aa7), revert uses status
information to determine the files that needs to be touched. It then offer a
simple handle for extensions that needs prefetch.

Test Plan:
Ran the tests. Certain tests depended on the old revert behavior (of
prefetching everything), so they required slight changes.

Reviewers: pyd, sid0, davidsp

Differential Revision: https://phabricator.fb.com/D1551059
2014-09-08 15:20:59 +02:00
Durham Goode
580f3eaeb3 Update to match Mercurial version b8c8cacd4482
Summary:
Changegroups have been refactored upstream and we need to update our
remotefilelog monkey patching accordingly.

Also fix an issue with the tests where 'function foo()' was not considered valid
on certain systems.

Test Plan: Ran the tests

Reviewers: pyd, sid0, davidsp

Differential Revision: https://phabricator.fb.com/D1551019
2014-09-11 14:39:14 -07:00
Durham Goode
17c16cf610 Optimize pullprefetch to limit number of stats
Summary:
Previously, if pullprefetch was set, we'd perform a prefetch of the
entire manifest of the specified revs (usually the public bookmarks). This
involved stat-ing all the relevant files in the cache to see if they already
existed, which added an extra 6 seconds or so to every pull.

Now we only prefetch the files that are different from our working copy. We
assume we already have all the files that are in our working copy. This reduces
the pullprefetch overhead significantly.

Test Plan:
Did a pull on my laptop. Verified it didn't hang for 6 seconds at the
prefetch stage. Also updated a test

Reviewers: davidsp, pyd, sid0

Reviewed By: sid0

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

Tasks: 4608894
2014-08-19 09:33:31 -07:00
Durham Goode
e46cd0e8e0 Merge heads 2014-08-07 10:23:18 -07:00
Durham Goode
e5228d9989 Fix pullprefetch that uses bookmarks
Summary:
Previously, pullprefetch was executed during the repo.pull stage. This happens
before the bookmarks have been moved, so revsets like 'bookmark()' would
prefetch the wrong commits.

This change moves the pullprefetch logic to after the pull command is completely
finished.  Updated a test to make sure this is caught.

Also fixes a bug where we were using linkrevs to read a manifest rev entry. We
should be using the manifest rev instead.

Test Plan: Added a test. Ran it.

Reviewers: sid0, pyd, davidsp

Differential Revision: https://phabricator.fb.com/D1483345
2014-08-06 18:50:57 -07:00
Siddharth Agarwal
07a515c430 don't show remotefilelog commands in the shortlist
Summary: These commands (well, not the debug one) were visible in the shortlist that showed up when you type `hg`. They're not basic commands.

Test Plan: Ran `hg` with the extension enabled, didn't see those commands.

Reviewers: durham

Reviewed By: durham

Differential Revision: https://phabricator.fb.com/D1454931
2014-07-23 20:37:48 -07:00
Durham Goode
c44433c62c Fix hg log on patterns
Summary:
Due to a change in upstream mercurial, hg log with patterns was no longer
working. This fixes it by forcing hg log to take the slow path when using
patterns.

It also updates the warning messages to work when running hg log <file> from
within a subdirectory.

Test Plan: Ran the new tests

Reviewers: sid0

Differential Revision: https://phabricator.fb.com/D1450193
2014-07-22 12:55:29 -07:00
Durham Goode
13058fb30c Allow auto-prefetching during pulls
Summary:
Adds a remotefilelog.pullprefetch config options that accepts a revset. Whenever
a pull is run, the revs matched by that revset will be prefetched. The most
common value for this will be '(bookmark() + heads(all())) & public()', since it will download
almost everything necessary to work offline.

Test Plan: Added a test. Ran it.

Reviewers: davidsp, pyd, sid0

Reviewed By: sid0

Differential Revision: https://phabricator.fb.com/D1419420
2014-07-03 13:05:11 -07:00
Siddharth Agarwal
f662120645 merge 2014-06-21 16:06:06 -07:00
Siddharth Agarwal
0d248aa73f applyupdates: update for Mercurial changes
Summary: Update for Mercurial commits 1b6040917a6c anmd 9b42f49d06aa.

Test Plan: Ran the tests

Reviewers: durham, dschleimer, pyd, akushner, davidsp

Reviewed By: davidsp

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

Tasks: 4533623
2014-06-17 15:47:12 -07:00
Durham Goode
e6bee07496 Expand environment variables in cacheprocess and cachepath
Summary:
Expands environment variables in the cacheprocess and cachepath config options,
so users can specify something like remotefilelog.cachepath=$HOME/.hgcache

Test Plan:
Set my cachepath to $HOME/.hgcache on my laptop and manually
performed a shallow clone.  Verified data was put in ~/.hgcache

Reviewers: sid0

Differential Revision: https://phabricator.fb.com/D1342174
2014-05-21 12:28:03 -07:00
Durham Goode
c5b2f574a0 Fix changegroup wrapping with new upstream Mercurial
Summary:
Recent changes to upstream Mercurial have moved localrepo.getbundle and
localrepo.addchangegroupfiles to changegroup.py.  remotefilelog wraps these
functions, and thus needs to be updated.

Applyupdate also had a function signature change, which is fixed here.

Minor fix to a test as well, which had a hard coded time instead of a glob.

Test Plan: ./run-tests.py --with-hg=/data/users/durham/hg/hg

Reviewers: sid0, davidsp, pyd, dschleimer

Differential Revision: https://phabricator.fb.com/D1260737
2014-04-04 15:55:06 -07:00
Durham Goode
0237412d94 Fix shallow clones using getbundle protocol
Preivously shallow clones only work using the streaming clone protocol. With
this change they work for the standard getbundle protocol as well. This is what
the majority of Mercurial users use, so we need to support that.
2014-02-24 22:19:15 -08:00
Durham Goode
0301f9f129 Move local cache logic into it's own class
The current local cache is just files on disk, and this implementation detail
was spread across the extension. This change refactors it to hide the
implementation inside a class so that we can replace it with other
implementations (such as a sqlite local cache) later.
2014-02-11 16:25:55 -08:00
Durham Goode
bdea38dd56 Move fileservice to be per repo instead of global
Previously the file service client was a global object that all repos could
share. This was a bit hacky and is no longer needed. Now the file service
client exists per repo instance.

This is part of a series of changes to abstract the local caching and remote
file service in such a way that we can plug and play implementations.
2014-02-11 14:41:56 -08:00
Durham Goode
106035959b Add prefetch command to remotefilelog
Summary:
Adds a 'hg prefetch' command to remotefilelog for prepopulating the
local cache.  Supports specifying revsets and file patterns to limit what is
downloaded.

Test Plan: ./run-tests.py test-prefetch.t --with-hg=/data/users/durham/hg/hg

Reviewers: dschleimer, sid0, davidsp, pyd, mpm

CC: kunalb, minyoung

Differential Revision: https://phabricator.fb.com/D1129942
2014-01-15 13:41:29 -08:00
Durham Goode
393958c76b Allow naming repos
Enables specifying a name for a repo that is used in the cache key.
This allows multiple repos on a machine to share a cache without the
risk of keys overlapping.
2013-08-15 11:00:51 -07:00
Durham Goode
85e48b58fd Move server and debug logic into their own files
__init__.py was getting quite large. This change moves the server and debug
logic into their own files.  Client-side logic remains in __init__.py
2013-11-25 16:36:44 -08:00
Durham Goode
d9d4477013 Remove global variable for tracking shallow remotes
Previously we used a global variable to track if the incoming connection was
from a shallow remote (based on if the network command was a *_shallow command).
This is hacky and overall a bad idea. The new implementation stores the shallow
flag as a bundlecapability passed to the getbundle command.

A side effect of this is remotefilelog won't work with versions of mercurial
that don't use the getbundle command.
2013-11-25 14:22:56 -08:00
Durham Goode
e5f5e3244b Add more comments explaining various complexities 2013-11-05 17:19:59 -08:00
Durham Goode
18baf608df Remove unused time and traceback imports 2013-10-16 13:40:25 -07:00
Durham Goode
d122f76e5b Add readme and GPL info 2013-10-15 17:20:12 -07:00
Durham Goode
1275d15990 Add include and exclude configuration settings
The remotefilelog extension currently doesn't work with tags. Adding include and
exclude patterns allows users to specify which files they want to treat as
shallow and which the want to download the entire history for. By excluding
.hgtags from being shallow, this enables tags to work in a mostly shallow repo.

This also enables largefile like scenarios where most files are full and only a
few large ones are kept remote.
2013-09-26 10:46:06 -07:00
Durham Goode
3c6137f555 Fix revert prefetch causing excess output 2013-10-07 17:13:00 -07:00
Durham Goode
ab72a92e85 GC server cache and add GC tests 2013-10-02 16:21:48 -07:00
Durham Goode
be29ee042a Fix reverting from non-root directories 2013-10-02 09:45:52 -07:00
Durham Goode
335e1d1bfc Prefetch before revert 2013-09-17 11:24:31 -07:00
Durham Goode
2ccd88dfcd Support new mercurial _basesupported 2013-10-01 15:11:57 -07:00
Durham Goode
3667c253fd Refresh changelog during getfiles loop 2013-09-19 15:56:26 -07:00
Durham Goode
cf9d751d8a Add remotefilelog debug commands 2013-09-17 20:15:08 -07:00
Durham Goode
4ce55b8a0f Add log file warning 2013-09-11 10:27:56 -07:00
Durham Goode
c17ec690c9 Change cache key to use a two character prefix for directories.
Some file systems can't handle having a ton of files/directories inside a
directory, so this splits up all our files amongst directories.
2013-09-06 13:28:15 -07:00
Durham Goode
4a5c8d437d Fix hg diff when fnode is None 2013-09-03 11:39:16 -07:00
Durham Goode
5ec22c7093 Prevent verify from checking filelogs 2013-08-30 15:43:22 -07:00
Durham Goode
b685d98f57 Prefetch revisions before a diff 2013-08-30 11:27:09 -07:00
Durham Goode
3c879ed1a8 Enable efficient pulling between shallow repos 2013-08-28 18:51:01 -07:00
Durham Goode
f68d704603 Enable hg gc from outside a repo 2013-08-15 10:56:25 -07:00
Durham Goode
9642a8a2d6 Add remotefilelog.fallbackrepo config 2013-07-01 16:28:34 -07:00
Durham Goode
58ff8f91f6 Prefetch before copy tracing 2013-07-01 15:35:08 -07:00
Durham Goode
027a1d4ab8 Set umask before writing files to shared cache 2013-06-28 17:12:20 -07:00
Durham Goode
8e037436cb Add gc command for cleaning up the cache 2013-06-28 15:57:15 -07:00
Durham Goode
6e3494bf98 Add incoming hook for producing file blobs 2013-06-27 15:14:22 -07:00
Durham Goode
1ac9b8cbc1 Move requirement string to a variable 2013-06-26 14:37:59 -07:00
Durham Goode
3e6b7810df Override bundle10.generatefiles instead of prune 2013-06-25 13:26:24 -07:00
Durham Goode
6536d87bc0 Prevent pull from sending files to shallow clones 2013-06-23 13:50:22 -07:00
Durham Goode
84b481de56 Add option for server cache location.
Change _callstream wrapper to only run on client.
2013-06-21 13:22:18 -07:00
Durham Goode
f16a3a4134 Rename to remotefilelog since shallowrepo is already taken 2013-06-21 10:14:29 -07:00