Commit Graph

42267 Commits

Author SHA1 Message Date
Jun Wu
3ffbed2aea smartlog: do not query branch
`branch(.)` is not cheap since it builds the revbranchcache:

   66              \ branch (2 times)           revset.py:465
   48                \ wrapper (2 times)        localrepo.py:141
   48                 | revbranchcache (2 times) localrepo.py:959
   46                 | __init__                branchmap.py:354
   16                 | read (2 times)          vfs.py:78
   18                \ branchmap (2 times)      localrepo.py:953

Differential Revision: https://phab.mercurial-scm.org/D1466
2017-11-29 19:06:03 -08:00
Durham Goode
1e36d7670a repack: move repack lock into shared cache
Moving the lock into the shared cache will allow multiple copies of the same
repository to avoid starting repacks at the same time.

Differential Revision: https://phab.mercurial-scm.org/D1544
2017-11-29 14:57:10 -08:00
Durham Goode
7deafbdc67 repack: move to fcntllock based locking
Previously repack use the standard Mercurial symlink based locking mechanism.
This caused problems on our laptop users because the symlink locking relies on
the host name and sometimes their hostname changes due to weird IT issues, which
resulted in locks existing forever and repack never running. The symlink based
locking scheme was also a problem in chroots, where two processes in different
chroots may attempt to repack the same shared cache at the same time.

Switching to a fcntllock based scheme will solve these issues.

Differential Revision: https://phab.mercurial-scm.org/D1543
2017-11-29 14:57:10 -08:00
Adam Simpkins
18975bdc14 treemanifest: fail gracefully in prefetch if no remote is configured
Summary:
If no remote path is configured raise an Abort exception, rather than returning
the path as None and crashing later on with an unfriendly exception due to
trying to use None as a string.

Test Plan: Updated test-treemanifest-prefetch.t to exercise this code.

Reviewers: singhsrb, durham, #fbhgext

Reviewed By: durham, #fbhgext

Differential Revision: https://phab.mercurial-scm.org/D1541
2017-11-29 12:19:18 -08:00
Adam Simpkins
f5adf3a41f treemanifest: expose prefetchtrees() publicly
Summary:
Rename `_prefetchtrees()` to `prefetchtrees()`.  Also change it to throw a
new `MissingNodesError()` exception type when it fails to download some nodes.
This makes it possible for callers to easily distinguish missing nodes from
other unexpected errors.

Test Plan:
Confirmed the existing unit tests pass.  test-treemanifest-infinitepush.t
exercises the MissingNodesError code path.

Reviewers: #fbhgext, durham

Reviewed By: #fbhgext, durham

Subscribers: singhsrb

Differential Revision: https://phab.mercurial-scm.org/D1421
2017-11-29 12:19:18 -08:00
Adam Simpkins
b6b5e38199 pushrebase: report details about public commits being pushed
Summary:
When failing due to attempting to rebase already-public commits, include the
public commit node IDs in the error message.

Test Plan: Included new tests.

Reviewers: durham, quark, #fbhgext

Reviewed By: durham, quark, #fbhgext

Differential Revision: https://phab.mercurial-scm.org/D1496
2017-11-28 20:10:46 -08:00
Wojciech Lis
318bf4aa4a remotefilelog: make sure metacache is always initalized
This adds initialization of metacache in remaining place where it can be uninitalized when using threads
The previous state did fail on some hg update operations on Windows. It didn't
affect posix as that doesn't actually use threads so we always have metacache
initalized from the constructor

Test Plan:
Run hg update that failed wihtout this change on windows and see it
suceed.
run tests on CentOS

Differential Revision: https://phab.mercurial-scm.org/D1539
2017-11-28 17:46:03 -08:00
Augie Fackler
bdaa8cfe88 setup: fix globbing on windows so modules get detected
Differential Revision: https://phab.mercurial-scm.org/D1535
2017-11-28 17:57:34 -05:00
Mark Thomas
55f8d37a82 perftweaks: access inner map for dirstate types other than treedirstate
D1410 added support for treedirstate when collecting dirstate_size for
sampling.  However, it also changed from querying the inner dirstate map (which
is not available with treedirstate) to the outer map.  This breaks Eden, which
prevents calls to `__len__` on the outer map.

Revert the change for non-treedirstate dirstates, and handle treedirstate
explicitly.

Differential Revision: https://phab.mercurial-scm.org/D1530
2017-11-28 09:27:25 -08:00
Mark Thomas
4bce5b2bbc treedirstate: prevent interference with other dirstate implementations
To avoid problems when other dirstate implementations are in use (sqldirstate
or eden), prevent upgrade of repos with those implementations active to
treedirstate.

Automatic upgrades are silently prevented.  Attempts to manually upgrade fail
with an explanatory message.

Differential Revision: https://phab.mercurial-scm.org/D1528
2017-11-28 04:51:38 -08:00
Mark Thomas
567afadaf1 treedirstate: de-genericize Dirstate
Remove the type parameter from Dirstate.  It's not necessary, and complicates
the implementation.

Differential Revision: https://phab.mercurial-scm.org/D1512
2017-11-28 04:51:38 -08:00
Mark Thomas
2328feb895 treedirstate: extract serialization methods to separate module
The serialization and deserialization of the treedirstate tree file is
scattered across various functions in several files.  Gather these together in
a single module so that the file format is obvious.

Differential Revision: https://phab.mercurial-scm.org/D1510
2017-11-28 04:51:38 -08:00
Mark Thomas
33855b35cc treedirstate: add integration tests
Copy the dirstate tests from core Mercurial, but run them with treedirstate
instead of the default dirstate map.

Add an extra test that covers scenarios specific to treedirstate.

Differential Revision: https://phab.mercurial-scm.org/D1490
2017-11-28 04:51:38 -08:00
Mark Thomas
badc398619 treedirstate: add configuration options
Add configuration options to control upgrading, downgrading and repacking of
treedirstate.

Differential Revision: https://phab.mercurial-scm.org/D1434
2017-11-28 04:51:38 -08:00
Mark Thomas
faadc08f74 setup: build treedirstate and rusttreedirstate packages
The treedirstate and rusttreedirstate packages are only built if a suitable
version of Cargo is available.

Differential Revision: https://phab.mercurial-scm.org/D1412
2017-11-28 04:51:38 -08:00
Mark Thomas
7861cdf6e2 distutils_rust: add distutils extension to compile Rust extension modules
Differential Revision: https://phab.mercurial-scm.org/D1411
2017-11-28 04:51:38 -08:00
Mark Thomas
bf8616188d perftweaks: support treedirstate maps
Treedirstate maps won't have an inner _map, so will never be logged by
perftweaks.  The maps have an efficient size lookup, so it's OK to always
obtain their size.

Differential Revision: https://phab.mercurial-scm.org/D1410
2017-11-28 04:51:38 -08:00
Mark Thomas
6f77bc33b9 treedirstate: implement casefolding maps for case insensitive filesystems
The dirfoldmap and filefoldmap on the dirstatemap object map from normalized
filename to the form it appears in the dirstate (denormalized form).

The dicts these functions return are also modified by the dirstate with
filenames discovered by examining the disk, so use an overlay dictionary backed
by the real dirstate to allow this to happen.

Differential Revision: https://phab.mercurial-scm.org/D1409
2017-11-28 04:51:38 -08:00
Mark Thomas
26e77a0173 treedirstate: use vlqencoding for numbers
Change to use VLQ-encoded numbers for everything in the tree file.  Block sizes
remain as u32s so that they can be read by the store in a single read
operation, but everything else is a VLQ as it is generally smaller and more
futureproof.

Differential Revision: https://phab.mercurial-scm.org/D1408
2017-11-28 04:51:38 -08:00
Mark Thomas
dc03a8d3da treedirstate: auto-repack treedirstate once it reaches 3x its original size
Differential Revision: https://phab.mercurial-scm.org/D1407
2017-11-28 04:51:38 -08:00
Mark Thomas
9fc8a5ecf5 treedirstate: implement efficient case collision detection
Add a mechanism to the dirstate trees to allow lookups based on filtered views
of the keys.  For a given filtering function, this returns one (if any) of the
keys for which filter(key) matches the input.  The filtered values in each
directory node are cached to improve subsequent lookups.

Differential Revision: https://phab.mercurial-scm.org/D1406
2017-11-28 04:51:38 -08:00
Mark Thomas
437cacd205 treedirstate: allow absent non-normal sets
If the non-normal sets get particularly large, the dirstate root file can get
large again.  Avoid this happening by not storing large sets, and instead
recalculating them on-demand as needed.  Large sets of non-normal files should
be rare, so this shouldn't be a performance hit in the normal case.

Differential Revision: https://phab.mercurial-scm.org/D1405
2017-11-28 04:51:38 -08:00
Mark Thomas
d0a2fc313b treedirstate: clear ambiguous times when writing the dirstate
When writing out changes to the dirstate, mark any files that have the same
mtime as the current time as requiring lookup.  This matches the behaviour
of the C-based pack_dirstate.

Differential Revision: https://phab.mercurial-scm.org/D1404
2017-11-28 04:51:38 -08:00
Mark Thomas
842e5de551 treedirstate: better iteration using visitor pattern
In order to allow the python interface code to perform actions on each node in
the tree without creating python-specific interfaces in the generic Rust code,
add a method of iterating over the tree, executing a closure at each file.

Use this to implement the methods that give iterators over the filenames in the
tree.  This performs better than the get_first/get_next-style iterators.

Differential Revision: https://phab.mercurial-scm.org/D1403
2017-11-28 04:51:38 -08:00
Mark Thomas
71fa542789 treedirstate: cache dirstate data when iterating all files
Iterations over all files will cause most of the file to be read in a piecemeal
fashion.  This will be inefficient on disks with slow seek times.   Instead,
read the whole file into memory before iterating.

Differential Revision: https://phab.mercurial-scm.org/D1402
2017-11-28 04:51:38 -08:00
Mark Thomas
92b2ce7563 treedirstate: add Python linkage
Adds a python module that uses the Rust treedirstate to replace the dirstate
map.

Differential Revision: https://phab.mercurial-scm.org/D1401
2017-11-28 04:51:38 -08:00
Mark Thomas
b0b8543136 treedirstate: add Dirstate
A Dirstate object links a Tree to an underlying Store and StoreView
implementation.

Differential Revision: https://phab.mercurial-scm.org/D1400
2017-11-28 04:51:38 -08:00
Mark Thomas
7bc6c8d231 treedirstate: add Tree
Adds Tree, an implementation of a dirstate tree.

Differential Revision: https://phab.mercurial-scm.org/D1399
2017-11-28 04:51:38 -08:00
Mark Thomas
5294b5f050 treedirstate: add FileStore
Adds FileStore, an implementation of the Store and StoreView traits that uses a
file on disk to store the data, and reads and writes blocks using file I/O.

Differential Revision: https://phab.mercurial-scm.org/D1398
2017-11-28 04:51:38 -08:00
Mark Thomas
1537d3833e treedirstate: add Store and StoreView traits
These traits represent abstract store objects than can store arbitrary data
blocks with store-generated indexes.

A NullStore implementation is provided which acts an always-empty StoreView.

Differential Revision: https://phab.mercurial-scm.org/D1397
2017-11-28 04:51:38 -08:00
Mark Thomas
5931d6cf5d treedirstate: add vecmap implementation
This adds an implementation of an ordered map that uses a vector pairs, sorted
by the key.

This is largely compatibly with std::collections::BTreeMap, but has performance
characteristics more suited for use in treedirstate.

Differential Revision: https://phab.mercurial-scm.org/D1396
2017-11-28 04:51:38 -08:00
Mark Thomas
21b68a9e17 treedirstate: create empty Rust project
Create an empty Rust project for treedirstate.  This will be a
re-implementation of the dirstate map using a tree structure, where nodes in
the tree are directories, and leaves are files.

Differential Revision: https://phab.mercurial-scm.org/D1395
2017-11-28 04:51:38 -08:00
Mark Thomas
f2610526b0 tests: update githelp test
The githelp for apply was updated in D1522.  Update the tests to match.

Differential Revision: https://phab.mercurial-scm.org/D1529
2017-11-28 04:50:17 -08:00
Durham Goode
fce353c28d fastannotate: pass commitctx to filectx to prevent tree downloads
Previously fastannotate was creating filectx's by doing commitctx[path]. This
invokes logic that resovles the filenode immediately, which require loading the
manifest for that commit. In a repo where manifests are downloaded lazily, this
can result in a lot of time spent downloading manifests.

Since commands like hg blame -u only need the filectx so they can resolve the
commitctx for commit information, let's just pass the commitctx straight to the
filectx. It can later derive the filenode if it needs to.

Differential Revision: https://phab.mercurial-scm.org/D1488
2017-11-27 16:33:50 -08:00
Durham Goode
4467b77ca1 remotefilelog: avoid _fileid in remotefilelogctx
_fileid is only set in some cases. We should access the file node through
_filenode instead, which can compute the node from either the _fileid or the
_changeid. This will be useful in a future diff where we construct
remotefilelogctx with just a path and a commit hash, and not a file id.
2017-11-27 16:33:50 -08:00
Boris Feld
cf4679a55d debuginstall: add a line about re2 availability
Using re2 engine can massively speed up regexp. We make it simpler to check if
it is available in a given install.
2017-11-27 18:48:36 -05:00
Matt Harbison
17e2258c44 tests: fix the check-code rule for testing non-existent files
I missed this in d3e2086bc411.
2017-12-16 12:34:40 -05:00
Matt Harbison
44a151c9d6 tests: convert the 'file://\$TESTTMP' rule to an automatic substitution
The rule only triggered on non Windows platforms, even though Windows also
required an adjustment.  Automatic seems better.

The aggressive globbing in test-subrepo-svn.t was found and rewritten by the
substitution.
2017-12-16 11:32:10 -05:00
Durham Goode
5559c988d5 lock: remove lock order file
Summary:
This is way more common than we thought, and these files aren't actually useful
at the moment. Let's drop them so they don't pollute the filesystem.

Test Plan: Ran the tests

Reviewers: quark, #mercurial

Reviewed By: quark

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

Signature: 6420066:1511826415:386036ddbded31fed7892cdce48b9b38f535e915
2017-11-27 15:47:03 -08:00
Wojciech Lis
4a6289577f remotefilelog: keep metacache per thread
This fixes the race condition in remotefilelog surfaced by
https://phab.mercurial-scm.org/D1458. The issue was that the remotefilelog
contentstore had 1 object for caching metadata of a file which could be
ovewriten by other threads, resulting in trying to
deserialize a textfile as lfs.

This adds per thread cachefor metadata

Test Plan:
on CentOS ran rt in fb-hgext and all were sucessful

on Windows ran 500 iterations of sparse --enable-profile / --disable-profile with 43k files
profile without hitting any issues. This was >30 hours of continuous excercise
for this code.

Differential Revision: https://phab.mercurial-scm.org/D1513
2017-11-27 14:42:16 -08:00
Piotr Gabryjeluk
8d1350eab9 githelp: update suggestion for apply
Current:

$ hg githelp apply abc.diff
hg import abc.diff

Expected:

$ hg githelp apply abc.diff
hg import --no-commit abc.diff

git apply doesn't commit the applied diff, hg import (without the flag) does.

Differential Revision: https://phab.mercurial-scm.org/D1522
2017-11-27 11:40:57 -08:00
Durham Goode
bd4a9549cb treemanifest: automatically backfill missing manifests during hg pull
Previously, if a repo went from treeonly to not treeonly, the user had to run a
command to backfill the missing flat manifests. This patch makes it happen
automatically as part of hg pull.

Differential Revision: https://phab.mercurial-scm.org/D1485
2017-11-27 09:22:06 -08:00
Hollis Blanchard
f2c455130c p4fastimport: only disable LFS uploads if p4fastimport.lfsmetadata is set
Currently, normal LFS uploads are completely disabled during a p4fastimport,
and users must run an external SQLite-reading uploader app after the import.

Instead, allow normal LFS functionality to work, but users may override it to
do the SQLite thing.

Differential Revision: https://phab.mercurial-scm.org/D1307
2017-11-27 03:34:35 -08:00
Hollis Blanchard
4937529d4c tests: split p4fastimport-import-lfs.t into normal LFS vs SQLite
p4fastimport has the ability to bypass the normal LFS upload mechanisms, and
that's what the original testcase actually tested.

We also want to ensure that normal LFS works with p4fastimport too, so we need
a testcase for that.

Differential Revision: https://phab.mercurial-scm.org/D1306
2017-11-27 03:34:35 -08:00
Thomas Jacob
35c42f65ae fbamend: allow general rev for --to, fix aborts
Summary:
Didn't work when --to wasn't specified as a 12 char
short hash, and since no errors were raised
due to the missing "raise" before error.abort
also effectively deleted changes in the working copy.

Now should work with anything repo[input] accepts
as a valid commit.

Also checks for predicatable error conditions before
the repo is modified to avoid changing working copy
on error.

Test Plan: TBD

Reviewers: #sourcecontrol

Subscribers: #sourcecontrol

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

Tasks: T22281996
2017-11-25 09:19:09 -08:00
Mark Thomas
107956c510 merge: check created file dirs for path conflicts only once (issue5716)
In large repositories, updates involving the creation of many files check the
same directories repeatedly in the wctx manifest.  Move these checks out to a
separate loop to avoid repeated checks hitting the manifest.

Differential Revision: https://phab.mercurial-scm.org/D1226
2017-11-24 12:53:58 -08:00
Mark Thomas
2f4962c2a4 merge: cache unknown dir checks (issue5716)
As mentioned in D1222, the recent pathconflicts change regresses update
performance in large repositories when many files are being updated.

To mitigate this, we introduce two caches of directories that have
already found to be either:

  - unknown directories, but which are not aliased by files and
    so don't need to be checked if they are files again; and

  - missing directores, which cannot cause path conflicts, and
    cannot contain a file that causes a path conflict.

When checking the paths of a file, testing against this caches means we can
skip tests that involve touching the filesystem.

Differential Revision: https://phab.mercurial-scm.org/D1224
2017-11-24 12:53:58 -08:00
Mark Thomas
e40329b294 clindex: add prebuilt cython file
The build currently fails on systems without Cython.  Add a prebuilt cython
file for clindex to allow builds on those systems.

Differential Revision: https://phab.mercurial-scm.org/D1504
2017-11-24 02:20:54 -08:00
Jun Wu
ec352026f4 perftweaks: add missing imports
This unblocks the branchcache issue.
2017-11-23 11:39:46 -08:00
Jun Wu
1b97b622fb Backed out D1451 and D1495
In `branchmap.updatecache`, there is an assertion:

    assert partial.validfor(repo)

That will break if `partial` (branchcache) does not have correct tiprev or
tipnode.

The long term fix will be probably reviving D1450.
2017-11-23 10:46:31 -08:00