Commit Graph

1236 Commits

Author SHA1 Message Date
Alden Hu
64b98944d1 git-sl supports worktrees
Summary:
git started printing a "+" sign in front of a branch checked out in another worktree:
ab3138146f

and it breaks "git sl"

removing "+" the same way as "*" when parsing "git branch" result to resolve.

Reviewed By: krallin

Differential Revision: D20793452

fbshipit-source-id: 5c0b6be5afbed607b144c652f68a3ab93052f76a
2020-04-01 09:25:27 -07:00
Mark Thomas
0d4db87a26 cmdutil: add a hint for the new graph renderer
Summary: Add a hint that points to customization and troubleshooting guides for the new graph renderer.

Reviewed By: xavierd

Differential Revision: D20763338

fbshipit-source-id: ee6d2464ae5955f0f0bf52d1994adfa2b74b3367
2020-03-31 09:57:44 -07:00
Xavier Deguillard
2ce3c6784b revisionstore: make ContentStore::sha256 infallible
Summary:
Instead of using Sha256::from_slice, just use Sha256::from with a correctly
sized array.

Reviewed By: quark-zju

Differential Revision: D20756181

fbshipit-source-id: 17c869325025078e4c91a564fc57ac1d9345dd15
2020-03-31 08:12:45 -07:00
Adam Simpkins
b31c991c00 update the hg status fast-path to print errors reported by EdenFS
Summary:
Update `hg status` to print errors that were returned by EdenFS's
getScmStatusV2() call, and to exit unsuccessfully if there were any errors.

Previously errors were silently ignored.

Reviewed By: quark-zju

Differential Revision: D19958503

fbshipit-source-id: cb3109df40eb86a5bf7e3818ddfb8da74d670405
2020-03-30 19:24:22 -07:00
Adam Simpkins
ba42390257 fix hg status path relativization in tests on Windows
Summary:
Fix the `test_status()` function to properly canonicalize the input paths, so
that it works successfully on Windows.  Previously this function would fail on
Windows as some paths would end up as UNC-style paths and some would be plain
paths, causing the equality comparison to fail even though the paths were
equivalent.  This canonicalizes the repo path so that they both use the same
format.

Reviewed By: quark-zju

Differential Revision: D20662921

fbshipit-source-id: fdd36bac755f9694b4a482615d3dca43ff21e05e
2020-03-30 19:24:22 -07:00
Xavier Deguillard
22f524664e revisionstore: use Arc<Self> as receiver for remote store traits
Summary:
All of the callers are already using an Arc, so instead of forcing the remote
store to be cloneable, and thus wrap an inner self with an Arc, let's just pass
self as an Arc.

Reviewed By: DurhamG

Differential Revision: D20715580

fbshipit-source-id: 1bef23ae7da7b314d99cb3436a94d04134f1c0e4
2020-03-30 14:45:49 -07:00
Xavier Deguillard
6b1940f294 revisionstore: add fallback if LFS server is down
Summary:
When LFS will be enabled on fbsource, the enablement will rolled out server,
with the server serving pointers (or not). In the catastrophic scenario where
Mononoke has to be rolled out, the Mononoke LFS server will be unable to serve
blobs, but some clients may still have LFS pointers locally but not the
corresponding blob. For this, we need to be able to fallback to fetching the
blob via the getpackv2 protocol.

Reviewed By: DurhamG

Differential Revision: D20662667

fbshipit-source-id: 4ac45558f6d205cbd1db33c21c6fb137a81bdbd5
2020-03-30 14:45:48 -07:00
Xavier Deguillard
e7b5eb81d9 remotefilelog: add lfs fetching retry logic
Summary:
The LFS server might be temporarily having issues, let's retry a bit before
giving up.

Reviewed By: DurhamG

Differential Revision: D20686659

fbshipit-source-id: 90dabd19e45a681d6eae5cd50c72b635d44c0517
2020-03-30 14:45:48 -07:00
Xavier Deguillard
f06132def2 configparser: add FromConfigValue for floats
Summary:
Since we have all the integer types, let's also allow float types in the
config.

Reviewed By: kulshrax

Differential Revision: D20697007

fbshipit-source-id: 21fa264d24c0f63c233f47c3bcfb2448b4c05c70
2020-03-30 14:45:48 -07:00
Xavier Deguillard
0f3c04abfe remotefilelog: add a remotefilelog LFS test
Summary:
This demonstrates that both the legacy extension and the new implementation can
co-exist, and we can enable/disable the new extension.

Reviewed By: DurhamG

Differential Revision: D20677443

fbshipit-source-id: 10896023f536984645371d557c3ad20daa8526dd
2020-03-30 14:45:47 -07:00
Xavier Deguillard
15c81cd54f revisionstore: repack even when having one packfile
Summary:
When repacking for the purpose of file format changes, a single packfile may
contain data that needs to be moved out of it, and thus, we need to do a repack
then.

Reviewed By: DurhamG

Differential Revision: D20677442

fbshipit-source-id: c621dd2e657f5a4565b37d4b029731415b899117
2020-03-30 14:45:47 -07:00
Xavier Deguillard
e0cfd08e7f revisionstore: properly implement get_missing for remote stores
Summary:
Remotestores can implement get_missing properly by simply querying the
underlying store that they will be writing to. This may prevent double fetching
some blobs in `hg prefetch` that we already have.

Reviewed By: DurhamG

Differential Revision: D20662668

fbshipit-source-id: 22140b5b7200c687e0ec723dd8879dc8fbea6fb9
2020-03-30 14:45:47 -07:00
Xavier Deguillard
e1ccc29eec revisionstore: add an is_local method to the IndexedLog abstraction
Summary:
There are cases where the user of the abstraction needs to know if this is a
local store, this will simplify the caller code.

Reviewed By: DurhamG

Differential Revision: D20662666

fbshipit-source-id: e0bde7eb0dc3484979732a7c4cdf888fedc70e13
2020-03-30 14:45:46 -07:00
Xavier Deguillard
8ed454845a revisionstore: auto-sync the LFS blobs store
Summary:
By regularly flushing the blob store, we avoid keeping too many LFS blobs in
memory, which could cause OOM issues.

The default size is chosen to be 1GB, but is configurable for more control.

Reviewed By: DurhamG

Differential Revision: D20646213

fbshipit-source-id: 12c06fd0212ef3974bea10c82026b6e74fb5bf21
2020-03-30 14:45:46 -07:00
Xavier Deguillard
5ea2e581c6 revisionstore: store LFS blobs in an IndexedLog
Summary:
In the legacy lfs extension, LFS blobs were stored as loosefiles on disk, and
as we saw with loosefiles for remotefilelog, they can incur a significant
overhead to maintain. Due to LFS blobs being large by definition, the number of
loose LFS blobs should be reasonable for repack to walk over all of them to
chose which one to throw away.

A different approach would be to simply store the blobs in an on-disk format
that allows automatic size management, and simple indexing. That format is an
IndexedLog. This of course doesn't come without drawbacks, the main one being
that the IndexedLog API mandate that the full blob is present on insertion,
preventing streaming writes to it, the solution is to simply chunk the blobs
before writing them to it. While proper streaming is not done just yet, the
storage format no longer prevent it from being implemented.

Reviewed By: DurhamG

Differential Revision: D20633783

fbshipit-source-id: 37a88331e747cf22511aa348da2d30edfa481a60
2020-03-30 14:45:46 -07:00
Arun Kulshreshtha
91e76774fe edenapi: fix typo in logging
Reviewed By: sfilipco

Differential Revision: D20744831

fbshipit-source-id: 194e550d88c33ed9601d2f24fea281996696087b
2020-03-30 14:39:42 -07:00
Jun Wu
6bddc1df08 rotatelog: avoid loading broken Logs multiple times
Summary:
RotateLog loads older logs lazily. If an older log is broken, remember that and avoid
loading the broken log again.

Reviewed By: DurhamG

Differential Revision: D20663899

fbshipit-source-id: 7a4b5279cc6387c19329a51048bfe1be2e0bc1f8
2020-03-30 11:34:49 -07:00
Thomas Orozco
250695ba9b rage: disable colors
Summary:
This updates hg rage to disable colors while producing the hg rage. This makes
the pastes a little more readable since they won't contain escape codes.

Reviewed By: farnz

Differential Revision: D20738945

fbshipit-source-id: e323834beb6458083642e34a40afa3d896288b42
2020-03-30 11:31:33 -07:00
Xavier Deguillard
2c052d055d eden: commitpending doesn't exist in ContentStore
Summary:
Instead, it's present in the fileslog. Use that instead.

This is the error I just got while doing a `hg top`:
error updating fbcode/eden/scm/lib/revisionstore/src/contentstore.rs: facebook::eden::HgImportPyError: AttributeError: 'bindings.revisionstore.contentstore' object has no attribute 'commitpending'

Reviewed By: quark-zju

Differential Revision: D20715560

fbshipit-source-id: 59c4b62ae8d0f182824e126e68b174c0ef3cdba0
2020-03-30 09:05:36 -07:00
Xavier Deguillard
fd72344578 revisionstore: feature gate the Mononoke LFS tests
Summary:
Due to the Mononoke LFS server only being available on FB's network, the tests
using them cannot run outside of FB, including in the github workflows.

Reviewed By: quark-zju

Differential Revision: D20698062

fbshipit-source-id: f780c35665cf8dc314d1f20a637ed615705fd6cf
2020-03-30 08:40:43 -07:00
Stefan Filip
ea89b541e1 segmented_changelog: add Dag struct and location_to_name functionality
Summary:
The IdDag provides graph algorithms using Segments.
The IdMap allows converting from the SegmentedChangelogId domain to the
ChangesetId domain.
The Dag struct wraps IdDag and IdMap in order to provide graph algorithms using
the common application level identifiers for commits (ChangesetId).

The construction of the Dag is currently mocked with something that can only be
used in a test environment (unit tests but also integration tests).

This diff also implements a location_to_name function. This is the most
important new functionality that segmented changelog clients require. It
recovers the hash of a commit for which the client only has a segmented
changelog Id. The current assumption is that clients have identifiers for all
merge commit parents so the path to a known commit always follow a set
of first parents.

The IdMap queries will have to be changed to async in the future, but IdDag
queries we expect to stay sync.

Reviewed By: quark-zju

Differential Revision: D20635577

fbshipit-source-id: 4f9bd8dd4a5bd9b0de55f51086f3434ff507963c
2020-03-27 13:48:52 -07:00
Stefan Filip
7502ce31ca dag: add in process stored IdMap constructor
Summary: The interesting observation is that InProcessStore is not public.

Reviewed By: quark-zju

Differential Revision: D20635578

fbshipit-source-id: a0149929c8059ff77f047fd385bf3b26dc738dfd
2020-03-27 13:48:51 -07:00
Jun Wu
9fe0bfd7c8 narrowheads: fix directaccess compatibility
Summary:
Similar to the previous diff.  Sometimes the narrow-heads config is on but the
dependencies are off (ex. remotenames, visibility). In that case narrow-heads
should be considered off. The repo init function takes care of that but code
paths before repo init needs special care.

Reviewed By: simpkins

Differential Revision: D20699684

fbshipit-source-id: befac335bde0be6b8a42a5a9f7cee1edbbef3c55
2020-03-27 12:55:07 -07:00
Jun Wu
ebdc3836b9 narrowheads: fix repo requirements at "hg init" time
Summary:
Some tests fail because `hg init` sets the wrong initial store requirements and
then perform a narrow-head migration down, which prints extra messages. Fix them
by making sure the initial store requirements are the same as what the migration
code path expects.

Reviewed By: simpkins

Differential Revision: D20698637

fbshipit-source-id: 1422a4ea78222617d0e3f9631ad883d5a3fe6bb7
2020-03-27 12:55:06 -07:00
Lukas Piatkowski
bace9bc0ae mononoke: make filenode and mercurial_types OSS buildable
Reviewed By: farnz

Differential Revision: D20281345

fbshipit-source-id: bc4910d3040d74c7ceb4cb825bea6960952f6310
2020-03-27 11:40:13 -07:00
Xavier Deguillard
179caf60dd revisionstore: pass the config when building the LFS stores
Summary: Instead of hardcoding some values, use configured ones.

Reviewed By: DurhamG

Differential Revision: D20633784

fbshipit-source-id: d17657b1fca29280f2d07e8cf824e553ad3704f7
2020-03-26 19:02:49 -07:00
Xavier Deguillard
d404b0a228 revisionstore: revamp repack to ease file format migration
Summary:
One of the main drawback of the current version of repack is that it writes
back the data to a packfile, making it hard to change file format. Currently, 2
file format changes are ongoing: moving away from packfiles entirely, and
moving from having LFS pointers stored in the packfiles, to a separate storage.

While an ad-hoc solution could be designed for this purpose, repack can
fullfill this goal easily by simply writing to the ContentStore, the
configuration of the ContentStore will then decide where this data will
be written into.

The main drawback of this code is the unfortunate added duplication of code.
I'm sure there is a way to avoid it by having new traits, I decided against it
for now from a code readability point of view.

Reviewed By: DurhamG

Differential Revision: D20567118

fbshipit-source-id: d67282dae31db93739e50f8cc64f9ecce92d2d30
2020-03-26 19:02:48 -07:00
Xavier Deguillard
cf650d232a remotefilelog: remove unnecessary argument to the Rust repacks
Summary: There is no need to pass the path twice, once is enough.

Reviewed By: DurhamG

Differential Revision: D20567117

fbshipit-source-id: 169a088aa7558b4c25f8fbdecfe59bdd0d7575ef
2020-03-26 19:02:48 -07:00
Xavier Deguillard
d4780ee322 revisionstore: store a HashMap of ContentHash in LFS pointer
Summary:
While the primary (for now) way of addressing an LFS blob is via its sha256,
being able to address them via different hash schemes (sha1 for Eden/Buck,
blake2, etc) will be helpful down the line. Thus, let's store a HashMap of
ContentHash in the pointer store.

Reviewed By: DurhamG

Differential Revision: D20560197

fbshipit-source-id: 8bdc4fc4cd7fc19c7eed6a27d11953c4eedf9195
2020-03-26 19:02:47 -07:00
Xavier Deguillard
04a09ec571 remotefilelog: adapt tests for remotefilelog to support LFS
Summary:
The hgcache will soon contain an LFS subdirectory, this is uninteresting for
most of the tests, let's change them a bit so they only look at the packs
subdirectory.

With this, enabling remotefilelog.useruststore only has 2 failures. One due a
difference in handling corrupt data, with the ruststore being more explicit
that some data is missing instead of a generic "stream ended unexpectedly". And
the other due to some ordering difference when dealing with LFS data. The
latter will go away with the new LFS implementation.

Reviewed By: DurhamG

Differential Revision: D20543146

fbshipit-source-id: 09c76cacfb4687fd699b82cdf5057665ac6bd521
2020-03-26 19:02:47 -07:00
Xavier Deguillard
2f314fc43c revisionstore: remove unnecessary lock around the LfsBlobsStore
Summary: No locking is required for this one due to being loose files on disk.

Reviewed By: DurhamG

Differential Revision: D20522890

fbshipit-source-id: 72b7ebc063060a89f54976a1128977a3b7501053
2020-03-26 19:02:47 -07:00
Jun Wu
8bd55436a4 pull: automatically pull selective bookmarks unless it's a no-argument pull
Summary:
This enforces certain selective pull logic in core. Namely, rewrite `pull -r X`
to `pull -r X -B master`.

Unlike selectivepull in remotenames, `pull` (pulls everything) won't be
rewritten to `pull -B master` (which pulls less commits and names).

Therefore this change always adds more commits to pull, and therefore should not
break existing users. Eventually we want the "not pulling everything" behavior,
but right now this just fixes `pull -r X` to also update important remote names.

Reviewed By: markbt

Differential Revision: D20531121

fbshipit-source-id: af457b5ddb1265b61956eb2ee6afb7b7208293e0
2020-03-26 10:54:09 -07:00
Jun Wu
e105af5a54 exchange: replace remotenames.important-names with selectivepull names
Summary: Now we have functions to get selectivepull names in core. Use that instead.

Reviewed By: markbt

Differential Revision: D20531118

fbshipit-source-id: a0c20c491baf1b0ad71e80f870703bb4b983f19c
2020-03-26 08:26:27 -07:00
Jun Wu
c7549d5b71 remotenames: move selective pull bookmarks calculation to core
Summary: This makes it possible for core to always pull related bookmarks.

Reviewed By: markbt

Differential Revision: D20531120

fbshipit-source-id: 52f0834b517e03567e240f57616370d79a227abe
2020-03-26 08:26:27 -07:00
Jun Wu
baae0138ff remotenames: move revset and templatekw to core
Summary:
This makes it possible to use template like `{remotenames}` or revset like
`remotenames()` without enabling the remotename extension.

Rarely used revsets like `upstream()` and `pushed()` are not moved.

Reviewed By: markbt

Differential Revision: D20529360

fbshipit-source-id: ea95b3324f974e112909cdd79ce662940a4f9b7c
2020-03-26 08:26:26 -07:00
Jun Wu
cc1b1bd6a9 remotenames: move namespace to core
Summary:
This makes it possible to resolve remotenames without enabling the remotenames
extension.

The config check `if repo.ui.configbool("remotenames", "bookmarks")` is dropped
intentionally as we only use remotenames for bookmarks, not named branches.

Since this only enables resolving more names, without disabling or changing
other features, and the remotename namespace priority is lower than local
bookmarks (ex. if a local `master` exists, then `master` will be using the
local bookmark, not the hoisted remote name), it should not cause breaking
changes.

Reviewed By: markbt

Differential Revision: D20529359

fbshipit-source-id: 4126faee1bb7f43ba547fab05dd6197b2e65c1fc
2020-03-26 08:26:26 -07:00
Jun Wu
a94f29c65a remotenames: move repo._remotenames to core
Summary:
This moves part of remotenames that provides the `repo._remotenames` object to
core.  It should not change behaviors but merely makes `repo._remotenames`
available in core.

Reviewed By: markbt

Differential Revision: D20529358

fbshipit-source-id: 11c8538a0190101b09a4cb082018e73643a257e2
2020-03-26 08:26:26 -07:00
Xavier Deguillard
16f09d25a3 pyworker: add a retry backchannel to Python
Summary:
While failures in the Rust updater aren't expected, at least one valid case
requires requires retrying the operation in Python: old-style LFS pointers.
When these are stored in packfiles/indexedlog, only the Python code knows how
to deal with them, and thus the operation needs to be retried there.

Reviewed By: DurhamG

Differential Revision: D20603709

fbshipit-source-id: 7d24ba573f0ff540906d909f1b4440fd4d3469a6
2020-03-25 12:29:26 -07:00
Xavier Deguillard
226a30236b pyworker: do not try to write LFS pointers to the working copy
Summary:
The ContentStore cannot deserialize LFS pointers stored in packfiles, to avoid
potential damage, let's refuse to update LFS blobs. A proper solution will be
built in a separate diff.

Reviewed By: DurhamG

Differential Revision: D20576575

fbshipit-source-id: 4e4ce6a9432157e2ce69881c0079e943ea3f3acd
2020-03-25 12:29:26 -07:00
Xavier Deguillard
6372a4a4fc revisionstore: add an is_lfs method to Metadata
Summary:
Instead of having the magic number 0x2000 all over the place, let's move the
logic to this method.

Reviewed By: DurhamG

Differential Revision: D20637749

fbshipit-source-id: bf666f8787e37e6d6c58ad8982a5679b7e3e717b
2020-03-25 12:29:25 -07:00
Xavier Deguillard
7a8653cb2e pyworker: integrate with fsinfo
Summary:
On Unix, pretend that NTFS doesn't support symlinks. While this isn't
technically true, NTFS on Linux is only used to alleviate performance issues
with `hg update` on Windows. With the pyworker code, I'm expecting these
performance issues to disappear allowing this code to be removed.

Reviewed By: ikostia

Differential Revision: D20527976

fbshipit-source-id: 4194f4b5af065de2e293b41b9d03e9d4ab6ea006
2020-03-25 12:29:25 -07:00
Xavier Deguillard
fbff2aaf7c pyworker: refactor the update/remove functions
Summary:
Move them into a VFS struct, a future step will move the VFS code into its own
crate.

Reviewed By: DurhamG

Differential Revision: D20527977

fbshipit-source-id: 3250b05840688db72e1c43c72ec6defbc7f20851
2020-03-25 12:29:25 -07:00
Durham Goode
c9c381a744 extras: force commit extras to be type str
Summary:
When we deserialize commit extras they come out as a str->str dict, so
let's make sure clients add values that are also strings. We do this by type
checking a serialization time. This fixes an issue where D19942522 assumed
extras were strings and hit a type error for globalrevs, which were ints.

Apparently the code that reads globalrevs from the extras never treats it as an
int anyway, so none of the reading code needed to be updated to convert the
string back to an int.

Reviewed By: singhsrb

Differential Revision: D20631889

fbshipit-source-id: 8c8b3c9a9f3369376e08146d670f2d6321df141f
2020-03-24 18:30:03 -07:00
Stefan Filip
c400809eba dag: rename child index iteration to iter_master_flat_segments_with_parent
Summary:
`iter_segments_with_parent` has a few more conditions attached to it than the
name would imply. We are renaming it to give a better sense of its true
behavior.

Reviewed By: quark-zju

Differential Revision: D20547631

fbshipit-source-id: 406f46b9de5efc9e8e6a8c4bc22ab18fa5bc54bb
2020-03-24 13:58:07 -07:00
Stefan Filip
59ff2a8571 dag: remove_non_master implementation for
Summary: Also adding better tests for non master entries.

Reviewed By: quark-zju

Differential Revision: D20504483

fbshipit-source-id: 60d4a20aecb00f7750db2fff5d3832aac99d00e2
2020-03-24 13:58:06 -07:00
Stefan Filip
03c1e1cac5 dag: iterator implementations for InProcessStore
Summary:
The main question I had while writing the tests was whether we expect a
specific order for Segments for `iter_segments_with_parent`. `InProcessStore`
will return the segments in the order that they were inserted.

Reviewed By: quark-zju

Differential Revision: D20501401

fbshipit-source-id: 48ceb78f3191c7425c1488a3392cf3167f7e7268
2020-03-24 13:58:06 -07:00
Stefan Filip
5f4e706f81 dag: Add InProcessStore as iddagstore
Summary:
First 6 methods implemented from the IdDagStore trait for the InProcessStore.

Any suggestions welcome.

Reviewed By: quark-zju

Differential Revision: D20499228

fbshipit-source-id: cb536a3a0136077ada78934d82a25d079a5bc809
2020-03-24 13:58:06 -07:00
Stefan Filip
3dcb56535e dag: add descriptions to IdDagStore methods
Summary: Documentation.

Reviewed By: quark-zju

Differential Revision: D20499926

fbshipit-source-id: ebbb7a1249109bd56ff459a659e0c628c2974179
2020-03-24 13:58:05 -07:00
Ratnadeep Joshi
17fd33424d Move py/ directory from eden/ to eden/fs
Summary: [edenfs] Move py/ directory from eden/ to eden/fs

Reviewed By: simpkins

Differential Revision: D20479925

fbshipit-source-id: 36abf7fe208c283f01c9bf415e2fcb1a8f4bdbae
2020-03-24 11:45:37 -07:00
Mark Thomas
2678dd7c2b cmdutil: use the new ascii renderer if HGPLAIN is set
Summary:
If `HGPLAIN` is set, and the non-legacy graph renderer is in use, use the ASCII
renderer to ensure compatible output on all platforms and configurations.

Reviewed By: farnz

Differential Revision: D20622425

fbshipit-source-id: b25a8d0526652bab07059492f7adbb684b5cbee7
2020-03-24 11:38:28 -07:00