Commit Graph

30 Commits

Author SHA1 Message Date
Alex Hornby
70fa4b16de remove use of chashmap
Summary: Switch from chashmap to dashmap as dashmap upstream is more responsive.

Reviewed By: krallin

Differential Revision: D30045037

fbshipit-source-id: 252e231d426389ccf726613f0b073159a7a70d68
2021-08-03 13:07:17 -07:00
Andrey Chursin
1e24cf2d00 vfs: fix linux detection
Summary: fanzeyi pointed that shortcut `cfg(linux)` does not actually exist

Reviewed By: fanzeyi

Differential Revision: D29670231

fbshipit-source-id: 5ebd2678ea540eeb0530b204814096ba0d9d7fed
2021-07-13 16:49:38 -07:00
Thomas Orozco
8c83bd9a1c third-party/rust: update Tokio to 1.7.1
Summary: There is a regression in 1.7.0 (which we're on at the moment) so we might as well update.

Reviewed By: zertosh, farnz

Differential Revision: D29358047

fbshipit-source-id: 226393d79c165455d27f7a09b14b40c6a30d96d3
2021-06-25 06:17:41 -07:00
Davide Cavalca
b82c5672fc Update several rust crate versions
Summary: Update versions for several of the crates we depend on.

Reviewed By: danobi

Differential Revision: D29165283

fbshipit-source-id: baaa9fa106b7dad000f93d2eefa95867ac46e5a1
2021-06-17 16:38:19 -07:00
Pedro Rittner
b91da1d115 Bump crossbeam from 0.7 to 0.8, lsp from 0.3 to 0.5, lsp-types from 0.73 to 0.89
Summary: Bumping the crossbeam version so we can use `recv_deadline`. This also necessitates updating the lsp and lsp-types crates.

Reviewed By: alunyov, dtolnay

Differential Revision: D29056473

fbshipit-source-id: 9434e9e0895d82482f4c70afa01a2f77702b965f
2021-06-11 21:57:21 -07:00
Stanislau Hlebik
eab97b6123 mononoke: sync changeset implementation for megarepo
Summary: First stab at implementing sync changeset functionality for megarepo.

Reviewed By: ikostia

Differential Revision: D28357210

fbshipit-source-id: 660e3f9914737929391ab1b29f891b3b5dd47638
2021-05-13 10:04:21 -07:00
Andrey Chursin
e81ae0f900 vfs: add VFS::case_sensitive
Summary: This diff adds flag to VFS to detect whether FS is case sensitive. The logic in this code losely follows similar logic in Python

Reviewed By: quark-zju

Differential Revision: D27926952

fbshipit-source-id: 36fdf4187ae513b25346f704050c64f9a1a4ec74
2021-04-22 15:56:49 -07:00
Andrey Chursin
82f93150a0 vfs: add VFS::read
Summary: Adding method to VFS to read file content

Reviewed By: DurhamG

Differential Revision: D27799146

fbshipit-source-id: c7e5c2dbd496d3cfd349a435225b1d44ee14cda0
2021-04-15 20:08:17 -07:00
Andrey Chursin
95e84b7302 checkout: introduce CheckoutPlan::check_unknown_files
Summary: This method checks if any of files that checkout writes is not tracked in hg and exists on disk

Reviewed By: DurhamG

Differential Revision: D27667153

fbshipit-source-id: 4ad8bc08520678ea0b51008ed14fb51ca4a98f76
2021-04-13 11:47:54 -07:00
Gus Wynn
fc46c24e8f update tokio to 1.4.0
Summary:
https://github.com/tokio-rs/tokio/releases/tag/tokio-1.4.0
I want the `biased;` option in `tokio::select!`

Reviewed By: ahornby

Differential Revision: D27435341

fbshipit-source-id: c29ca954c319327f62466131ae04483ad091bf49
2021-03-31 10:44:20 -07:00
Durham Goode
b38cc98e54 vfs: add a few Debug derives
Summary: These were generally useful when debugging native checkout.

Reviewed By: quark-zju

Differential Revision: D26955400

fbshipit-source-id: 967a4fa2d831b8b060409a5f7be31a1416c1ba63
2021-03-11 10:07:04 -08:00
Thomas Orozco
f5f78c4906 third-party/rust: update tokio & tokio-stream
Summary:
Pulling this for those 2 PRs:

- https://github.com/tokio-rs/tokio/pull/3547
- https://github.com/tokio-rs/tokio/pull/3576

Reviewed By: ahornby

Differential Revision: D26944216

fbshipit-source-id: ad67afa69cb291cfb1622cf4b2a10727a13d19cd
2021-03-10 11:01:28 -08:00
Andrey Chursin
0be8e8ce29 vfs: introduce AsyncVfs
Summary:
AsyncVfs provides async vfs interface.
It will be used in the native checkout instead of current use case that spawns blocking tokio tasks for VFS action

Reviewed By: quark-zju

Differential Revision: D26801250

fbshipit-source-id: bb26c4fc8acac82f4b55bb3f2f3964a6d0b64014
2021-03-05 21:47:51 -08:00
Andrey Chursin
6c7b0134a3 vfs: make clear_conflicts private
Summary: This function is now internal details of vfs, and is not used outside of it. Making it private so it won't be accessed outside

Reviewed By: quark-zju

Differential Revision: D26801251

fbshipit-source-id: 03434e235978fa0745128d90ea0c5975ea662ff1
2021-03-05 21:47:50 -08:00
Lukas Piatkowski
ad106958f2 eden/scm/lib: autogenerate all Cargo.toml files with autocargo
Summary: This diff removes the split between manually managed and autocargo managed Cargo.toml files in `eden/scm/lib`, now all files are autogenerated.

Reviewed By: quark-zju

Differential Revision: D26830884

fbshipit-source-id: 3a5d8409a61347c7650cc7d8192fa426c03733dc
2021-03-05 04:29:49 -08:00
Andrey Chursin
eac8385eff vfs: use &[u8] instead of Bytes for content
Summary: This is most universal/flexible interface

Reviewed By: quark-zju

Differential Revision: D26410641

fbshipit-source-id: cae74675f89c0c1c05c84331c3ce0e78fd0b0b2f
2021-02-17 10:45:46 -08:00
Andrey Chursin
3e29269b99 vfs: update existing permissions instead of setting const value
Summary: This better replicates python's logic

Reviewed By: quark-zju

Differential Revision: D26406416

fbshipit-source-id: 1027004ded63a28aa88b81b087255c4ef212dd6b
2021-02-17 10:45:46 -08:00
Andrey Chursin
881b03690d vfs: reset permissions when overwriting file
Summary:
Currently if VFS overwrites executable file with regular, it preserves exec bit[see added test].
This diff makes sure that file has correct permissions after overwrite

This diff also slightly optimizes write_executable, by calling set_mode on the file handle, instead of path

TODO - we can check if calling stats() before set_permissions will save some time

Reviewed By: quark-zju

Differential Revision: D26379824

fbshipit-source-id: 42d0b2fb79ed860ac37b2de077388002ade69449
2021-02-11 19:10:24 -08:00
Andrey Chursin
0240026f36 vfs: do not follow symlink when overwriting
Summary:
Before this diff VFS::write_regular did not handle correctly use case when file already existed as as symlink - it would write into symlink location, instead of replacing symlink with a regular file (see updated  test_symlink_overwrite that is failing on old implementation)

This diff adds O_NOFOLLOW option on unix when overwriting the file. When destination is a symlink, attempt to write fails with E_LOOP and triggers clear_conflict that removes symlink and allows retry write to succeed.

This also allows one of test cases in checkout that previously did not work

Reviewed By: quark-zju

Differential Revision: D26378893

fbshipit-source-id: 28bcdaba78db283ac7a25bb232c198d3d8f73e5d
2021-02-11 19:10:24 -08:00
Andrey Chursin
14064f8582 vfs: move conflict handling from pyworker to vfs write
Summary:
Previously, `write` can fail because the destination file exists as a
directory, or the parent directory is missing. pyworker handles those cases
by calling `clear_conflicts` to remove conflicted directories and create
missing parent directories and retry `write`. Practically, for all `write`
usecases (including checkout) we always want the `clear_conflicts` behavior.
Therefore, move `clear_conflicts` to vfs `write` and make it private.

Reviewed By: quark-zju

Differential Revision: D26257829

fbshipit-source-id: 03d1da0767202edba61c47ae5654847c0ea3b33e
2021-02-09 17:04:30 -08:00
Andrey Chursin
d9232f1db3 checkout: handle more complex flag changes
Summary: Currently we pick simple approach and just delete existing file before re-creating it if there is some non-trivial flag change

Reviewed By: quark-zju

Differential Revision: D26239977

fbshipit-source-id: 167efa1bf6018e7f967ef3a9e3c8c62781486ec9
2021-02-09 17:04:29 -08:00
Andrey Chursin
468505dc5a vfs: make audit cache concurrent
Reviewed By: quark-zju

Differential Revision: D26233458

fbshipit-source-id: e06f5642f713d0788407e3cc70655ef82261e7c2
2021-02-04 13:13:45 -08:00
Jun Wu
6956496602 lib: bytes::Bytes -> minibytes::Bytes
Summary:
The `bytes` crate still does not support zero-copy on mmaped buffer.
Switch to `minibytes::Bytes` so bytes returned from our main storage
backend indexedlog is a zero-copy slice backed by a mmap buffer.

Migrate vfs, revisionstore, pyworker to minibytes so they can preserve
zero-copy mmap buffers from indexedlog.

The edenapi/types is unchanged, since it's also used in Mononoke which uses
`bytes::Bytes` all the places. The conversion to `minibytes::Bytes` is cheap
so it's probably not a performance issue.

Reviewed By: kulshrax

Differential Revision: D26218289

fbshipit-source-id: e4f1c631143b7676c6b48d3b4f97055299bfd334
2021-02-03 20:22:32 -08:00
Andrey Chursin
9a89bd4057 vfs: add set_executable api
Summary: set_executable is a pub function of VFS that set exec permissions on simple file

Reviewed By: quark-zju

Differential Revision: D26212713

fbshipit-source-id: 4c3ef477fc8d61362285654dda0b006342e046ee
2021-02-02 23:14:34 -08:00
Xavier Deguillard
2d3370dca4 fsinfo: recognize EdenFS mounts on Windows
Summary:
EdenFS on Windows is a bit weird as ProjectedFS is implemented as a filter
driver that adds reparse point to all the files/directories to get notified of
filesystem operations on them. It then hides these reparse points from the
outside which means that the dwAttributes of a file in EdenFS will not claim
that a reparse point is attached to it. On top of this, newly created
files/directories won't have any reparse points attached to them, until they
start being tracked by EdenFS.

While the first issue can be solved by always querying the reparse tags, I'm
not entirely sure how to solve the second one. That second issue causes
Mercurial to always try to create hardlink in the .hg directory, while it shouldn't.

Reviewed By: DurhamG

Differential Revision: D22937788

fbshipit-source-id: 5d90cd37d40858ed60103ff2d17c2cef16472b38
2020-08-12 15:47:49 -07:00
Xavier Deguillard
4f5455cfa5 silence some Rust warnings
Summary: This is causing noise when compiling, let's silence them.

Reviewed By: kulshrax

Differential Revision: D22925881

fbshipit-source-id: 10b48f1f05ff8931e23d07a9d7e9504339fceca0
2020-08-05 00:16:33 -07:00
Durham Goode
092d350800 filesystem: add treestate walking logic
Summary:
The second phase of pending changes is to iterate over the treestate
and figure out what files were not seen in the filesystem walk. This diff
implements that.

Reviewed By: xavierd

Differential Revision: D20546899

fbshipit-source-id: 3523fbc7e31ef0ed09c4937c72264b64e2a3db5b
2020-04-24 13:58:53 -07:00
Durham Goode
73a45b695b filesystem: add filesystem walking to PendingChanges
Summary:
The first phase of pending changes is inspecting the filesystem for
changes. This diff adds that logic.

Reviewed By: xavierd

Differential Revision: D20546909

fbshipit-source-id: 1c2c0fa7f700dbff4acfce4d5271b4472a13571f
2020-04-24 13:58:53 -07:00
Durham Goode
dbff6c6b9a filesystem: add initial PendingChanges stubs
Summary:
The part of status that lists what files have changed is called
PendingChanges. This diff introduces the initial stub for PendingChanges. The
pending changes algorithm involves three parts:

1. Looking at files on the filesystem for changes.
2. Looking at files in the dirstate map for changes.
3. Looking at the content for any files that we were unsure of during steps 1
and 2.

This diff puts the basic state machine in place, and accepts the basic
information about the working copy (the root and what type of filesystem it is).
In the future we might have it detect what type of filesystem it is, but for now
this makes it easy.

Reviewed By: xavierd

Differential Revision: D20546898

fbshipit-source-id: a3030b7c846b3cb2fcba805b7fe4744df7c5764e
2020-04-22 19:55:50 -07:00
Durham Goode
e97d8d8895 vfs: move vfs logic into its own crate
Summary:
This logic will be used in a variety of places (update workers, status,
etc). Let's move it somewhere common.

Reviewed By: xavierd

Differential Revision: D20771623

fbshipit-source-id: b4de7c1d20055a10bbc1143d44c55ea1045ec62a
2020-04-22 19:55:49 -07:00