Commit Graph

14879 Commits

Author SHA1 Message Date
Jun Wu
f42faf1c64 sshpeer: short circuit hg serve command in tests
Summary:
Previously the hg serve command requires a chain of other commands to run:

  hg (client) -> /bin/sh -> /usr/bin/env -> python -> dummyssh -> hg (server)

This diff makes it run the server process directly:

  hg (client) -> hg (server)

So there is no dependency on /bin/sh (or cmd.exe), a standalone python etc.

The dummyssh logic is "inlined" so the stdout + stderr order is preserved.

Test changes:
- run-tests and testutil: ensure sys.argv[0] is set to hg, not the t.py test
  so util.hgcmd() works
- test-clone, test-pull, test-push: removed checks about ssh injection - we
  no longer use ssh in production anyway.
- test-fb-hgext-pushrebase-remotenames: minor output update
- test-commitcloud-sync: incompatible and irrelevant --bgssh test removed
- test-infinitepush-bundlestore: irrelevant and removed
- test-rustmanifest-t: stdout / stderr order adjusted

Reviewed By: DurhamG

Differential Revision: D34835693

fbshipit-source-id: ff71ec1cfe57ea9b00a811703b89211b1b8fc76a
2022-04-20 12:57:30 -07:00
Jun Wu
cf4c855ca6 testing: TestTmp for test environment setup
Summary:
TestTmp sets up the test environment like what run-tests.py does per test.
It does not affect global state so one can use TestTmp in multiple tests
in one single test file.

See the docstring of the added TestTmp class for examples.

Reviewed By: DurhamG

Differential Revision: D34725132

fbshipit-source-id: 422b73adb82b0373868a776cf703ca36d6cd6c52
2022-04-20 12:57:30 -07:00
Yan Soares Couto
8be546a730 snapshot: Speed up cleaning up local working copy
Summary: This is an attempt to bypass some slow code in our logic to revert so that it works fast more consistently.

Reviewed By: mrkmndz

Differential Revision: D35782843

fbshipit-source-id: 8ec956d37e8f62537ff9f8d29e0a0fadff405f00
2022-04-20 12:55:31 -07:00
Jun Wu
b0a9d1faf5 pyindexedlog: add bindings for indexedlog's Log
Summary:
This makes it easier to use Python scripts to check and view contents of
indexedlog.

Reviewed By: DurhamG

Differential Revision: D35585546

fbshipit-source-id: cd2022e4d6d67a18d43052fbccfd1580721ef23c
2022-04-20 11:43:36 -07:00
Jun Wu
6ccc8a53ac bindings: add a way to update modules automatically
Summary:
Use [cog](https://nedbatchelder.com/code/cog) to generate code based on files.
This makes it easier to update the module list.

Reviewed By: DurhamG

Differential Revision: D35585547

fbshipit-source-id: 60f3c9a5bde2a1460ebe64a5701693f60f9ccd13
2022-04-20 11:43:36 -07:00
Jun Wu
4af09806fd bindings: simplify module initialization using proc macro
Summary: Make it easier to add a new module to bindings.

Reviewed By: DurhamG

Differential Revision: D35585550

fbshipit-source-id: 9aade63c586a69413f977dccced030ebddddb039
2022-04-20 11:43:36 -07:00
Jun Wu
845068d896 pyindexes: remove module
Summary: It is no longer used after D29020190 (8cc60851cb).

Reviewed By: DurhamG

Differential Revision: D35585549

fbshipit-source-id: 8640e790b1c2f3b2a7ade7ccfe2711bea98bba4b
2022-04-20 11:43:36 -07:00
Aida Getoeva
8975eab3a9 mononoke/walker: fix --storage-id arg
Summary:
I forgot to add `#[clap(long)]` to the `--storage-id` arg and also the tw config was set to pass `--storage-id` as a main command arg while it's actually a sumbcommand arg. Because of that the walker tasks were failing with :
```
rror: Found argument '--storage-id' which wasn't expected, or isn't valid in this context
	If you tried to supply `--storage-id` as a value rather than a flag, use `-- --storage-id`
USAGE:
    walker --scuba-dataset <SCUBA_DATASET> --mysql-query-time-limit <MYSQL_QUERY_TIME_LIMIT> --fb303-thrift-port <PORT> --blobstore-read-qps <BLOBSTORE_READ_QPS> --manifold-request-priority-override <MANIFOLD_REQUEST_PRIORITY_OVERRIDE> --blobstore-scrub-grace <BLOBSTORE_SCRUB_GRACE> --blobstore-scrub-action <BLOBSTORE_SCRUB_ACTION> <--repo-id <REPO_ID>|--repo-name <REPO_NAME>> <--config-path <CONFIG_PATH>|--config-tier <CONFIG_TIER>|--prod> <SUBCOMMAND>

```

Reviewed By: markbt

Differential Revision: D35783175

fbshipit-source-id: 5efe68e78730212dfa02db3f17f071b9a4bff490
2022-04-20 10:49:54 -07:00
Rajiv Sharma
5489153987 Instrumenting snapshot update client command
Summary: Current console output includes only high level snapshot update/restore data. This diff adds instrumentation over the individual steps within the snapshot update/restore command.

Reviewed By: yancouto

Differential Revision: D35750512

fbshipit-source-id: 0d7dfb9550f5fb72ecaf08091e5a5501d652bfe4
2022-04-20 10:45:14 -07:00
Aida Getoeva
fd315fe28c mononoke/walker: switch old walker to the new one
Summary:
This diff replaces old cmdlib walker target with the new one. It also changes the TW config because scuba logging arg name now different.

I will stop the conveyor from the updates before I land these changes.

Reviewed By: markbt

Differential Revision: D35532342

fbshipit-source-id: e243d9ce11ea25061812b4021a575e8f57e828c4
2022-04-20 07:05:28 -07:00
Katie Mancini
8f3f873874 fix invalidation on NFS
Summary:
TL;DR: File invalidation after checkout is broken on NFS macOS. This proposes a
fix.

Previously, to invalidate things on NFS we opened and closed all the parent
directories of any files/directories that changed during a checkout operation.

This worked on Linux because all open calls result in some request into the
EdenFS daemon (usually a getattr I think). The returned response from this
would show that the directory had update timestamps. So the open would see the
parent directories in their updated state. This would trigger the NFS client to
clear it's caches for that directory and their recursive children to preserve
CTO. CTO or close-to-open consistency guarantees that if on process observed a
file in state A and closed the file, then another process opened that same file
, it will see the file in state A or a later state.

macOS does not seem to do CTO.

It seems that most of the "read" filesystem calls can basically be served from
cache on NFS. Only writes seem to be guaranteed to make it into eden.

So instead of using a "read" filesystem call to trigger invalidation, we need to
use a write one.

I tried opening things in write mode, but the problem is that we need to
invalidate directories (to ensure the entry information is updated) and
directories can not be opened in write mode.

I tried writing 0 bytes to the files themselves that have changed, but this
empty write is short circuited somewhere in the kernel.

The only filesystem call that can be a noop, and seems to trigger a call into
eden is chmod. We are not really working off any guarantees any more, but
it seems to work on both Linux and macOS in my testing so far and is better
than our current broken state of invalidation.

So now to invalidate we chmod parent directories that have changed with their
current mode. Note that this could get extra tricky if we were mixing updating
directory permissions with invalidating them. We would need to ensure we chmod
with the most up to date mode bits. However, because we do not update
permissions anywhere that we also invalidate (checkout does not know how to
update directory permissions) things are a little simpler.

It's important that the chmod can not complete until it seems an updated view of
the parent directory. So we have to be careful about locking here. (Although
that hasn't really changed since we switched from open to chmod.)

One thing that does change is that since chmod is technically a write, it could
cause extra materialization that would be bad for checkout and status
performance. To prevent these problems I have updated setattr to not materialize
a directory when the attribute change is a noop which it should be in our
invalidation technique unless another client modified the directory in the
meantime in which case the directory should be modified anyways. This would
mean that we could end up wiping out clients changes to permissions in the
working copy during checkout. but this matches non eden checkout behavior. So I
think this is ok.

Reviewed By: xavierd

Differential Revision: D35435764

fbshipit-source-id: 196c4995b130b595f9582204237e726e5212993f
2022-04-19 20:32:54 -07:00
Muir Manders
8348d87f3f util: fix a couple test on Windows
Summary: Forgot to update these when I changed changed the signature.

Reviewed By: DurhamG

Differential Revision: D35748246

fbshipit-source-id: f1102b60a8dd3d4af8312d7c67a0895691774f6a
2022-04-19 17:55:27 -07:00
Xavier Deguillard
d50e81bca9 inodes: use new SNAPSHOT format
Summary:
In Mercurial terminology, a `hg reset` operation simply updates the working
copy parent but doesn't affect the state of the repository. A diff/checkout
operation however would compare the on-disk state of the repository with the
working copy parent. Thus EdenFS must respect this behavior.

On Linux and macOS, a reset operation merely updates some state in the
EdenMount, but since these platforms reads data from the inode hierarchy, the
reset operation doesn't affect future reads to the repository. These would
still read the data from the previously checked out revision.

On Windows however, ProjectedFS requires us to read data from the currently
checked out commit, and thus we bypass the inode hierarchy. The downside is
that a reset operation changes the RootId in the EdenMount which is used to
walk Mercurial's tree hierarchy. What this means is that a read operation
performed after a reset would read the content of the file as it is in the
reset revision. This is not the behavior that Mercurial expects.

To solve this, we need to keep track of both the last checked out revision to
be used in response to read callbacks and the last reset revision, to be used
in diff operations. To achieve this, we can use the newly introduced SNAPSHOT
file format.

Reviewed By: fanzeyi

Differential Revision: D35293079

fbshipit-source-id: 5cfae510db8bc759d51447e6c24f021c104b7353
2022-04-19 17:33:45 -07:00
Jun Wu
6c4ef4f32f testing: fix rm on macOS
Summary:
On macOS unlink(dir) results in a PermissionError instead of a
IsADirectoryError.

Reviewed By: DurhamG

Differential Revision: D35756194

fbshipit-source-id: bbdc828f112e600c1dcecedb5165dd3b7a8694b2
2022-04-19 12:16:08 -07:00
Aida Getoeva
530581dd3f mononoke/walker: fix flaky integration test
Summary:
The test was flaky because the output sometimes is in different order. The test already had `sort` command for the walker output, however the strings that were sorted included much more than just the failed types:
```
  # The output has globbing, which consumes the beginning (after the "Validation failed: ") and the end of the string

  Validation failed: *hg_link_node_populated* (glob)

  # while the actual string looks like this:

  Validation failed: {"int":{"check_fail":1,"seq":1,"time":1650377693},"normal":{"build_revision":"","build_rule":"fbcode:eden/mo
nonoke/walker:new_walker","check_type":"bonsai_phase_is_public","node_key":"changeset.blake2.2b06a8547bfe6a3ac79392aef3fa7f3f45a82
f4e0beb95c4fa2b914c34b5b215","node_type":"PhaseMapping","repo":"repo","server_hostname":"testingnamespace","session":"kX8ip3P1uUxV
58Mt","src_node_key":"changeset.blake2.2b06a8547bfe6a3ac79392aef3fa7f3f45a82f4e0beb95c4fa2b914c34b5b215","src_node_type":"Changese
t","via_node_key":"hgchangeset.sha1.26805aba1e600a82e93661149f2313866a221a7b","via_node_type":"HgChangeset","walk_type":"validate"
}}
```

So when the numbers changed in between the test runs the order of the results changed too.
Now let's sort the output properly: only the failed types.

Reviewed By: yancouto

Differential Revision: D35747592

fbshipit-source-id: eddca83bc9f1ecc202f87f0079ce2e65abd0c479
2022-04-19 10:59:52 -07:00
Zeyi (Rice) Fan
7990f2f8bb cli_rs: improve eden status reporting
Summary:
The current UX of `eden status` isn't good. It leaks too much internal details and generates confusing error message for the user.

This diff fixes the error reporting by moving the exact detail into trace logging while the actual error is more user-friendly.

This should reduce the confusions.

Reviewed By: chadaustin

Differential Revision: D35663792

fbshipit-source-id: 0b76f9ff9ee4542cce7349ccfa6724f096e1305f
2022-04-19 10:55:12 -07:00
Jeremy Braun
93f731cf79 Limit watchman+eden's fetching of inodes on common hg updates
Summary: Eden's `getEntryInformation` API currently loads Inodes for all paths queried, force-materializing the path component's Inodes. This often isn't required, and eden could be fetching non-loaded data from the object store instead.

Reviewed By: chadaustin

Differential Revision: D35372760

fbshipit-source-id: e31a450a20b09249f03339dcd1aeca2eb363046e
2022-04-19 09:33:32 -07:00
Jeremy Braun
ab3918ad4a Add EdenMount::getInodeOrTreeOrTreeEntry, use it in thrift calls for SHA1 and BlobMetadata
Summary: There's no need to materialized iNodes to request the content Sha1 and/or BlobMetadata, as that can be fetched from the objectStore.

Reviewed By: chadaustin, xavierd

Differential Revision: D35467564

fbshipit-source-id: 2848f4d21725a9f5d40251fde2e0eb29ea81302e
2022-04-19 09:33:32 -07:00
Muir Manders
679a25d42b pyerror: don't strip off anyhow context
Summary: Instead of stripping anyhow context off all errors, only strip within the concrete error handler "specific_error_handler". This way, the fallback error handler (that produces the beloved RustError) gets the top level error with all the anyhow context.

Reviewed By: DurhamG

Differential Revision: D35602091

fbshipit-source-id: 547ae7e1a2352af74817f90ab08cadb0fce65efc
2022-04-19 07:00:24 -07:00
Stiopa Koltsov
369873ff18 Regenerate
Summary:
Following diff D35738033 adds another crate and reindeer generates unrelated changes.

Run

```
fbcode/common/rust/tools/reindeer/vendor
```

without any changes.

Reviewed By: dtolnay

Differential Revision: D35738034

fbshipit-source-id: 0539b8abbd694479dbe89939cb8c5ddc6272bd71
2022-04-19 00:29:05 -07:00
Katie Mancini
ad04eb9bc1 add unit test for access
Summary: This code has enough risk of a copy paste error that it deserves a unit test.

Reviewed By: chadaustin

Differential Revision: D35161787

fbshipit-source-id: 5691d13a74a0f059dfd6a93ea2852dca8399a165
2022-04-18 21:55:15 -07:00
CodemodService Bot
712c09c627 Daily common/rust/cargo_from_buck/bin/autocargo
Reviewed By: zertosh

Differential Revision: D35670295

fbshipit-source-id: f03ed9d4247923ee4dad6605b261a3ef69b35f67
2022-04-18 19:06:16 -07:00
Jun Wu
4ae35dabeb testing: add hghave utilties to runtime
Summary: Enable .t runtime to access hghave checks.

Reviewed By: DurhamG

Differential Revision: D34725128

fbshipit-source-id: c821fe34482f160951810a26f3ed9b6b466dd1f0
2022-04-18 16:13:35 -07:00
Jun Wu
0307ee609a testing: memorize hghave checks
Summary:
Most hghave checks are "immutable" results. Memorize them to reduce cost.
If some checks depend on actual tests, we can special case them later to
not be memorized.

Reviewed By: DurhamG

Differential Revision: D34725137

fbshipit-source-id: f010bddb856df1950854b839aa8c311c6a40bdbd
2022-04-18 16:13:35 -07:00
Jun Wu
7cae09de0b testing: vendor hghave.py
Summary:
This allows using the hghave library without shelling out to a `hghave` binary
in tests.

Reviewed By: DurhamG

Differential Revision: D34725136

fbshipit-source-id: 1b8115a791414a68ebd2e7ec077f77bca2a0833a
2022-04-18 16:13:35 -07:00
Jun Wu
ab08faf821 testing: compare multiline text with glob patterns
Summary: This is ported from testutil's eqglob (D16209212 (b87a92215f)).

Reviewed By: DurhamG

Differential Revision: D34725120

fbshipit-source-id: 2a94a9065f82e6d3b49770a7df2f398e5131f164
2022-04-18 16:13:35 -07:00
Jun Wu
d0b6e10966 testing: add 'sed' to shell builtin
Summary: `sed 's/a/b'` (and other sed commands) are used frequently in tests. Implement it.

Reviewed By: DurhamG

Differential Revision: D34790212

fbshipit-source-id: 76bfac795e6b14a8d83cbee9fd5c74341112786e
2022-04-18 16:13:35 -07:00
Jun Wu
66b5be97ee testing: add 'wc -l' to shell builtin
Summary: `wc -l` is also commonly used. Implement it.

Reviewed By: LynBusch

Differential Revision: D34725129

fbshipit-source-id: b20259026424d2bdd7ab8c53b7683c120cda96e3
2022-04-18 16:13:35 -07:00
Jun Wu
93fd23fbe2 testing: add grep to shell builtin
Summary:
`grep` is commonly used. Implement it.

This diff might also serve as an example about how to extend the stdlib.

Reviewed By: LynBusch

Differential Revision: D34725127

fbshipit-source-id: 32ba5cdfc521f538923f05c09c2fa9afb6e88f05
2022-04-18 16:13:35 -07:00
Jun Wu
bf75662088 testing: initial transformer from .t to Python
Summary:
To be able to execute .t test without bash, and to be future
proof so tests can use Python more easily instead of bash.
Define a way that supports both classic .t and pure Python
and a mix of them.

See the docstring for details.

Not all `.t` features are handled in this diff.
Namely `#testcases` support is missing.

Reviewed By: LynBusch

Differential Revision: D34725133

fbshipit-source-id: f68c88a2e5c0fa4f3ce3de0b39ff17e11350b1be
2022-04-18 16:13:35 -07:00
Jun Wu
43d53709b2 testing: fs-related shell builtin commands
Summary: Add commands to operate on the filesystem.

Reviewed By: LynBusch

Differential Revision: D34725131

fbshipit-source-id: 7769e0d10764e3c39ea3e5bd11c9fda07af80895
2022-04-18 16:13:35 -07:00
Jun Wu
2b99d03e96 testing: initial shell interpreter
Summary:
See the added module docstring for details.

Unlike testutil/dott (D16172901 (27908b883c)), this implementation behaves
much more closely to a real shell thanks to conch-parser.

For reviewers: This is a large change but still relatively
simple compared to other shell implementations. It might be
easier just looking at the tests.

Differential Revision: D34725134

fbshipit-source-id: 1ec54ae2c0146ba2533c16f3fbc27f4275ca80f4
2022-04-18 16:13:35 -07:00
Jun Wu
a4a0436d23 bindings: expose conch-parser
Summary: Expose the conch-parser features to Python.

Differential Revision: D34725124

fbshipit-source-id: 9993a67fda8f92f14fb6897a2b50747742735c3a
2022-04-18 11:56:11 -07:00
Jun Wu
86dbc0f256 conch-parser: serde::Serialize for AST types
Summary:
This makes it easier to export the AST in other formats (ex. Python objects).

Conflicted names (ex. Parameter::Star vs SimpleWord::Star) are attributed with serde(rename) so they can be distinguished more easily.

Reviewed By: LynBusch

Differential Revision: D34725130

fbshipit-source-id: d91a80cec5b858669f5d16c95aa63046470730e1
2022-04-18 11:56:11 -07:00
Jun Wu
fde88fdd4e conch-parser: add TARGETS
Summary: Add TARGETS so it can be used in buck builds.

Reviewed By: yancouto

Differential Revision: D34725122

fbshipit-source-id: 00b958738b05a30a4b9a1470978645b5fad0ad8d
2022-04-18 11:56:11 -07:00
Jun Wu
7762e74ca2 conch-parser: resolve rustc warnings
Summary: This makes the code compile with future versions of rustc.

Reviewed By: LynBusch

Differential Revision: D34725123

fbshipit-source-id: ec0d4b0e5fee338487dbb817ac64333a6f7a1040
2022-04-18 11:56:11 -07:00
Jun Wu
f8932b955d third-party: vendor conch-parser
Summary:
Import https://github.com/ipetkov/conch-parser commit
e1d3ef269684f46c9696bf3f83e81c37e711570d under MIT license.

The conch-parser seems to be a decent shell parser that
solves the shell syntax parsing headache. For example,
it handle heredocs with substitution (`<< EOS`, `$V`
should be substituted) or no-substitution (`<< 'EOS'`,
`$V` or a slash does not have special meaning) properly.
Heredoc is frequently used in our tests. Most other
shell parsing libraries I checked lack proper heredoc
handling, and/or have an incompatible license. Although
it seems some corner cases can be improved, for example,
`A=1 for i in $A; do ...; done` treats `for` as a
normal command instead of a shell loop keyword. But
that does affect the main test use-cases.

In a later diff the library is modified to support serialization.
Given that the public crates.io is too old and the modification
needed, I imported it into edenscm's own vendor directory
for local customization.

Differential Revision: D34725119

fbshipit-source-id: 3e7d3d3d4f92380a0fd104275e75863332b429db
2022-04-18 11:56:11 -07:00
Yipu Miao
246a6be36a Add a benchmark of setPathObjectId
Summary: A script to run the benchmark for ```setPathObjectId```

Reviewed By: chadaustin

Differential Revision: D35271074

fbshipit-source-id: a0f6d9ab1fe6ace929f615a620e2cd4c36fdcc0e
2022-04-18 10:41:25 -07:00
Pyre Bot Jr
24a256db61 suppress errors in fbcode/eden - batch 1
Differential Revision: D35696165

fbshipit-source-id: e69071d77122fd9e6463915cfa1d930d20ed4c17
2022-04-15 22:13:58 -07:00
Pyre Bot Jr
64d2708de8 suppress errors in eden
Differential Revision: D35674585

fbshipit-source-id: 891fea7bc4db979d2d087ff5b1ee93404de2e75e
2022-04-15 09:21:53 -07:00
David Tolnay
560ff38618 Remove even more capacity assertions that aren't true on 1.60's Vec implementation
Summary:
Part of T117105786 -- a set of test failures that bisect to {D35558601 (238a176019)}.

D35558601 (238a176019) already made these same changes to eden/hg-server/lib/indexedlog/src/base16.rs and eden/scm/lib/indexedlog/src/base16.rs. I didn't imagine that there would be not 2 but **4** identical copies of this data structure and tests. :O

Reviewed By: zertosh

Differential Revision: D35660712

fbshipit-source-id: b2e624da04eafd1b2f3b13a0219d84645d96fcdd
2022-04-14 16:32:34 -07:00
Pranjal Raihan
56e2440c1d Make *AsyncClient types aliases instead of subclasses of apache::thrift::Client
Reviewed By: iahs

Differential Revision: D35332438

fbshipit-source-id: c119097d841be5f356327c5d9a347bf279be9c5f
2022-04-14 10:57:15 -07:00
Jan Mazur
53e5d327df make users of repo_import aware that it can be dangerous in some cases
Summary: Merging a repo that has multiple refs / heads / unmerged branches (relatively to master) can be dangerous. Let's make users aware of that.

Reviewed By: farnz

Differential Revision: D35608687

fbshipit-source-id: a103862ebd89c034cfe23b27606aa558cddb069c
2022-04-14 07:46:16 -07:00
CodemodService Bot
4f4598dd18 Daily common/rust/cargo_from_buck/bin/autocargo
Reviewed By: krallin

Differential Revision: D35639860

fbshipit-source-id: b37e1013a9c10db729589fe817e787ff64f30420
2022-04-14 06:37:34 -07:00
Mateusz Kwapich
9be245e677 test for forced reloading
Summary: This part of segmented changelog was never tested and we depend on this behaviour for emergencies. We're going to depend on it even more now that we won't reload the SC every hour.

Reviewed By: yancouto

Differential Revision: D35614793

fbshipit-source-id: cd10deceab7fb1be5a77f26ef904c09ea7562996
2022-04-14 03:29:44 -07:00
Mateusz Kwapich
11c966228b avoid reloading segmented changelog if tailer did not make any progress
Summary:
We should not reload and reset the server-side segmented changelog if the
tailer has not written a new version since we last loaded - instead, we should
keep our existing one in-memory, because it will be more up to date than the
one we load.

In situations when the tailer is not working properly this might mitigate the issue for the customers instead of exposing them to it.

Reviewed By: farnz

Differential Revision: D35408139

fbshipit-source-id: 10d30b6d2d055fc938f9d0f22f3c633f7d7495c2
2022-04-14 02:16:25 -07:00
Mateusz Kwapich
98d1c489ff use the SegmentedChangelogManager in the test
Summary:
We use completely different codepath for testing, let's go through the same as
we go in prod.

Reviewed By: farnz

Differential Revision: D35408141

fbshipit-source-id: 05f3f026c0c15b7b460c554828089247f8680eaf
2022-04-14 02:16:25 -07:00
Stanislau Hlebik
a2d7a49953 debugsparsematch: allow to separate with \0
Summary: It's useful for parsing

Reviewed By: quark-zju

Differential Revision: D35609276

fbshipit-source-id: 16890ac4557636fbc68f89251584261e153e3e8a
2022-04-13 23:15:50 -07:00
Durham Goode
5d3d0f567d buck: enable buck build on Windows
Summary:
This makes 'buck build mode/win //eden/scm:hg' work on Windows. The
resulting binary doesn't actually run though, since buck run depends on hg.sh
which doesn't work on Windows. That will need to be converted later.

Reviewed By: quark-zju

Differential Revision: D35133291

fbshipit-source-id: 15070930612b56a381a8c8e311f6eaac3f1d9856
2022-04-13 16:38:34 -07:00
David Tolnay
238a176019 Update fbcode to Rust 1.60.0
Summary: Release notes: https://blog.rust-lang.org/2022/04/07/Rust-1.60.0.html

Reviewed By: zertosh

Differential Revision: D35558601

fbshipit-source-id: 02fd798c00ef02a3ebd2580ff921d0807a29e092
2022-04-13 16:19:27 -07:00
Andrew Hariri
542cd38136 update reqwest to 0.11.10
Summary: Maintainer still unresponsive on https://github.com/seanmonstar/reqwest/pull/1412

Reviewed By: wqfish

Differential Revision: D35600272

fbshipit-source-id: e01a7ae459ea215180158f4186d33fb1fbed18ff
2022-04-13 14:44:40 -07:00
Mateusz Kwapich
0c09a0053c make manager return the loaded version
Summary:
This diff makes the manager return the loaded segmented changelog version
which is going to allow us

Reviewed By: farnz

Differential Revision: D35408143

fbshipit-source-id: 748901c992e2e67e561970f836892a13c6d88e27
2022-04-13 12:47:03 -07:00
Mateusz Kwapich
a866d52cbc add a function for checking latest version to manager
Summary:
To avoid unnecessary reloads we need a facility to check the latest version (so
we can compare it with one currently loaded)

Reviewed By: farnz

Differential Revision: D35408138

fbshipit-source-id: 14021edda52105fad71ce430feee42bc42659546
2022-04-13 12:47:03 -07:00
Mateusz Kwapich
5ef2f55dea change periodic reload to a named struct
Summary: This will allow me to augment it with other stuff.

Reviewed By: yancouto, farnz

Differential Revision: D35408140

fbshipit-source-id: 1096255eabd84c995ba0bb71209eafd3974c0610
2022-04-13 12:47:03 -07:00
Michael Bolin
056ae53196 rename github to github-cli because it broke autocargo
Reviewed By: zertosh

Differential Revision:
D35615001
Ninja: need to fix autocargo and oss-eden-darwin-getdeps is taking forever

fbshipit-source-id: 1dfc74532615823be3e4cb39ff82e1f7cc0ea1a6
2022-04-13 12:20:02 -07:00
Chad Austin
00b71929a3 reduce unit test runtime by decoupling EdenServer from the full set of BackingStore implementations
Summary:
By lifting construction of the BackingStores into main, the core
"service" target no longer needs to depend on their
implementations. This shaves almost 60% off the unit test runtime on
my devserver. The tests could be made even faster by decoupling all of
our core logic from HgBackingStore and friends.

Reviewed By: xavierd

Differential Revision: D34774356

fbshipit-source-id: 87c2d5f44cfd84d6e01bea44dd4105f6415ce162
2022-04-13 12:01:59 -07:00
Chad Austin
036bfbf745 allow BackingStores to advertise whether checkout can assume blob IDs and contents are 1:1
Summary:
Some backing stores have a 1:1 relationship between blobs and their
IDs. Others don't. If they do, checkout can compare blob contents more
quickly.

In addition, add a config knob that we can use to opt hg into the fast
path, at the risk of correctness. It might be useful for getting out
of sticky situations where any update triggers a ton of fetches.

Reviewed By: xavierd

Differential Revision: D34761024

fbshipit-source-id: 36d513d37c38fc29a708e583ebc2614f07f11bb4
2022-04-13 12:01:59 -07:00
Yan Soares Couto
959764d6da snapshot: Fix max-untracked-size with symlinks and set default to 1GB
Summary:
We currently have no default. Untracked files can be very large (like binaries and such), and easy to miss. We already had an option for that, but were not using it by default. Should the default be even smaller?

It also didn't work with invalid symlinks, as `Path.stat` tried to follow symlinks, so I fixed that.

If a client really wants to upload a large file, they can specify the command line argument by themselves.

Reviewed By: farnz

Differential Revision: D35498620

fbshipit-source-id: 7c21c779a680fb209b82943ec59aa5523cd1608c
2022-04-13 11:26:50 -07:00
CodemodService FBSourceRustfmtLinterBot
2c8f120b81 Daily arc lint --take RUSTFMT
Differential Revision: D35606540

fbshipit-source-id: 1d51e1170b13c0c8512e935ea83b03f96fc2d4e4
2022-04-13 11:07:31 -07:00
Michael Bolin
87d6ff062c add Rust method to fetch pull request data
Reviewed By: quark-zju

Differential Revision: D35573631

fbshipit-source-id: 316485394963bd0c2e06d536d80611a8a0336bc4
2022-04-13 02:47:11 -07:00
Michael Bolin
12a75b87e5 generalize logic to make requests to GitHub GraphQL API
Reviewed By: quark-zju

Differential Revision: D35567823

fbshipit-source-id: 99b14c80a08ccaf6e69caa442d716e8f17f25c11
2022-04-13 02:47:11 -07:00
Michael Bolin
684daeb665 introduce Rust crate to talk to GitHub via its GraphQL API
Reviewed By: quark-zju

Differential Revision: D35491509

fbshipit-source-id: 489a491d1e81e93608f93ef25c3fbbb75e0907c4
2022-04-13 02:47:11 -07:00
Michael Bolin
2d7c25b779 import GitHub's schema.docs.graphql
Summary:
This diff imports the most recent version of `schema.docs.graphql`
available on https://docs.github.com/. Details explained in the `README.md`
included in this commit.

Reviewed By: quark-zju

Differential Revision: D35600010

fbshipit-source-id: 52050db604ca884ce7465da58c3ed2aa3fb85dbc
2022-04-13 02:47:11 -07:00
Ilia Medianikov
36297cb8ff mononoke: create usable segmented changelog in TestRepoFactory
Summary:
Currently unit tests that need a segmented changelog create it separately from the repo because in test repo there is only a `DisabledSegmentedChangelog`. I am making it possible to have an `OnDemandUpdateSegmentedChangelog` that is both useful and can be updated to include needed commits.

Look on new `test_is_ancestor` test to see what is made possible.

Reviewed By: markbt

Differential Revision: D35053513

fbshipit-source-id: 221600b50c8a0140b08f633dc3758489f2524f60
2022-04-13 02:45:23 -07:00
Ilia Medianikov
e387b2619c mononoke: add FacebookInit to TestRepoFactory
Summary: Segmented Changelog requires `CoreContext` for construction, so we can create a test mock if `TestRepoFactory` has a `FacebookInit`.

Reviewed By: markbt, mitrandir77

Differential Revision: D35251021

fbshipit-source-id: 57051e227804669794f19fc2ca130f52cb938b0c
2022-04-13 02:45:23 -07:00
Huapeng Zhou
7a8725f586 rust: update crossterm to 0.23.0 and arc-swap to 1.5.0
Summary:
Needed to import [cloud-hypervisor](https://github.com/cloud-hypervisor/cloud-hypervisor).

(Note: this ignores all push blocking failures!)

Reviewed By: dtolnay

Differential Revision: D34434866

fbshipit-source-id: 69741b4ac767e0ab5ecc8307dd40267d9dcbf4ae
2022-04-12 23:50:06 -07:00
Michael Bolin
6b6c34a27e submit subcommand
Reviewed By: quark-zju

Differential Revision: D35419375

fbshipit-source-id: 1cfed6d3ee43f430c61fea3ebc457dee12f6fad9
2022-04-12 23:03:59 -07:00
Michael Bolin
73836c7887 remove underscorenames lint
Summary:
This removes the historical check in our Mercurial codebase that
disallows underscores in names (modulo a substantial allowlist).

Incidentally, upstream Mercurial also relaxed this restriction in Oct 2019:
https://phab.mercurial-scm.org/D2010 (40bbe7b4da).

Note it is neither the goal nor the expectation that we start going around
renaming existing members to include underscores. We expect files to
maintain internal consistency, at least as far as their API names are
concerned. Inevitably, code authored under the old convention may
call into other APIs that favor underscores (and vice versa) such that
we cannot demand 100% consistency within a file.

Reviewed By: quark-zju

Differential Revision: D35597630

fbshipit-source-id: 5e3c02ec2e5810aa58123b5e75b59241a4a1bdbb
2022-04-12 18:41:38 -07:00
Durham Goode
5b31787fa5 sparse: fix debugsparse*match apis with version 2 profiles
Summary:
Version 2 profiles are only respected when they are included by the
top-level sparse config. Instead of loading top-level config, debugsparsematch
and debugsparseexplain were loading the profile directly. This meant they didn't
see the version 2 metadata.

Let's fix it by loading a fake top-level config that simply includes the profile
in question. This matches the production behavior of how sparse profiles are
loaded anyway.

Reviewed By: StanislavGlebik

Differential Revision: D35592415

fbshipit-source-id: 71c1df08ce62ed2aba198940e7cb396e7cc5c96d
2022-04-12 18:22:09 -07:00
Durham Goode
b08a65b5da sparse: fix debugsparse* commands not treating the profile as the root
Summary:
When processing v2 profiles, the root config (i.e. .hg/sparse) is
special in that any v2 profile it loads will be unioned together. To do this, we
need to mark the root profile as isroot. Unfortunately, any command that
manually loaded a sparse profile directly, bypassed the isroot setting. This
meant loading v2 profiles was incorrect for debug commands.

Let's always set isroot for initially loaded configs. This means we should never
call getsparsepatterns with a sparse profile directly. Instead we should call it
with a .hg/sparse equivalent (like a string "%include $sparse_profile"). The
next diff will update some callsites to do this.

Reviewed By: StanislavGlebik

Differential Revision: D35594323

fbshipit-source-id: 8755d92b4fba49a0a27ae1e6298102f5b33b02be
2022-04-12 18:22:09 -07:00
Aida Getoeva
e4e9c213e4 mononoke/walker: setup thrift service
Reviewed By: markbt

Differential Revision: D35546266

fbshipit-source-id: 358afd42b332f9c0daecf5518560f633c3ac7a52
2022-04-12 17:27:17 -07:00
Aida Getoeva
34c8127c75 mononoke/walker: possible values for chunk-by-public
Summary: Chunk by public node types param has only a subset of `NodeType` as possible values. This diff declares `ChunkByPublicArg` enum to represent these variants.

Reviewed By: markbt

Differential Revision: D35532343

fbshipit-source-id: 9177a1767840c50a32a9f8387ad1ff54dc522b6f
2022-04-12 17:27:17 -07:00
Aida Getoeva
2cd4e272ca mononoke/walker: add default and possible values to the new interned types args
Summary: Interned type params allow to pass `all` as one of the possible values. This diff declares `InternedTypeArg` that represent enum with all the possible values.

Reviewed By: markbt

Differential Revision: D35503706

fbshipit-source-id: 29e51d2601dd0306ef6456d88b611e11f656a9df
2022-04-12 17:27:17 -07:00
Aida Getoeva
06555936d1 mononoke/walker: setup possible values for hash validation args
Summary: Declare `HashValidationArg` that represents specific possible values for the hash validation params.

Reviewed By: yancouto

Differential Revision: D35503707

fbshipit-source-id: da6890ca0905eae810b97827e47d26db5cfe8b1c
2022-04-12 17:27:17 -07:00
Durham Goode
510950a0eb journal: handle corrupt lines
Summary:
The journal serialization format is newline delimited, and if there is
any corruption in the file (like after a reboot, or if multiple processes try to
write at once), the newline delimits could get out of whack. Let's not crash if
that happens.

Differential Revision: D35596518

fbshipit-source-id: b995f57f764ea2c3b31f309424726f1580542184
2022-04-12 16:54:47 -07:00
Jeremy Braun
1a94fb7032 Add new PathError to mimic InodeError's behavior with a raw path
Summary: Upcoming work needs to return errors that look like `InodeError` today, but are rooted in a path, not an inode. Move most of the functionality of `InodeError` into a new `PathErrorBase` class, and then rework `InodeError` to inherit from that. Also add the new `PathError` for use later.

Reviewed By: xavierd

Differential Revision: D35517826

fbshipit-source-id: 679505e4fd9b1d1548f7bb2d7a2f6dab0b12c6ab
2022-04-12 16:50:22 -07:00
Jun Wu
b98bb24ee1 rage: fix hgcmd for sub-command and flags with -
Summary:
Fix issues caused by D35302972 (e8fdef2f4b):

  hg cloud status: (0.04 s)
  ---------------------------
  Traceback (most recent call last):
    File "/opt/fb/mercurial/edenscm/mercurial/cmdutil.py", line 873, in findsubcmd
      aliases, entry = findcmd(cmd, table)
      # cmd = 'cloud status'
    File "/opt/fb/mercurial/edenscm/mercurial/cmdutil.py", line 868, in findcmd
      raise error.UnknownCommand(cmd)
      # cmd = 'cloud status'
  edenscm.mercurial.error.UnknownCommand: cloud status
  unknown command 'cloud status'
  (use 'hg help' to get help)
  [255]

  hg bookmarks --list-subscriptions: (0.03 s)
  ---------------------------
  Traceback (most recent call last):
  Traceback (most recent call last):
    File "/opt/fb/mercurial/edenscm/mercurial/dispatch.py", line 873, in _parse
      args, cmdoptions = cliparser.parsecommand(fullargs, c)
  cliparser.OptionNotRecognized: ('option --list_subscriptions not recognized', '--list_subscriptions')

  During handling of the above exception, another exception occurred:

  edenscm.mercurial.error.CommandError: ('bookmarks', 'option --list_subscriptions not recognized')
  hg bookmarks: option --list_subscriptions not recognized
  (use 'hg bookmarks -h' to get help)
  [255]

Differential Revision: D35595560

fbshipit-source-id: bdbfa6f917c70e4f71399ecfafabdbc80ca3403e
2022-04-12 16:28:33 -07:00
Durham Goode
3636989055 uncommit: prefetch file history
Summary:
hg uncommit would do serial fetches from the network for every file
being uncommitted. In a large commit this could take several minutes. Let's
instead batch fetch the needed history ahead of time.

Reviewed By: quark-zju

Differential Revision: D35589155

fbshipit-source-id: ab37431b70cc8b37615ba93693f22259a0fced78
2022-04-12 16:27:06 -07:00
Muir Manders
b7c3c8d6d4 sparse: add some super noisy tracing
Summary: Add trace events for every file/directory match.

Reviewed By: quark-zju

Differential Revision: D35433751

fbshipit-source-id: 768d72bcb6070bc09bdf752bf0b35903ac3c0baa
2022-04-12 14:08:46 -07:00
Muir Manders
6ba1a677d2 sparse: allow adding per-rule source information
Summary:
Now when parsing we look for a magic comment e.g. "# source = hgrc.dynamic" that lets you specify additional source information for the (lexically) following rules. This is a hook meant for the rules that get inserterted dynamically from the config.

This approach has two advantages:
1. By embedding the info in the profile text itself it keeps the "fetch the data" callback interface clean and simple.
2. By using a comment, the profile contents will be backwards compatible with the Python sparse handling should it ever get persisted to a file.

Reviewed By: quark-zju

Differential Revision: D35157968

fbshipit-source-id: d69b6505a54fc3948b4733167c84291d6236b7e7
2022-04-12 14:08:46 -07:00
Muir Manders
64d4d818d5 sparse: add explain() functionality
Summary:
Add sparse::Matcher::explain() which tells you what rule if any matched a given path.

To do this we pipe along the rule origins into the Matcher object. It looks up the proper origin based on which rule in which matcher matched.

Reviewed By: quark-zju

Differential Revision: D35157967

fbshipit-source-id: bc1fd46b90ae03ea03bc197152aec4fbc34ce57e
2022-04-12 14:08:46 -07:00
Muir Manders
fc6b0a7098 sparse: create matcher from sparse profile
Summary:
Smash all the sparse rules together to create a pathmatcher::Matcher object. The main complexity comes from the v1 vs v2 differences in semantics.

I return a concrete type sparse::Matcher that manually composes multiple TreeMatchers together. I need to keep the objects separate for upcoming "explain" functionality to be able to work backwards from the matcher to the original sparse rule.

Reviewed By: quark-zju

Differential Revision: D35157975

fbshipit-source-id: 2aaad3701c02e3e28924676452016037657174c3
2022-04-12 14:08:46 -07:00
Muir Manders
0fcec62445 pathmatcher: separate out UnionMatcher logic
Summary: Move the unioning logic to associated functions. This makes it easy for other matchers to "manually" perform a union operation while still keeping the underlying matchers separate.

Reviewed By: quark-zju

Differential Revision: D35157971

fbshipit-source-id: 34ab9ce970b3bc235aadbf4d285e84ecb0e173bb
2022-04-12 14:08:46 -07:00
Muir Manders
b979ed9d5a sparse: convert sparse patterns to treematcher globs
Summary: This is a subset of the various prep work Python does. We only support "glob" and "path" rules for now.

Reviewed By: quark-zju

Differential Revision: D35157969

fbshipit-source-id: e6d6dc58fb142a3ef26486a2cf070ac3a3df3d3c
2022-04-12 14:08:46 -07:00
Muir Manders
88285bd19c types: fix relativize tests on Windows
Summary: Fix tests to expect the right path separator. The relativizer stuff says it produces strings to show the user, so I presume showing Windows users backslashes is appropriate.

Reviewed By: quark-zju

Differential Revision: D35478523

fbshipit-source-id: 4cd5ef5e1875b6a02fa19b66061d6d8936e5bd06
2022-04-12 14:08:46 -07:00
Muir Manders
ed41c5d88d util: split out normalize(&Path) from absolute(&Path)
Summary:
Rust lacks a lexical-only path simplifier in the std library, but we have it implemented mostly as part of utils::path::absolute(). Split it out in to a separate function.

I introduced some edge case handling to be consistent with Python's os.path.normpath and Go's filepath.Clean.

Reviewed By: quark-zju

Differential Revision: D35157972

fbshipit-source-id: 9a3415fd12e3fe1d7c06ac7d66f22b280ece4a5b
2022-04-12 14:08:46 -07:00
Muir Manders
7fdb0ecf7b sparse: support flattening profile to list of rules
Summary:
Add rules() method to resolve %include statements and return a flat list of a profile's rules. Each rule is also accompanied by a String describing where it came from (i.e. the path of profiles).

I made this async and abstracted the content fetching so non-hg code can use this to parse sparse profile.

Reviewed By: quark-zju

Differential Revision: D35157970

fbshipit-source-id: 3a6d2a20690f57ed6ed38355a3000f174d69036a
2022-04-12 14:08:46 -07:00
Muir Manders
e30270055f sparse: start rust lib w/ basic parsing
Summary: Start of a rust library for dealing with sparse profiles. In this commit we just know how to parse a single profile given the bytes.

Reviewed By: quark-zju

Differential Revision: D35157974

fbshipit-source-id: af4dae36fef08b69e827c6cb4e571d89b7c7ffbd
2022-04-12 14:08:46 -07:00
Muir Manders
1eb2951bd9 sparse: allow running "sparse explain" in EdenFS repos
Summary: Do the same trick we for some other sparse commands to allow usage in eden repos.

Reviewed By: StanislavGlebik

Differential Revision: D35506423

fbshipit-source-id: b02f8f76f18acbbd24431da0d41b8322b9556658
2022-04-12 09:32:03 -07:00
Muir Manders
55ac01ab81 rage: don't shell out for debugnetworkdoctor
Summary: Use the new and improved hgcmd which supports native rust commands.

Reviewed By: quark-zju

Differential Revision: D35566830

fbshipit-source-id: d9d0fd7fe9bf1cebbeb565341937de2aa9fc5f18
2022-04-12 09:23:42 -07:00
Yan Soares Couto
55b27ec8f3 Integrate parallel batch derivation for all deleted manifests
Summary:
This integrates the code added on D35426790 (a65b6b597e) and actually uses it for batch derivation on both deleted manifest types.

This involved doing some logic very similar to `derive_fsnode_in_batch` (https://fburl.com/code/y887jht1), which apparently was done separately for every manifest type. It has a few differences, like calculating the input to the parallel derive separately, and accepting file/dir conflicts.

I also added a tunable so that quick reverts to this change can be done.

Reviewed By: farnz

Differential Revision: D35549630

fbshipit-source-id: a1179878e8a9de48c46703cc18f4a9703592dbb0
2022-04-12 06:03:50 -07:00
Yan Soares Couto
12de61bfe5 snapshot: Improve parent uploading to commit cloud
Summary:
Right now we continue silently if parent upload to commit cloud fails, which may cause more cryptic errors in Mononoke requests. Let's fail early with a good error message.

I also changed slightly how to find the parents, using the same logic as we use to send the parents to Mononoke, for sanity.

Reviewed By: mitrandir77

Differential Revision: D35499845

fbshipit-source-id: c97359ebd879554b7ac659db194af22689cba55c
2022-04-12 03:52:14 -07:00
Andres Suarez
0b8b18c3ce Remove packed_simd_2_dummy, prost-02, prost-types-02
Reviewed By: dtolnay

Differential Revision: D35550164

fbshipit-source-id: 5a939392244f2206c7c44de5711a08732c6b30c1
2022-04-11 18:55:39 -07:00
Muir Manders
dcdc3745d2 configparser: try harder to find non-repo config cache dir
Summary: A recent change (D34839333 (acb03a4ce9)) started loading dynamic config for commands run outside a repo. We use dirs::cache_dir() as the config cache dir, but that has proven unreliable in certain production environments. Now instead we also try HG_CONFIG_CACHE_DIR if it is set, and finally fall back to std::env::temp_dir() if all else fails.

Reviewed By: quark-zju

Differential Revision: D35519337

fbshipit-source-id: e24b2a20ee20f358012b3b2326c7537ca206382f
2022-04-11 16:21:10 -07:00
Jason White
55695a98ac third-party/rust: Update tempfile to v3.3.0
Reviewed By: jsgf

Differential Revision: D35477506

fbshipit-source-id: ef10c8f7548a21c0fb3d83d5debfe2e000657d08
2022-04-11 15:18:36 -07:00
Stanislau Hlebik
f20dee15e2 sparse: add a test to prevent debugsparsematch regressions
Summary:
I'd like to use debugsparsematch in
[validate_sparse_profiles.py](https://www.internalfb.com/code/fbsource/tools/scm/sparse/arvr/.castle/validate_sparse_profiles.py)
script. The reason for doing that is because it has it's own sparse matcher
logic, which does not support sparse v2, which in turn causes failures on diffs
like D35461391.

Instead of reimplementing sparse match logic I'd suggest to just shell out to
hg (FWIW, we are already shelling out for buck in this script).

My biggest concern is that `debugsparsematch` is a debug command, and so in
theory it's format and/or input arguments can be changed and break
validate_sparse_profiles script. To prevent that I've added a small comment

Differential Revision: D35552480

fbshipit-source-id: cb781d749a7bff2eb8e6d4fcd234962eccc16970
2022-04-11 15:10:01 -07:00
Jun Wu
d7d5aceae8 test-megarepo-fixup-history: stabilize test output
Summary:
The revision numbers aren't stable in this test - rev 6 and 7 might be swapped.
Avoid testing revision numbers and check the graph in a way that works for both
cases.

Reviewed By: sggutier

Differential Revision: D35559269

fbshipit-source-id: 17546c50b0ae9c520a0c59f1f678b91cae81e89b
2022-04-11 14:36:48 -07:00
Xavier Deguillard
9b18fad80d config: add reset state in SNAPSHOT
Summary:
In order to properly support reset on Windows, EdenFS needs to keep track of
both the checked out revision, and the reset one. Since this state needs to
persist across EdenFS restarts, we'll need to store it in the SNAPSHOT file.

This diff merely adds support for this new SNAPSHOT format, but doesn't write
it.

Reviewed By: chadaustin

Differential Revision: D35448641

fbshipit-source-id: 59fbafdadc885dfec8efd119c4fe1ff582987af0
2022-04-11 12:53:30 -07:00
Jun Wu
88ec7b3e90 dag: do not crash when building higher level segments with gaps from previous level
Summary:
This resolves "bug: level n segments [.., ..] are not sorted or connected!" in some cases.

A more ideal solution might be just filling the gaps. For now let's make it stop crashing
first.

Differential Revision: D35548449

fbshipit-source-id: fd79fe2ade866f3ba1501c196d07f75d2b1c11ee
2022-04-11 12:02:43 -07:00
Jun Wu
a452ebfe49 dag: add a test about strip->reinsert->build_higher_level_segment bug
Summary: See the added test.

Differential Revision: D35548450

fbshipit-source-id: a1e1d889b88bfcf15030659a0dd4869b7f38ff80
2022-04-11 12:02:43 -07:00
Jun Wu
8c7ea28d84 dag: verify TestDag integirty after strip
Summary:
This helps detect issues. Changed problems from `assert_eq!` to `assert!` so
they cannot be auto updated by `cargo-fixeq`.

Differential Revision: D35548448

fbshipit-source-id: 84ef027bdff12ee9b73f7dd277f426f861007b4c
2022-04-11 12:02:43 -07:00
Jun Wu
ad893a3ed7 dag: update check_segments rules
Summary:
With discontinuous segments, segments in a group no longer need to be adjacent
to each other.

The `ONLY_HEAD` flag is an optimization. It does not have to be set.

Differential Revision: D35548451

fbshipit-source-id: 3c5396e5429876293fe452507d380a900127e7a9
2022-04-11 12:02:43 -07:00
Jun Wu
4db1c74f89 dag: add more tracing logs in high level segment building
Summary: This is used to debug an issue.

Differential Revision: D35548447

fbshipit-source-id: 3afb1a8045b64f9b79c022e759ac7c0a520f9804
2022-04-11 12:02:43 -07:00
Harvey Hunt
f03383279a mononoke: Acl check BYPASS_READONLY pushvar
Summary:
The `BYPASS_READONLY` pushvar can be passed to ignore the lock status
of a repo, or push to a read only repo. This functionality was used by commit
cloud in the early days of the Mononoke rollout. However, we now only check
whether a repo is read only during bookmark movement.

Update Mononoke to check that a user is allowed to use the pushvar before
bypassing it.

Reviewed By: markbt

Differential Revision: D34390881

fbshipit-source-id: e016fbb6ef74de6bc7e4cb92069b984a863da15f
2022-04-11 11:04:22 -07:00
Yan Soares Couto
94ce7df962 Reuse more code between manifest versions
Summary:
By adding some more requirements to RootDeletedManifestIdCommon, it was possible to remove some more duplicated code between DM versions.

I'm doing this to simplify code, and because I'll add the batch derivation on this level as well.

Reviewed By: kris1319

Differential Revision: D35463189

fbshipit-source-id: 9f896e4faf795a00334db773288894a0f110c8fd
2022-04-11 11:00:17 -07:00
Yan Soares Couto
a65b6b597e mononoke][dm] Add method to derive deleted manifest for a simple stack
Summary:
This is basically a port of D30989888 (35a7998c07) to deleted manifests, and enables batch derivation for them. It does not have the limitation that commits can't delete files and turn them into directories.

The basic idea here is to parallelise the derivation in the tree, not in the commits. I added a comment explaining this idea in code, see the diff's contents.

This diff adds just a helper function for that, which I will integrate into the usual batch derivation trait in a following diff.

I didn't port the optimisations in the non-batch code: Batching some writes to blobstore and using a local mutexed hashmap to avoid double writes. I will add them in a following diff if unless I disprove their efficiency.

Reviewed By: farnz

Differential Revision: D35426790

fbshipit-source-id: 7432617737323a3e3854f4ba347bc86e8043ab2e
2022-04-11 11:00:17 -07:00
Muir Manders
75cb95532a purge: don't do --dirs by default
Summary:
Previously "hg purge" would do "hg purge --files --dirs". However, that is slow since there is no fast way to find all empty directories to satisfy the "--dirs". Also, this behavior was somewhat surprising because the docs suggest --dirs is not included by default. Change the behavior to default to just --files (but add a config knob so we can revert this behavior quickly if needed).

Empty directories are normally invisible, and my presumption is very rarely the user cares about empty dirs when purging.

Reviewed By: yancouto

Differential Revision: D35515752

fbshipit-source-id: 3d4ab97309de1a9ef82987486fbbd1dbea3b91d8
2022-04-11 07:00:10 -07:00
Simon Farnsworth
97c3aadfce Clean up mutable renames API
Summary: markbt pointed out that a couple of items in the API were non-idiomatic. Change them to match idiom.

Reviewed By: markbt

Differential Revision: D35504087

fbshipit-source-id: 2eba98e6be834ae4d44a0d4923a58007750a8139
2022-04-11 06:38:15 -07:00
Simon Farnsworth
ed02c0ff9b Fix confusion in SCS around mutable renames
Summary: I misunderstood the use of MPath in mutable renames. Fix behaviour to match the reality

Reviewed By: markbt

Differential Revision: D35478916

fbshipit-source-id: 90984a28548226e18dd88468de5d41531fa0241d
2022-04-11 06:38:15 -07:00
Mark Juggurnauth-Thomas
b35b40aba8 tools/admin: move hg-sync subcommand to new admin command
Summary: Move the `admin hg-sync-bundle` command into `mononoke-admin`.  It controls all aspects of `hg-sync` (not just bundles), so just call it `hg-sync`.

Reviewed By: kris1319

Differential Revision: D35395745

fbshipit-source-id: 0fe0a139c0e44ffb84e16ef3154f4cd2f9c0c53a
2022-04-11 06:01:54 -07:00
Mark Juggurnauth-Thomas
8844a6cfae testtool: move write_stub_log_entry into testtool
Summary:
Migrate the specialist `write_stub_log_entry` test tool into a subcommand of `mononoke_testtool`.

The existing tool is a bit of a misnomer: while it's purpose is to add entries into the bookmark update log, it actually does so no by writing stub entries, but by actually moving the bookmark.   So let's name the subcommand what it is: `modify-bookmark`.

Reviewed By: kris1319

Differential Revision: D35395744

fbshipit-source-id: 3aff8acfd65090559ca90a4e3f89f2806586a5f9
2022-04-11 06:01:54 -07:00
Huapeng Zhou
2d8e387606 rust: update serde_json to 1.0.79 and serde to 1.0.136
Summary:
Needed to import [cloud-hypervisor](https://github.com/cloud-hypervisor/cloud-hypervisor).

(Note: this ignores all push blocking failures!)

Reviewed By: dtolnay

Differential Revision: D34433589

fbshipit-source-id: f92ea3ba640d19f170513b558f3d5208790bab67
2022-04-10 23:39:55 -07:00
Jun Wu
1517b03a3e git: fix uncommit
Summary:
Fix crash on uncommit about missing "renamed" method.

For now we just treat that no renames are tracked. Later we might want to
properly fix rename tracking.

Differential Revision: D35518154

fbshipit-source-id: 4082428d408385f9a2fe22d5720aa81a1b59b5e4
2022-04-09 10:31:56 -07:00
Jun Wu
008c051290 match: treat simple fileset as non-fileset patterns
Summary:
The fileset DSL scans through all files. For simple fileset expressions such as
`set:*.py` or `set:a.py or b.py`, convert them to non-fileset patterns for better performance.

Differential Revision: D35490968

fbshipit-source-id: 5452d325040859d02bd66256571803c8229a8b88
2022-04-08 18:07:36 -07:00
Jun Wu
a00403bd6e debugfileset: compare fileset output with ctx.matches output
Summary: This will be used to verify the next change.

Differential Revision: D35490966

fbshipit-source-id: 22896e421b515d436e15f69c3aa4e26ad8411f1e
2022-04-08 18:07:36 -07:00
Jun Wu
820aa79acf fileset: avoid listing all files for matcher matches
Summary:
Change the runtime of the fileset DSL to not eagerly list files if possible.
This should speed up patterns (stringset), and certain filesets like "unknown()".

This should make `hg debugfileset PATTERN` fast.

Differential Revision: D35500777

fbshipit-source-id: d1477de1703ea611aeaa893883c92d474c066cc0
2022-04-08 18:07:36 -07:00
Jun Wu
d7657eba40 fileset: avoid O(N^2) for "or"
Summary: Change `x in list` to `x in set` to improve time complexity.

Differential Revision: D35500778

fbshipit-source-id: 05b81180b19e171f241483b939e408e4e477525c
2022-04-08 18:07:36 -07:00
Jun Wu
bd5c8cb00d test-fileset: resolve a DeprecationWarning
Summary: This makes the test pass with `run-tests.py --chg`.

Differential Revision: D35490967

fbshipit-source-id: bbc729103c26565aa7447743ba181642818d1253
2022-04-08 18:07:36 -07:00
Saul Gutierrez
c1053b4565 revset: add test for making sure that docstrings are not empty
Summary: This adds a test for preventing ourselves from adding revsets without docstrings (which would not show up when running `hg help revsets`), and also adds a way of marking revsets that we explicitly want to hide.

Differential Revision: D35372411

fbshipit-source-id: 1b63402fc63bc6cb786b87f14145f653f22f21ce
2022-04-08 15:11:23 -07:00
Simon Farnsworth
be7a2b9528 Use path hash, not path, in Memcache keys
Summary: Memcache doesn't like spaces in keygens; paths can have spaces in. Use the path hash instead, which is guaranteed to not have spaces

Reviewed By: markbt

Differential Revision: D35478914

fbshipit-source-id: 54fb025bf45361d5ed8ed71d0303c25e1889cf8c
2022-04-08 14:55:47 -07:00
Simon Farnsworth
9816fdfbe4 Add repo ID to cache keys for mutable renames
Summary: This hasn't mattered so far, because ChangesetId is usually unique across repos, but this is not guaranteed (e.g. in megarepo merges)

Reviewed By: markbt

Differential Revision: D35478915

fbshipit-source-id: 573797d438db27e0b6897f894602048a5c2b4c27
2022-04-08 14:55:47 -07:00
Simon Farnsworth
435e217996 Comment the obscure bits of mutable renames
Summary: I didn't understand this on first run through this code, so made mistakes. Add comments to fix this up

Reviewed By: markbt

Differential Revision: D35478917

fbshipit-source-id: 046caf4dffc9a775795b0e74795383078c714e10
2022-04-08 14:55:47 -07:00
Xavier Deguillard
d6f5cad598 cli: remove implementation of eden strace
Summary:
This is the same as `eden trace fs`, redirect people to that. The command will
simply be removed later.

Reviewed By: fanzeyi

Differential Revision: D35483104

fbshipit-source-id: bdacda6c5e6f9d8d809f44b64b1178aacbee4228
2022-04-08 12:09:27 -07:00
Jun Wu
ab764ac950 update test-megarepo-fixup-history.t
Summary:
The graph output is slightly changed, probably caused by recent client-side dag change.
It does not affect correctness.

This is found by https://www.internalfb.com/diff/D35478351?dst_version_fbid=693252335199916.

Differential Revision: D35506537

fbshipit-source-id: 35f6cbac28b5ec8205e2cae73040422cf868e880
2022-04-08 11:58:09 -07:00
Genevieve Helsel
3e9c2a677f add cli description for trace hg outlining emoji key
Summary: Adds a description for `eden trace hg` which outlines the meaning of the different emojis used

Reviewed By: kmancini

Differential Revision: D35473126

fbshipit-source-id: 32c67aa728cf2065255cfbb0227eb52f74d672df
2022-04-08 10:09:52 -07:00
Saul Gutierrez
dfd39a2ba9 repo: add changelog into Rust repo
Summary: Similarly to D35294917 and D35256084, this makes the Rust repo object hold the changelog (`dag_commits`) object. Notice that unlike its Python version, caching is not done on disk.

Differential Revision: D35360056

fbshipit-source-id: 04e51dc75665dcc52aa28b09909f5a60b12493b4
2022-04-08 09:37:32 -07:00
Saul Gutierrez
fdd5e9780c repo: add EdenAPI into Rust repo
Summary:
Adds a method for making the Rust repo object hold the EdenAPI, and uses it for replacing `edenapi.getclient`.

Since most of the config checks done on the Python side don't seem to be useful in the new Rust world (most of them were used for testing), porting them or adding them to the bindings was simply not done.

Differential Revision: D35295652

fbshipit-source-id: 3058b02f2bb18d5a9b0697b0114e2c966fef5b73
2022-04-08 09:37:32 -07:00
Saul Gutierrez
5a356d1d0f repo: make the Rust repo object hold a copy of the config object
Summary: Before this change, the inner Rust repo would load its own config object, which would cause manually configured options to be disregarded. These are used, among other things, to configure paths for loading the EdenAPI.

Differential Revision: D35294917

fbshipit-source-id: a85613b488f7da82590275ea6f755f1b98aad297
2022-04-08 09:37:32 -07:00
Saul Gutierrez
c8bef39414 repo: add metalog into Rust repo
Summary: Adds a couple of methods for making the Rust repo object handle the metalog, and makes use of this on the Python side. Since the way the metalog is used in Python is tightly coupled with the VFS object, trying to make use direct of it would be rather complicated, so we are still going to use it through the VFS object.

Reviewed By: quark-zju

Differential Revision: D35256084

fbshipit-source-id: 273ad118ebbeb72e04f43020e2c48cab4958d162
2022-04-08 09:37:32 -07:00
Saul Gutierrez
17edc620ae init: remove the use of init.use-rust config for inner Rust repo object loading
Summary:
Recently, a check was added for avoiding loading the inner Rust repo if `init.use-rust` was not enabled. This was a mitigation for users seeing excessive reloads in the reponame file caused by the reload of the dynamic config, which was caused by the loading of the inner Rust repo object.

This also should be fine since we are rolling that config to users this week anyways.

Reviewed By: quark-zju

Differential Revision: D35300521

fbshipit-source-id: bba2e37217f8bd3cdd11c6091c404389ec3c3b2b
2022-04-08 09:37:32 -07:00
Yan Soares Couto
11f955b360 Add some more Debug requirements
Summary:
This adds some QoL stuff to some traits/structs, like requiring Debug/Clone. Most of this is not
strictly necessary but makes it easier to add debug statements and inspect the code.

Reviewed By: markbt

Differential Revision: D35434704

fbshipit-source-id: bd69ecd06e9186b47a8088ef533d3f7d8d846107
2022-04-08 08:37:41 -07:00
Yan Soares Couto
2e2110d214 Do for concurrently for efficiency
Summary:
On this part of the algorithm, we do a bunch of serial awaits, but they don't need to be serial, we can run them together.

 ---

Partly related, I am also considering changing `lookup` function to take a vec of things to lookup so we can look them up together more efficiently, which would help here (specially on DMv2), but it might be a bit overkill as cache should already help a lot here.

Reviewed By: markbt

Differential Revision: D35399538

fbshipit-source-id: 19902c2881edb2e078a390972b7e1f7fe3298d86
2022-04-08 08:37:41 -07:00
Yan Soares Couto
528b50e3aa Add validator to compare to dmv1
Summary: This makes the `backfill_derived_data validate` command check for consistency of DMv2 with DMv1, to make sure they work exactly the same.

Reviewed By: markbt

Differential Revision: D35394945

fbshipit-source-id: e92511123665b6d89ceafd473593c1961da8e759
2022-04-08 08:37:41 -07:00
Yan Soares Couto
c4f133de8c Add limit to dump_public_changeset_entries
Summary:
This makes it easier to incrementally dump changesets to a file.

I didn't find a perfect way to limit the output, but this should do for now.

Reviewed By: kris1319

Differential Revision: D35359394

fbshipit-source-id: f354f62b34aec4e393c9496af7d4bc2558ad7676
2022-04-08 08:37:41 -07:00
Yan Soares Couto
271395e5e0 Support dm2 in walker
Summary: Functionally the same as the support for DMv1. Needed to add a bunch of nodes and edges everywhere, but luckily the compiler was able to guide me.

Reviewed By: kris1319

Differential Revision: D35355036

fbshipit-source-id: e8fd7a7d39ae92bd2b9173defe6e1296c68c79b6
2022-04-08 08:37:41 -07:00
Yan Soares Couto
d87e4a6a6a Implement derived data traits for deleted manifest v2
Summary:
This diff implements all the necessary traits to transform dm2 into "proper derived data". Unfortunately I couldn't break it out further as they all depend on each other.

- BonsaiDerivable knows how to "derive a deleted manifest v2" (which reuses the same code from v1), and to store mapping.
- RootDeletedManifestIdCommon ties the classes together and allows us to reuse the same code as v1.
- This also adds the thrift config for the derived data, and necessary code on test repo to be able to derive it in tests.

Reviewed By: kris1319

Differential Revision: D35319579

fbshipit-source-id: e4670fa2dc2f73ad8f476d51571e25e55169fd0b
2022-04-08 08:37:41 -07:00
Yan Soares Couto
fb5abf97e6 Implement DeletedManifestCommon trait
Summary:
This diff implements the DeletedManifestCommon trait for Deleted Manifest v2, meaning it can "behave like a deleted manifest".

The trait was added several diffs ago to maximise reuse of code between both manifest versions.

Reviewed By: kris1319

Differential Revision: D35318240

fbshipit-source-id: 19899fb9e02a76feee321898b353417453f1e07f
2022-04-08 08:37:41 -07:00
Yan Soares Couto
19daca183f Base rust code to interface with thrift and blobstore
Summary:
This adds the rust boilerplate counterpart to DeletedManifestV2 added on the previous diff to thrift config.

It doesn't have anything special, only the reading/writing to thrift and to the blobstore.

Reviewed By: kris1319

Differential Revision: D35315948

fbshipit-source-id: c66c4300be0e3bc1f07e06344a62263bca1574d2
2022-04-08 08:37:41 -07:00
Yan Soares Couto
ee8907162f Add DMv2 thrift definition
Summary: Basically identical to the DM v1 definition, but it uses a `ShardedMapNode` instead of a `map<MPathElement, DeletedManifestId>`

Reviewed By: kris1319

Differential Revision: D35315612

fbshipit-source-id: dcb7963bbcec7dab1f2154b326bf4a1839449582
2022-04-08 08:37:41 -07:00
Yan Soares Couto
9e00400909 Store size on edge, not node
Summary:
This changes sharded maps so the size is stored on the edge, not on the node itself. See [1] for more discussion.

This has a few advantages:
- No need to load the node to know the size.
- This makes it possible to do some optimisations, see [2]
- Since we can easily look at the sizes of children, we don't need to be super extra careful to keep the correct size while updating the map, and can just calculate it at the end. See [3] where code is a little cleaner.

And disadvantages:
- Code is a little more boilerplaty, as it needs yet another struct to hold the additional size.
- To calculate the size of the current node, we need to traverse the children. That should not be a big deal as we have to load them anyway. I also put it behind a OnceCell so it's not inefficient.

IMO I'm fine with going either way. I think size on edge is a little uglier to code but a little more practical, so I prefer it. But I'm fine to go with size-on-node if someone else has a stronger opinion.

markbt has thought about this and might have opinions. I don't think using a separate node is good as this is only for size (which is necessary for the algorithm to be fast, not "aggregated data").

Reviewed By: markbt

Differential Revision: D35314803

fbshipit-source-id: 13f488dbbc5cf07a82fac9d0e638682c7d9fd926
2022-04-08 08:37:41 -07:00
Yan Soares Couto
2276949cfe Implement logic for update
Summary:
**Context:** Sharded maps will be used on deleted manifest v2

This diff adds the implementation for the `update` function, which generalises all write operations (adding and removing elements). This is the meat of all the "improved deleted manifest" stuff, most of the other things on top will just be adaptors and boilerplate code.

As it generalises both operations, it needs to deal with all the details of keeping the optimisations in place, plus we also need to be careful so that the structure is history-independent (which should be the case if we keep use the optimisations correctly).

This is a complicated diff, and I recommend also reading [this explanation](https://fburl.com/lnusbzgl) to understand the code. I'm also happy to set a 1:1 and whiteboard the logic to make it clearer.

Reviewed By: markbt

Differential Revision: D35288510

fbshipit-source-id: fc2c1eb0f92dff7c131c4e742007886b0d01196a
2022-04-08 08:37:41 -07:00
Yan Soares Couto
d31702508f Implement Default and blobstore store method
Summary:
**Context:** Sharded maps will be used on deleted manifest v2

This diff adds Default implementations for sharded maps and its substructs, and also a `store` implementation that stores the current map in the blobstore.

These will be used on update but are reasonably separate from it, so I'm putting it on its own diff.

Reviewed By: kris1319

Differential Revision: D35253317

fbshipit-source-id: 1d71917dff0079608d4a086d11396a1bfb8537d6
2022-04-08 08:37:41 -07:00
Yan Soares Couto
00260fb594 Implement logic for into_entries
Summary:
**Context:** Sharded maps will be used on deleted manifest v2

This diff adds the logic for the `into_entries` operation on sharded maps. That's the equivalent to `.into_iter` on a regular map.

We take special care to only load things in memory as needed, which should mean we never need to load more than a couple of blobs in memory at the same time.

Reviewed By: kris1319

Differential Revision: D35251932

fbshipit-source-id: 0005b34f254180afd78d112a34b2de067f968e80
2022-04-08 08:37:41 -07:00
Jan Mazur
4c2458a9d1 import git-config with patch #372 and #377 backported on 0.1.11
Summary: I did submit another fix to upstream, then I backported it on top of 0.1.11.

Differential Revision: D35494891

fbshipit-source-id: 4ba29ba35e556926b30e9c47569381d506d1b8a7
2022-04-08 07:59:13 -07:00
Andreas Backx
180ac8ecc6 upgrade tracing-subscriber from 0.3.9 to 0.3.10
Summary: 0.3.10 adds a new EnvFilter builder that I would like to use. :)

Reviewed By: wqfish

Differential Revision: D35473723

fbshipit-source-id: df31dad09c8f8fc9c27a43c85b5d6ac8f97d69a3
2022-04-08 04:00:03 -07:00
Yipu Miao
ffab8acc6a SetPathObjectId should avoid mount-wise operations
Reviewed By: chadaustin

Differential Revision: D35104663

fbshipit-source-id: 0dd00e3a1a3f8af9869b7eca459bb622cab66992
2022-04-07 16:15:41 -07:00
Katie Mancini
3893aa9cf6 log extra connections to NFS server
Summary:
We have seen that sometimes the a client sends us nfsv4 requests with the
nfsv3 version on it.

We fail to parse those.

It's likely the kernel that is sending us that event, but technically any client
could connect to us, so we don't know that for sure.

Let's make sure we log if we see more than one client connected to us. so that
we can confirm if this is the kernel or not.

We should probably also not let non kernel clients connect to us. But I have not
figured out how to do that. tbd

Reviewed By: fanzeyi

Differential Revision: D35448531

fbshipit-source-id: e0810c8961c18b305b80bb874ae4f6aee9583d07
2022-04-07 15:34:08 -07:00
Sean Karlage
937c5b0010 Allow XDG_CACHE_HOME in Eden environment
Summary:
ASIC homedirs are stored on NFS. Eden/hg's new caching solution by default places contents in the home directory which can lead to concurrency issues when reading/writing to this shared NFS cache dir, especially for CI (which all runs as the same user).

To mitigate, we can set XDG_CACHE_HOME to point to a non-NFS directory where cached contents should be written. However, Eden only propagates these allowlisted environment variables throughout the lifetime of the EdenFS daemon. Let's ensure we can also pass XDG_CACHE_HOME through to the daemon process as well.

Reviewed By: chadaustin, mrkmndz

Differential Revision: D35402429

fbshipit-source-id: 0ce5b71838bcf384ea20427cf01b2fe9a107f69c
2022-04-07 14:42:03 -07:00
Mateusz Kwapich
9b371e22a5 new security_checker facet
Summary:
Until now we had 3 different ways of permission checking in Mononoke across our
3 surfaces (scs server, writeproto and eden api). Let's start unifying them by
moving the wireproto logic to from repo_listener to its own facet.

In this diff I'm moving the mononoke-server logic to the new facet as-is (that
is without changing the logic. In the next diffs I will migrate other monoonke
ACL checks to use it.

Reviewed By: HarveyHunt

Differential Revision: D35178977

fbshipit-source-id: befbcb5e78482efc09558838846cc20c76655ae7
2022-04-07 13:25:22 -07:00
Genevieve Helsel
8430ff731c show import priority and cause in eden trace hg
Summary:
This aims to let `hg trace hg` answer the "why was this blob/tree imported" question.

Emojis chosen (welcome to suggestion here):
HgImportPriority::LOW �
HgImportPriority::MEDIUM �
HgImportPriority::HIGH �

HgImportCause::UNKNOWN �
HgImportCause::FS �
HgImportCause::THRIFT �
HgImportCause::PREFETCH �

Reviewed By: kmancini

Differential Revision: D34966918

fbshipit-source-id: ed830510752b53b01bcab53b4a8e0a8d4b3c7974
2022-04-07 13:05:18 -07:00
Xavier Deguillard
8cd52b7b99 eden: query EdenFS instead of Mercurial
Summary:
EdenFS does support answering a status query between 2 commits, by using it, we
can avoid forking to Mercurial which is a very expensive operation. We can also
benefit from EdenFS computing these concurrently instead of running these
status sequentially.

The code is almost identical to the one present in scm/Mercurial.cpp with some
copy/pasted bits. The main difference being the lack of LRU caches. I've
decided against these LRU caches as I've noticed Watchman consumming a large
amount of memory due to the status call potentially containing a very large
amount of strings. Since the cost of asking EdenFS for status should be
significantly less than Mercurial (no Python startup time, no Python code,
etc), not having caches is likely OK.

Lastly, we still fallback to the `hg status` path when alwaysIncludeDirectories
is set to avoid complexifying the code.

Reviewed By: chadaustin

Differential Revision: D35445851

fbshipit-source-id: ae939b71e8f6c60e5724cde5fc42753fddae2570
2022-04-07 12:00:20 -07:00
Carolyn Busch
d9d9916258 clone: add native clone entrypoinnt
Summary: Add Rust entry point for clone command. Start by falling back to python. Later add rust clone impl and config for running rust or python clone impl. The flags and doc are copied directly from python https://fburl.com/code/24mjlvza. They'll need to be updated (the docstring in particular is very outdated), once we finalize supported options for the new clone. https://fb.quip.com/sNsnAbxMHD9 (ef5a29b32a)a

Differential Revision: D35232312

fbshipit-source-id: 2c67419308b7f6143f06adc24ecf75e1c54aba65
2022-04-07 11:41:55 -07:00
Genevieve Helsel
3693c486ae remove option to log file accesses to edenfs_file_stats_accesses
Reviewed By: kmancini

Differential Revision: D35265781

fbshipit-source-id: 1504bafb705a8f63beed2e1d215e639b4cf89f67
2022-04-07 11:18:28 -07:00
Michael Cuevas
38070d87da upload entire minidumps
Summary: We were limiting the minidump uploads to 977KB. This allows the whole minidump file to be uploaded instead.

Reviewed By: fanzeyi

Differential Revision: D35449385

fbshipit-source-id: f4d8966fee5eda312639adbc476bf9f72c1aec43
2022-04-07 09:41:57 -07:00
Michael Cuevas
208abe7820 limit the number of minidumps collected by eden rage
Summary: By default, we collect every minidump from the last week. This can be a lot. Let's limit the collection amount to 3.

Reviewed By: fanzeyi

Differential Revision: D35449132

fbshipit-source-id: 158f22b6d4083958b26f34bdfc56ba3099aa0be6
2022-04-07 09:41:57 -07:00
Michael Cuevas
822dd15348 refactor logging statement
Summary: reuse the string from earlier in the function

Reviewed By: kmancini

Differential Revision: D35334023

fbshipit-source-id: 61fc2989d5ca56eaa9c703a1725106ebb60f295f
2022-04-07 09:41:57 -07:00
Michael Cuevas
069c536a5d enable/disable notifications from E-Menu
Summary: Add the ability to enable/disable notifications from the E-Menu

Reviewed By: chadaustin

Differential Revision: D35269912

fbshipit-source-id: d51e224ea4fbf7c4c700573f7f672641a3961883
2022-04-07 09:41:57 -07:00
Michael Cuevas
8be9a1c8c1 fix updateLastShown logic
Summary: the logic used before was wrong. Fix it so that we handle all cases correctly (before we ignored the config option to turn off notifications but handled notification frequency correctly)

Reviewed By: chadaustin

Differential Revision: D35270735

fbshipit-source-id: d0be2e202fb37062e2ed73c909b9bf0e8251b343
2022-04-07 09:41:57 -07:00
Michael Cuevas
ab218e4ca4 add generic notifications to notifier interface
Summary: adds a general purpose notification method (send a notification with any title/body combo)

Reviewed By: chadaustin

Differential Revision: D34453071

fbshipit-source-id: 886fcca310c82ca50340570ecebf7182e9a72f7d
2022-04-07 09:41:57 -07:00
Michael Cuevas
57e2a0c72b change the E-Menu Guid
Summary:
An old development GUID was used. This caused some users to be unable to start Eden with the E-Menu enabled because the GUID was associated with another executable file path. See here: https://docs.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-notifyicondataa

"The binary file that contains the icon was moved. The path of the binary file is included in the registration of the icon's GUID and cannot be changed. Settings associated with the icon are preserved through an upgrade only if the file path and GUID are unchanged. If the path must be changed, the application should remove any GUID information that was added when the existing icon was registered. Once that information is removed, you can move the binary file to a new location and reregister it with a new GUID. Any settings associated with the original GUID registration will be lost.
This also occurs in the case of a side-by-side installation. When dealing with a side-by-side installation, new versions of the application should update the GUID of the binary file."

Reviewed By: chadaustin

Differential Revision: D35302987

fbshipit-source-id: 8c898a93047ae30b97853ca31400dd1c927a39f4
2022-04-07 09:41:57 -07:00
Michael Cuevas
e3db5a417e Fix stale E-Menu bug
Summary:
Shell_NotifyIcon(NIM_ADD) fails if there's a stale icon in the notification tray. This caused Eden to crash upon startup.

Instead of blindly adding each time, We should first call Shell_NotifyIcon(NIM_DELETE) to ensure any stale icons are removed.

We should also avoid crashing EdenFS if NIM_ADD fails.

Reviewed By: chadaustin

Differential Revision: D35302853

fbshipit-source-id: cf3f3062f96eada83fcde54616b2407e13779b0c
2022-04-07 09:41:57 -07:00
Michael Cuevas
3670118823 add e-menu resource file to cmake build
Summary: The Cmake build didn't properly link the E-Menu resource file. That caused EdenFS to crash on startup if users had the E-Menu enabled.

Reviewed By: chadaustin

Differential Revision: D35288550

fbshipit-source-id: 27f2f29a53ab2717fd9fd874a2cd89b81ccbb9b7
2022-04-07 09:41:57 -07:00
Huapeng Zhou
a232791ef1 rust: update anyhow to 1.0.56
Summary:
Needed by cloud-hypervisor https://github.com/cloud-hypervisor/cloud-hypervisor/blob/main/Cargo.toml#L19.

(Note: this ignores all push blocking failures!)

Reviewed By: jsgf

Differential Revision: D34432496

fbshipit-source-id: deaa320c74a22e325a116bcc0d5b0120c4f3744b
2022-04-07 04:31:34 -07:00
Ilia Medianikov
5b85e60bbe mononoke/hg_sync_job: fix flaky ensure_alive_grace_period unittest
Summary:
"false" shell command in the test sometimes finished too quickly and hit the `hg peer has died` code path so I replaced it with `sleep 0.1`.

I also noticed that for the same reason `ensure_alive_dead_process` test could hit two different code paths so I split this test in two and made them explicitly check both paths.

Testx link: https://www.internalfb.com/intern/test/562950011553744

{F718584633}

Reviewed By: markbt

Differential Revision: D35398464

fbshipit-source-id: c88debf04f5f179e580f51da0ef17db0d96770f7
2022-04-07 03:15:36 -07:00
Genevieve Helsel
5fa9133ac7 set prefetch-profiles.prefetching-enabled to default to true in the cli
Summary: This was set to default to true in `EdenConfig.h` but was not set here

Reviewed By: chadaustin

Differential Revision: D35440139

fbshipit-source-id: cf3102bea40ae639c767dd6488924fd843556d48
2022-04-06 16:52:15 -07:00
Xavier Deguillard
9e853e1409 doctor: add a Windows checker to check the sha1 of loaded files
Summary:
One of the issue some users have seen on Windows on a regular basis is when the
content of files on disk differs from what EdenFS thinks the content should be.
This leads to `hg status` not reporting the correct output and sometimes random
build failures. At first, let's try to detect these occurences. This diff focus
on only computing the sha1 of files that have been fully read already as
reading other files would force EdenFS to populate them on disk.

Reviewed By: kmancini

Differential Revision: D34776469

fbshipit-source-id: d04d31f7f7bfba85cbfbf68ce55f5490bbaec45f
2022-04-06 15:41:38 -07:00
Xavier Deguillard
1fd9b86803 doctor: add checker for materialized files
Summary:
On Windows, we've had cases where EdenFS disagrees with the state of the
filesystem. EdenFS may believe that some files are materialized, while they
aren't present on disk. This checker should ensure that we detect these cases.

In a future diff, automatic remediation will be added.

Reviewed By: kmancini

Differential Revision: D34775506

fbshipit-source-id: 3eaa1761fd8acd0fbbfd9f965b35c712c28f2f97
2022-04-06 15:41:38 -07:00
Jun Wu
e8fdef2f4b rage: support native Rust command in hgcmd
Summary: This could be potentially useful for D35302414 (2e968d8b23).

Differential Revision: D35302972

fbshipit-source-id: b8032a7128839864f1d4f07e7100f18deced4cb3
2022-04-06 12:14:26 -07:00
Aida Getoeva
adbee88778 mononoke/cmdlib: migrate the rest of walker integration tests
Reviewed By: markbt

Differential Revision: D35368757

fbshipit-source-id: 28dcd1909e16a0fde58485928941d1c5767f5f42
2022-04-06 08:15:18 -07:00
Aida Getoeva
774cf8be37 mononoke/cmdlib: migrate walker compression-benefit subcommand
Summary: Migrate the subcommand and two integration tests that check the correctness.

Reviewed By: markbt

Differential Revision: D35367702

fbshipit-source-id: b908fe7b4404fe52191f6079d96d8378e347089e
2022-04-06 08:15:18 -07:00
Aida Getoeva
c7ef30eb98 mononoke/cmdlib: migrate walker corpus subcommand
Summary: The diff migrates walker corpus subcommand over to the new clap and its integration test.

Reviewed By: markbt

Differential Revision: D35366521

fbshipit-source-id: 73c020377129772eb9fbd079fed9504bed74360e
2022-04-06 08:15:18 -07:00
Aida Getoeva
6c42cb7016 mononoke/cmdlib: migrate walker count integration tests
Summary: Unfortunately the initial test [`test-walker-count-public-chunked.t`](https://fburl.com/test/026x4co5) is flaky, so for this one I also received conflicting signal: 1 out of 5 runs I did failed. The run that failed actually was executed with other tests.

Reviewed By: markbt

Differential Revision: D35364752

fbshipit-source-id: 3a89999932d3446cb03e5bcde2fd094b720aa976
2022-04-06 08:15:18 -07:00
Aida Getoeva
694512ce8b mononoke/cmdlib: migrate walker pack info integration tests
Reviewed By: markbt

Differential Revision: D35364011

fbshipit-source-id: 39a5cc3ff2d54f7c76bb230fa57a83bcb6c824e2
2022-04-06 08:15:18 -07:00
Aida Getoeva
ab27b4c208 mononoke/cmdlib: migrate walker validate integration tests
Summary: This diff migrates tests that are checking validate subcommand behaviour. (D35360875)

Reviewed By: markbt

Differential Revision: D35363462

fbshipit-source-id: 60eb08b17c81eabf4f5aebc0806c496c23a62a63
2022-04-06 08:15:18 -07:00
Aida Getoeva
397747143b mononoke/cmdlib: migrate walker validate subcommand
Summary:
Migrate validate command to the new clap,

This diffs also introduces a new enum `CheckTypeArg` that helps to use clap to specify default value for the `include-check-type` arg and resolves directly into `CheckType`.

Reviewed By: markbt

Differential Revision: D35360875

fbshipit-source-id: 21222cd2dbfbc144efa3627af29111d8dd9ecd1c
2022-04-06 08:15:18 -07:00
Yan Soares Couto
e0d84a8727 Implement logic for lookup
Summary:
**Context:** Sharded maps will be used on deleted manifest v2

This diff adds the logic for the `lookup` operation on sharded maps. That's the equivalent to `.get` on a regular map.

Reviewed By: markbt

Differential Revision: D35248969

fbshipit-source-id: 465f0a6d02d43647bc225ae318e9ce77613089eb
2022-04-06 04:41:19 -07:00
Yan Soares Couto
4687f35910 Add example map on test
Summary:
This diff adds the example map seen on the design quip as a test for sharded maps.

It also adds some helper functions to make creation of test maps simpler.

Reviewed By: markbt

Differential Revision: D35248489

fbshipit-source-id: d3d9ee139c9057646f4b598307c8fd3e898c68b2
2022-04-06 04:41:19 -07:00
Yan Soares Couto
bc5047431d Separate v1 specific things from common
Summary: This moves v1 specific stuff to `_v1` files in `derived_data/deleted_files_manifest`. Due to all the previous refactoring, this is now just the root manifest id part, as ops and derivation are agnostic to dm version.

Reviewed By: markbt

Differential Revision: D35246790

fbshipit-source-id: 269d2a1f8eb121368b5479899875bfbf40b635c6
2022-04-06 04:41:19 -07:00
Yan Soares Couto
aa877e3f60 Basic load/store in thrift + size/empty
Summary:
**Context**: Sharded maps are going to be used in DMv2 implementation.

This diff adds the basic boilerplate code for working with sharded maps in Rust. Algorithms are coming later.

It contains:
- Logic for converting to/from thrift for the Rust sharded map counterpart.
- `is_empty` and `size` methods, which are trivial.

One thing to notice: In Rust, the type is `ShardedMapNode<Value>`, where Value is any type that can be converted to/from binary. In thrift, there's no generics, so we store all values as binary. This is why D35217399 was needed, since we needed to decouple `blobstore_key` from `MononokeId`, as we can't implement that trait for `ShardedMapNodeId`.

Reviewed By: kris1319

Differential Revision: D35219036

fbshipit-source-id: ba4b137c4b60532a18b05ccc4385ff59362b50a8
2022-04-06 04:41:19 -07:00
Yan Soares Couto
965ffd5452 Add ShardedMap thrift definitions
Summary:
**Context**: Sharded maps are going to be used in DMv2 implementation.

Finally, after a huge stack of refactorings, something new!

This adds the thrift definitions for the sharded map discussed in [this design doc](https://fb.quip.com/ktMoAYnNwbUu#temp:C:ZHDd32bef5d5067b46d1b28a1bc7), with very few differences:
- I renamed "normal node" to "intermediate node" because I think it's clearer.
- I added farnz's suggested way of inlining nodes.
- I'm using binary as the value of the map, as there are no generics in thrift (unfortunately). When parsing this in Rust, we will make sure they match the correct type.

I will soon produce a more up-to-date design doc, taking into account the modifications since the initial one, which should make following algorithm diffs easier to review and serve as a wiki.

Reviewed By: farnz

Differential Revision: D34822820

fbshipit-source-id: 2524d38270c2fbb6db321788d6146d53e9a6a6e8
2022-04-06 04:41:19 -07:00
Yan Soares Couto
0805f77d86 Move BlobstoreKeyWrapper to typed_hash and implement for all hashes
Summary:
This is a different approach to D34790637.

The issue is that we can't implement `MononokeId` for some ids to come (ShardedMapNodeId), but we want to call the `blobstore_key` method still. When refactoring, I noticed `megarepo_api` already has a neat trait to do this: `BlobstoreKeyWrapper`.

So this diff implements `BlobstoreKeyWrapper` for all ids, and makes MononokeId depend on that instead and not implement `blobstore_key` manually.

Hopefully this approach is less complicated.

Reviewed By: markbt

Differential Revision: D35217399

fbshipit-source-id: 740bbdfaaf68b7e72c1a13987520ff2404d81035
2022-04-06 04:41:19 -07:00
Ilia Medianikov
99fe57780a mononoke: fix flaky sqlblob unittest by replacing sleeps with config force updates
Summary:
https://www.internalfb.com/intern/test/844424988760789?ref_report_id=0

{F718030758}

Reviewed By: HarveyHunt

Differential Revision: D35356076

fbshipit-source-id: 14488aaae3c897f676ba606a3d9c3cb18d49381c
2022-04-06 03:24:16 -07:00
Genevieve Helsel
f7fb63af3e change the size of ImportPriorityKind and ObjectFetchContext members
Summary: changes `ImportPriorityKind` and members in `ObjectFetchContext` to `uint8_t`, these should be minimized for use in `HgImportTraceEvent`

Reviewed By: xavierd

Differential Revision: D35269554

fbshipit-source-id: f36752b41e653338704316a8a75e2bbc72317e4a
2022-04-05 11:39:07 -07:00
John Watson
a4ad600cb9 Add symlink patch to tar-rs
Summary:
Pulling in this patch until the **[patch](f4f439ca0c)** ~~is approved, lands, and~~ makes it into crates.io

NOTE: I feel a little awkward patching ***everyone*** here — I suspect I'm the only that cares.
 **[I attempted to add a "tar-symlink" package pinned to 4.38](https://www.internalfb.com/intern/paste/P491303978/?view=diff)**, with the patch applying to that,
but and then updating only `dotsync2` accordingly, but that results in the same cascading changes
seen here; I suspect due to the patch applying to package "tar" (since "tar-symlink" isn't a thing).

Reviewed By: zertosh

Differential Revision: D35350696

fbshipit-source-id: a5653f3aed0eb5bc5424906d24a53ec2c2b79211
2022-04-05 11:26:24 -07:00
Saul Gutierrez
90ea4b453e revset: add docstring for lost revset
Summary: If one ran `hg help revset`, the `lost()` revset would not appear in the help since it was missing a docstring. This diff fixes that.

Differential Revision: D35363029

fbshipit-source-id: 81c2251d1ec2c6c5397de8d41443141271e8c265
2022-04-05 11:20:30 -07:00
Aida Getoeva
b0a505feed mononoke/cmdlib: migrate scrub-queue test over to new walker scrub
Summary: The diff migrates one of the tests and checks new walker scrub.

Reviewed By: mitrandir77

Differential Revision: D35343497

fbshipit-source-id: 680d6720eaab13e660bee4356f68ba2126679b0c
2022-04-05 08:28:59 -07:00
Aida Getoeva
7fa1ab5b1d mononoke/cmdlib: migrate scrub-blobstore test over to new walker scrub
Summary:
The diff migrates one of the tests and checks new walker scrub.

Some of the arguments now belong to the walker command and not to the subcommand, for example, the scuba log table.

Reviewed By: mitrandir77

Differential Revision: D35285714

fbshipit-source-id: e7e6fca0fe10e063edcb61ff6be88064143cceac
2022-04-05 08:28:59 -07:00
Aida Getoeva
1f34c37c88 mononoke/cmdlib: migrate sample-by-node test over to new walker scrub
Summary: The diff migrates one of the tests and checks new walker scrub.

Reviewed By: mitrandir77

Differential Revision: D35285713

fbshipit-source-id: 2f6599439a00c87cdf93c72df969d9eb029b4963
2022-04-05 08:28:59 -07:00
Aida Getoeva
a29b381195 mononoke/cmdlib: migrate walker scrub subcommand
Summary: I used the subcommand API from mononoke_app, which removes unnecessary boiler plate.

Reviewed By: mitrandir77

Differential Revision: D35247783

fbshipit-source-id: 58a4204d22a8d68fb636f588b843982bd8affbe6
2022-04-05 08:28:59 -07:00
Aida Getoeva
43c434cad3 mononoke/cmdlib: walker scrub specific args
Summary: This diff introduces walker scrub args.

Reviewed By: mitrandir77

Differential Revision: D34932256

fbshipit-source-id: 522e6ad7eeda27e10d89b0b680182a4afbf95145
2022-04-05 08:28:59 -07:00
Aida Getoeva
e2e26feae1 mononoke/cmdlib: implement walker common setup
Summary:
This is a refactoring/reimplementation of the [`setup_common(..)`](https://www.internalfb.com/code/fbsource/[e22d12de8703]/fbcode/eden/mononoke/walker/src/commands/setup.rs?lines=1308) function and which is heavily based on the old clap and cmdlib infrastructure. The function is huge and hard to read, I tried to split new one into the smaller functional pieces.

For some reason in the old setup the repos are initialized sequentially, I preserved behaviour in the new one, but intend to make it parallel in a separate diff.

Reviewed By: mitrandir77

Differential Revision: D35247782

fbshipit-source-id: aa5cd4ee2f221f62f988765445ae29d8c7289b45
2022-04-05 08:28:59 -07:00
Aida Getoeva
a4727f9b2b mononoke/cmdlib: add walker subcommand common args
Summary: This diff sets up common arguments for the different walker subcommands. The diff doesn't add any new functionality.

Reviewed By: mitrandir77

Differential Revision: D35247784

fbshipit-source-id: 8a75b53a335a62a1e30983ccbbed0c7cdeef952b
2022-04-05 08:28:59 -07:00
Aida Getoeva
0323ab6974 mononoke/multiplex: non-optional scrub queue_peek_bound
Summary:
`ScrubOptions` has default for `queue_peek_bound` which got overwritten by `environment_hook()` in scrubbing (new cmdlib). So if the peek bound wasn't specified in scrubbing, the default in `ScrubOptions` will be reset to `None`. I found it while working on D35343497.

Looking at how this field is used, I think there is no reason for it to be an optional value. It has a max default, which was introduced here D28533393 (fdee7b86e9). So this diff makes the field non-optional and fixes scrubbing `environment_hook()` so it won't override options to `None`.

Reviewed By: mitrandir77

Differential Revision: D35330717

fbshipit-source-id: 32a87dbb75a5b0cbe593d50427d4c36509a74b61
2022-04-05 08:28:59 -07:00
Mark Juggurnauth-Thomas
f6906107d7 mutable_counters: convert to new futures and facetize
Summary: Update `mutable_counters` to futures 0.3, and convert it to a repo attribute using the `facets` library.

Reviewed By: Croohand

Differential Revision: D35323567

fbshipit-source-id: 217f1e28c9541404a98a54b48222265efaba52ad
2022-04-05 05:40:35 -07:00
Muir Manders
2e968d8b23 rage: include "hg debugnetworkdoctor"
Summary: We shell out to "hg debugnetworkdoctor" because it is a native rust command.

Reviewed By: quark-zju

Differential Revision: D35302414

fbshipit-source-id: 0806f66d1694e845eeacfc6b4535f0d29a529b8a
2022-04-04 13:58:57 -07:00
Muir Manders
69f21d056d networkdoctor: flesh out top level messaging
Summary: Improve the message the users sees when the network doctor is run automatically due to a fatal network error. We now clearly state the command failed due to a network error, and we write the detailed output to a file. Previously we just showed the network doctor output and it wasn't clear the command had failed.

Reviewed By: quark-zju

Differential Revision: D35255833

fbshipit-source-id: 764abce8dcb7796283abc4b9fe1a485e04ff74c7
2022-04-04 13:58:57 -07:00
Katie Mancini
3d1eb3a8f9 move process name cache
Summary:
Stack context:
To get a build setup for edencommon I picked an eden library to move over
to edencommon.

I picked process name cache. I would like to have this library in watchman
so that I can log spawning process command lines as well as client command
lines.

This diff:
finally actually moves over process name cache

Reviewed By: chadaustin

Differential Revision: D34218020

fbshipit-source-id: 1e51ec6524d1e67a1dfd4d03a8189f882f5d3ff1
2022-04-04 11:37:38 -07:00
Katie Mancini
2a7ecc039c move benchharness
Summary:
Stack context:
To get a build setup for edencommon I picked an eden library to move over
to edencommon.

I picked process name cache. I would like to have this library in watchman
so that I can log spawning process command lines as well as client command
lines.

This diff:

process name cache has some benchmark tests so I am moving benchharness over.

Reviewed By: chadaustin

Differential Revision: D34218024

fbshipit-source-id: 260730adb7e5d4a3131e72fa2f03cc4c5066c075
2022-04-04 11:37:38 -07:00
Katie Mancini
1891bbddec move StringConv
Summary:
Stack context:
To get a build setup for edencommon I picked an eden library to move over
to edencommon.

I picked process name cache. I would like to have this library in watchman
so that I can log spawning process command lines as well as client command
lines.

This diff:

process name cache depends on StringConv.h so I am moving that over.

Reviewed By: chadaustin

Differential Revision: D34218023

fbshipit-source-id: d928768a6b5f737a1c546c6f3c73acc5535fc44c
2022-04-04 11:37:38 -07:00
Katie Mancini
f9b8b89509 move win error
Summary:
Stack context:
To get a build setup for edencommon I picked an eden library to move over
to edencommon.

I picked process name cache. I would like to have this library in watchman
so that I can log spawning process command lines as well as client command
lines.

This Diff:

process name cache depends on WinError.h so I am moving that over.

Reviewed By: chadaustin

Differential Revision: D34218026

fbshipit-source-id: 064f5bfc50c4ba120c887b01ff1f0a3e0543d498
2022-04-04 11:37:38 -07:00