Commit Graph

19805 Commits

Author SHA1 Message Date
Katie Mancini
d9737647bc register rpc servers with port mapper
Summary:
Now that we have the plumbing we can start registering our NFS RPC servers (
mountd and nfsd) with the portmapper/rpcbind.

I am taing a short cut for prototyping. I am skipping general purpose
rpc registration (i.e. making these rpc calls to register a service). This is
because (1) I am trying to prototype quickly, so I don't want to implement the
portmapper endpoints that allow registering/ unregistering a server and (2)
there are maybe security considerations, and I don't want to think about those
rn.

Reviewed By: chadaustin

Differential Revision: D44987884

fbshipit-source-id: 4b849d1dd060d2e033ab48df883e228015906a7d
2023-04-18 17:50:02 -07:00
Katie Mancini
901f989bc7 portmapper reply to getport
Summary:
getport is the primary endpoint on the rpcbind/portmap server. NFS clients
make a request on this endpoint to find the NFS RPC servers.

In this diff we keep a mapping of RPC servers and respond to the getport
request based on this mapping.

Currently no rpc severs are registered, so we reply no port to all
requests.

Reviewed By: chadaustin

Differential Revision: D44987893

fbshipit-source-id: 920171c6007b82609ae84fb7a9aff43d898e43dd
2023-04-18 17:50:02 -07:00
Katie Mancini
4ee4fa5e6b skeleton of portmapper server
Summary:
The msft client can't be pointed at an NFS server on a particular port, so
we have to register our RPC servers (mountd and nfsd) with the port mapper
service.

There is no portmapper service running on Windows by default.

There is a port mapper implementation from msft that can be installed on
Windows Server, but not on Windows desktop.

There are some third-party implementations of the portmapper for Windows. Most
of them are part of an NFS Server implementation. But none that I have found
both run on modern Windows versions, are a general purpose port mapper, and
support port mapper v2. General purpose means they allow processes to set a
port mapping. Most the port mappers I found must register their NFS server in
process, because they don't support calling the set mapping endpoint. The rest
only run on Windows versions from before I was born or only run v4.

I tried porting the linux gnu implementation of port mapper to Windows. But despite
a few hours of trying I could not even get it to build even on Linux. Writing our own port mapper is faster.

This is the skeleton of the server. In the next diffs I will register our
RPC servers and support telling the msft NFS client about our servers.

Reviewed By: chadaustin

Differential Revision: D44987863

fbshipit-source-id: bff065795a9f4b7b6c13ef3e3ce603646e1ce364
2023-04-18 17:50:02 -07:00
Katie Mancini
90741e9e30 introduce portmapper protocol v2
Summary:
The msft NFS client likes to speak portmapper v2. It does not seem to know v4.
Perhaps there is a way to configure that, but I have not found it yet.

v4 is the latest version of the protocol and so what we should prefer using on
mac and linux.

Here I am introducing the v2 protocol and renaming all the v4 types to
explicitly reference v4.

Reviewed By: chadaustin

Differential Revision: D44987848

fbshipit-source-id: 97f9e2365736b49a5888af204609598b2566de55
2023-04-18 17:50:02 -07:00
Katie Mancini
974bd46a9d don't start portmapper client for now on Windows
Summary:
There is no portmapper service running on Windows by default, so we should
not be trying to connect to one by default on Windows.

Though I am adding a port mapper service that eden it self runs in the coming
diffs it is not compatible with this client. The msft NFS client likes to
speak portmapper v2 and this client only knows portmapper v4 (otherwise known
as rpc bind). So I am stubbing these out for now.

Reviewed By: chadaustin

Differential Revision: D44987834

fbshipit-source-id: 078ed1761cffbe9621ab39892c2135504a6aeb1b
2023-04-18 17:50:02 -07:00
Chad Austin
bc21b372c9 remove some unnecessary ifdefs
Reviewed By: mshroyer

Differential Revision: D45070227

fbshipit-source-id: 8b10738cacbaade603583ea43edab47fc3691b99
2023-04-18 14:49:00 -07:00
Zhaolong Zhu
a059679a02 configitems: enable rust dynmatcher by default
Summary: it has been enabled in prod for 5 months, let's enable it by default

Reviewed By: sggutier

Differential Revision: D45086467

fbshipit-source-id: 3b0df83105ad76b67f6e841e81cd7223b68e3e9b
2023-04-18 14:25:05 -07:00
Saul Gutierrez
45c3d60b0f bump macOS python CI to 3.11.3 (#605)
Summary:
[sl] bump macOS python CI to 3.11.3

We still depend on pointing to the specific Python combination that GitHub CI and Homebrew have, which currently is 3.11.3.

Hashes were taken from d39875e212/Formula/python@3.11.rb

Pull Request resolved: https://github.com/facebook/sapling/pull/605

Test Plan:
Downloaded bottles from:

https://github.com/sggutier/sapling/actions/runs/4727040284
https://github.com/sggutier/sapling/actions/runs/4727040323

and installed the arm64 version. Also, verified that the dumps from `otool -L` looked correct (they usually don't when there is some when building)

Dump from arm64 version:

```
$ otool -L sapling\ 8/0.2.20230417-165855+6db1e950/bin/sl && file sapling\ 8/0.2.20230417-165855+6db1e950/bin/sl
sapling 8/0.2.20230417-165855+6db1e950/bin/sl:
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.100.3)
        /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
        /System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 60158.100.133)
        /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1858.112.0)
        @HOMEBREW_PREFIX@@/opt/openssl@1.1/lib/libssl.1.1.dylib (compatibility version 1.1.0, current version 1.1.0)
        @HOMEBREW_PREFIX@@/opt/openssl@1.1/lib/libcrypto.1.1.dylib (compatibility version 1.1.0, current version 1.1.0)
        /System/Library/Frameworks/SystemConfiguration.framework/Versions/A/SystemConfiguration (compatibility version 1.0.0, current version 1163.100.19)
        /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11)
        @HOMEBREW_PREFIX@@/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/Python (compatibility version 3.11.0, current version 3.11.0)
sapling 8/0.2.20230417-165855+6db1e950/bin/sl: Mach-O 64-bit executable arm64
```

Dump from x86 version:

```
$ otool -L sapling\ 9/0.2.20230417-165855+6db1e950/bin/sl && file sapling\ 9/0.2.20230417-165855+6db1e950/bin/sl
sapling 9/0.2.20230417-165855+6db1e950/bin/sl:
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.100.3)
        /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
        /System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 60158.100.133)
        /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1858.112.0)
        @HOMEBREW_PREFIX@@/opt/openssl@1.1/lib/libssl.1.1.dylib (compatibility version 1.1.0, current version 1.1.0)
        @HOMEBREW_PREFIX@@/opt/openssl@1.1/lib/libcrypto.1.1.dylib (compatibility version 1.1.0, current version 1.1.0)
        /System/Library/Frameworks/SystemConfiguration.framework/Versions/A/SystemConfiguration (compatibility version 1.0.0, current version 1163.100.19)
        /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11)
        @HOMEBREW_PREFIX@@/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/Python (compatibility version 3.11.0, current version 3.11.0)
sapling 9/0.2.20230417-165855+6db1e950/bin/sl: Mach-O 64-bit executable x86_64
```

 ---
Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/facebook/sapling/pull/605).
* https://github.com/facebook/sapling/issues/606
* __->__ https://github.com/facebook/sapling/issues/605

Reviewed By: zzl0

Differential Revision: D45072742

Pulled By: sggutier

fbshipit-source-id: 4ced2d609d9cf4098cd4bbea5d5df45659588ad8
2023-04-18 10:12:23 -07:00
Mateusz Kwapich
e0fbffe411 migrate the rest of the tests to use new macro
Summary: Look at at all the lines of code we could delete!

Reviewed By: YousefSalama

Differential Revision: D45057185

fbshipit-source-id: c454a4bd70527460bf4a727aa3ebe57b3becab4d
2023-04-18 07:28:59 -07:00
Mateusz Kwapich
4c1c4ee5f5 port the test for add_recursive to all storages
Summary:
I didn't want to repeat myself too much so I'm introducing macro that will do
that for me.

Reviewed By: YousefSalama

Differential Revision: D45057186

fbshipit-source-id: 6e13a5a72c6ad463982611ce11a16f937dcd9386
2023-04-18 07:28:59 -07:00
Mateusz Kwapich
79391ece39 don't look up into legacy changesets when not needed
Summary:
The add_recursive would try to access the parents from changesets table
even if they're not there yet (in some places we're racing to inster them to
both tables at the same time).

For that we need to:
 * process changesets in reverse topological order
 * check edges_map before trying to fetch parrents from legacy changesets table
 * skip fetching parents if the parent will be processed in the same function call

Reviewed By: YousefSalama

Differential Revision: D45057189

fbshipit-source-id: 7906c610c7a4f8473647796e0c56962e074a035f
2023-04-18 07:28:59 -07:00
Mateusz Kwapich
4ae0dc7077 test showcasing the problem with add_recursive
Summary:
`add_recursive` has problem when adding many changesets not present in the
legacy changesets table. This test showcases the problem, the next diffs will
attempt to fix it.

Reviewed By: YousefSalama

Differential Revision: D45057188

fbshipit-source-id: 56297b7e2d47c6ec65023e9782ac0e18012a4319
2023-04-18 07:28:59 -07:00
Mateusz Kwapich
c9548e2228 add more context annotations
Summary: Those helped me to localize the source of errors. I might as well commmit them.

Reviewed By: YousefSalama

Differential Revision: D45057187

fbshipit-source-id: 694d9596dec030e65b0d29590068103fb1b70ca9
2023-04-18 07:28:59 -07:00
Rajiv Sharma
66388d0f95 Getting file metadata implementation
Summary:
**Context**
D37136735 introduced a new type called `ContentMetadataV2`, to include more information about a file. For example, if a file is binary.

We want to modify the file_info endpoint in SCS, so that users can directly query the metadata for a file.

**This diff**
Implement the modified version of file_info endpoint using the ContentMetadataV2

Reviewed By: markbt

Differential Revision: D43537343

fbshipit-source-id: 98554366a725636d4cd6989fb7e2d9b5fe29d5e4
2023-04-18 07:11:02 -07:00
Rajiv Sharma
ecacdbbd25 Modify the file_info endpoint to support additional metadata
Summary:
**Context**
D37136735 introduced a new type called `ContentMetadataV2`, to include more information about a file. For example, if a file is binary.

We want to modify the file_info endpoint in SCS, so that users can directly query the metadata for a file.

**This diff**
Modify Thrift data type, and the function signature for the endpoint

Reviewed By: markbt

Differential Revision: D43537344

fbshipit-source-id: 6076703f67923e0fa95676b0db812a75fb6c3650
2023-04-18 07:11:02 -07:00
Pierre Chevalier
26711c6a5d Restore pre-clap4 behaviour for flags
Summary:
These have broken production as the behaviour was changed so that `--foo` would no longer be valid when it used to be.

The behaviour changed inadvertently when migrating these CLIs to clap 4.

Differential Revision: D45081836

fbshipit-source-id: ffa7a2a2b1c04c860082bb2770eaa2cde1e7519f
2023-04-18 07:01:03 -07:00
Mark Shroyer
9214006f7e Fix Rust CLI unused warnings on Windows
Summary:
Fixes some warnings about unused imports and struct fields when building on
Windows.

Reviewed By: MichaelCuevas

Differential Revision: D45061519

fbshipit-source-id: 322768bf4e0d2af47129bd8f5c376211ee98d0d8
2023-04-17 16:59:10 -07:00
Chad Austin
d6d8621c74 rename several FUSE references to FS channel
Summary:
My goal is to decouple our inode layer, including EdenMount, from the
specific filesystem implementation. To that end, remove several FUSE
references from EdenMount's comments and variable names.

Reviewed By: kmancini

Differential Revision: D44737102

fbshipit-source-id: 9956cf818599d508a897b92936350f40207d4b40
2023-04-17 16:39:48 -07:00
Chad Austin
b27d037f91 refactor EdenServer mount and shutdown
Summary:
Small refactorings that don't have a particular theme. I'm working
towards removing FUSE- and PrjFS-isms from EdenMount and friends.

Reviewed By: kmancini

Differential Revision: D44728015

fbshipit-source-id: 328abae1043a48f440836b98f1a1ee20a1b091d1
2023-04-17 16:39:48 -07:00
Muir Manders
58b512c3cd test-symlinks.t: kill a FIXME
Summary: I think I addressed this one already in D44187187 but forgot to remove the FIXME.

Reviewed By: evangrayk

Differential Revision: D45050467

fbshipit-source-id: eb408ae2a9e1ba873e7f28ec3ff1cb755a1d2560
2023-04-17 13:45:40 -07:00
Jon Oh
c41af0dcb0 Fix cont-builds and tests
Summary: Fixed the cont-builds command and updated the tests to actually work instead of just passing all the time

Reviewed By: skotchvail

Differential Revision: D44898873

fbshipit-source-id: dbbc7429942a2d400346004e13bf7ba3cb00476d
2023-04-17 13:44:55 -07:00
Saul Gutierrez
96971285fd symlinks: make symlinks created on Windows usable on POSIX systems
Summary:
On Windows most applications, including Windows Explorer, are not able to open symlinks if they have forward slashes (e.g., `eden/scm/Makefile`). Windows users creating symlinks will probably create symlinks with backward slashes instead because of this (e.g., `eden\scm\Makefile`). Analogously, symlinks with backward slashes will be of not use on POSIX systems.

This diff tries to alleviate this by making symlinks added to commits on Windows via `hg commit` usable everywhere else.

Reviewed By: zzl0

Differential Revision: D44358129

fbshipit-source-id: 2835652b62104e22f10cb422586fae9998db40ad
2023-04-14 17:46:13 -07:00
Saul Gutierrez
ebd6b78e39 symlinks: enable partial symlink support for Windows
Summary:
Makes `hg diff` and `hg commit` work as one would expect on Windows. This is done by modifying some constants in `fscap.py`.

This change should not impact end users, as explained in previous diffs.

Reviewed By: muirdm

Differential Revision: D43741223

fbshipit-source-id: 203878f64c11364257cef4bb82395713456f3625
2023-04-14 17:46:13 -07:00
Saul Gutierrez
9728b6f8fe status: enable symlinks for Rust status command / working copy on Windows
Summary: The working copy uses the VFS object for determining whether a file is a symlink or not. Previously this behavior was disabled as there was no support for symlinks at all when this was written.

Reviewed By: muirdm

Differential Revision: D44592907

fbshipit-source-id: 6b9041a5045a336292a2b641da30cf3ae22f441c
2023-04-14 17:46:13 -07:00
Chad Austin
9281cce141 log DaemonStop on Windows too
Summary:
I noticed when reading the EdenServer startup and shutdown logic that
we did not log the structured DaemonStop event on Windows. The ifdef
must have been vestigial, so remove it.

Reviewed By: xavierd

Differential Revision: D44699330

fbshipit-source-id: 529aa2b2933b1ef3b8337fa19c1b88b9033653ba
2023-04-14 14:03:38 -07:00
Liubov Dmitrieva
2839fd120c introduce cloud tidyup command
Summary:
introduce cloud tidyup that can cleanup unnessesary remote bookmarks

this command can be used by ondemand or clients to get rid of unnessesary
remote bookmarks in a safe way server side

we can also use it in hg doctor command

Reviewed By: zzl0

Differential Revision: D44954711

fbshipit-source-id: 5d4e157c9b668f26cd39794d7f752828e4fc8b3f
2023-04-14 10:58:58 -07:00
Zhaolong Zhu
3fb1472827 copytrace: add trace_rename macro for simplifying unit tests
Summary: as title

Reviewed By: quark-zju

Differential Revision: D44905583

fbshipit-source-id: d8a995fcb1ae138bf13a1ba71d88de3ceda1d8de
2023-04-14 09:06:29 -07:00
Zhaolong Zhu
1364f62dd5 copytrace: delete draftusefullcopytrace
Summary: new dagcopytrace algorithm covers the draftusefullcopytrace

Reviewed By: quark-zju

Differential Revision: D44917351

fbshipit-source-id: 76bb33957f265645f989af7df418fcdb5fadab35
2023-04-14 09:06:29 -07:00
Rajiv Sharma
1337135d0a EdenAPI: Changes for ContentMetadataV2 and Blake3
Summary: The `ContentMetadataV2` provides the seeded blake3 hash for each created file. This information needs to be passed to `buck` which interacts with `EdenAPI` through `EdenFS`. The relevant endpoints in `EdenAPI` are `trees` and `files` which were modified in the previous diff to support the new hash and are used here.

Reviewed By: muirdm, markbt

Differential Revision: D44010967

fbshipit-source-id: a755f0750ed39719b1f0e6895b7ca81a405fcfed
2023-04-14 08:46:55 -07:00
Rajiv Sharma
c8912e4211 Expose ContentMetadataV2 and Blake3 in EdenAPI
Summary: The `ContentMetadataV2` provides the seeded blake3 hash for each created file. This information needs to be passed to `buck` which interacts with `EdenAPI` through `EdenFS`. The relevant endpoints in `EdenAPI` are `trees` and `files` which are modified in this diff to support the new hash.

Reviewed By: quark-zju

Differential Revision: D43977390

fbshipit-source-id: bd9a264dc4483574a7a46e7ce4f9109910f18f2d
2023-04-14 08:46:55 -07:00
Muir Manders
b430c42606 run-tests.py: don't eat debugruntest output
Summary: If rust code writes to the "real" stderr/stdout in a debugruntest test (e.g. println!()), that output was getting dropped by run-tests.py. Now it at least prints it out, albeit not interleaved temporally.

Reviewed By: quark-zju

Differential Revision: D44768929

fbshipit-source-id: 9520229dbf885503cd53a21cc682df7135d72fb7
2023-04-14 08:28:51 -07:00
generatedunixname89002005287564
9146c01505 Reviewed By: zertosh
Differential Revision: D44994052

fbshipit-source-id: 2cb53e0c9b2719b2b41b12b71d730981bd2d59c4
2023-04-14 05:53:51 -07:00
Zhaolong Zhu
5f264f2db3 copytrace: use dagcopytrace in copytrace.py
Summary: Use dagcopytrace to replace the current heuristic based copy tracing.

Reviewed By: quark-zju

Differential Revision: D44336238

fbshipit-source-id: 74fa131e78531d06ae2c263534a4a56b2081c041
2023-04-14 05:28:41 -07:00
Mark Juggurnauth-Thomas
bc9b8fbdce scsc: restore default help and switch to -H for host
Summary: The clash between `-h` for both `--help` and `--host` was inadvertent.  Switch to `-H` for `--host` to disambiguate.  It seems clap4 handles this clash less well than clap3 did.

Reviewed By: clara-9

Differential Revision: D44994925

fbshipit-source-id: c4195500cecd2c796e4765c2fbe6047df2f57593
2023-04-14 04:33:46 -07:00
Muir Manders
0f3042b908 logginghelper: don't log "repo"
Summary:
This "repo" determination was incorrect. In particular, it emitted "fb:foo" for a path of "fb:foo" (should be just "foo"). This code is totally superfluous, though, since the Rust dispatch also logs "repo" (correctly).

I also killed logging of "dirstate_format" since I think that is always "treestate" now (except for some tests and test repos).

Reviewed By: zzl0

Differential Revision: D44978910

fbshipit-source-id: 8a1478dc0dc7bfda6bdab683c5c5e57e6060ce78
2023-04-14 03:20:05 -07:00
Mark Juggurnauth-Thomas
77efa04681 walker: remove dependency on old cmdlib
Summary: The walker was migrated to the new cmdlib, but still depended on the old one for a couple of structs.  Remove these dependencies.

Differential Revision: D44886561

fbshipit-source-id: 122d8aa01269b49651b95bd431b52045f91b88bc
2023-04-14 03:02:56 -07:00
Mark Juggurnauth-Thomas
3f179e196f lfs_server: use cmdlib_caching::CachelibSettings directly
Summary: LFS server uses the new command library, so no need to import the old one just for this struct.

Differential Revision: D44886560

fbshipit-source-id: 8b8869c9cf717aa622f374468ab061dff0ef349f
2023-04-14 03:02:56 -07:00
Mark Juggurnauth-Thomas
8528fa3aff benchmark_storage_config: migrate to clap 4
Summary: Migrate the storage config benchmark to clap 4.

Differential Revision: D44712483

fbshipit-source-id: dbf96cc33256370a33be3e8a127412a4888b307b
2023-04-14 03:02:56 -07:00
Mark Juggurnauth-Thomas
ca0310a18b benchmark_storage_config: move to benchmarks directory
Summary: This is a benchmark so put it with the benchmarks.

Reviewed By: mitrandir77

Differential Revision: D44712484

fbshipit-source-id: e81a383ca1b89b87dc64577bbc42c56740599bf4
2023-04-14 03:02:56 -07:00
Mark Juggurnauth-Thomas
0a30fb114e benchmark_filestore: migrate to clap 4
Summary: Migrate the filestore benchmark to clap 4.

Differential Revision: D44711492

fbshipit-source-id: fb3c297ef058d661a4ba913a95e50a4938713c28
2023-04-14 03:02:56 -07:00
Mark Juggurnauth-Thomas
0980227ff8 benchmark_filestore: move to benchmarks directory
Summary: This is a benchmark so put it with the benchmarks.

Reviewed By: mitrandir77

Differential Revision: D44711493

fbshipit-source-id: adb9ce812423a11fae4f6c6a368d755780606944
2023-04-14 03:02:56 -07:00
Chad Austin
41ee5014ae read BlobCache configuration from EdenConfig rather than gflags
Summary:
It's strange that BlobCache's configuration came from command line
arguments and TreeCache from the configuration file. To my knowledge,
neither configurations have ever been adjusted, so unify their naming
and replace BlobCache's command line flags with EdenConfig settings.

Reviewed By: xavierd

Differential Revision: D44699297

fbshipit-source-id: 88b0edf830e8dfc8f9eaa9ff04c563c54992f8bb
2023-04-14 00:44:11 -07:00
Chad Austin
0d535c9935 initialize BlobCache and TreeCache together
Summary:
I'm not sure how BlobCache and TreeCache grew to have different
ownership patterns. Allocate them together and prepare for
initializing BlobCache with EdenConfig.

Reviewed By: xavierd

Differential Revision: D44699259

fbshipit-source-id: fc91bb9fe80423e036bb7856d9f3b8863ba71ce8
2023-04-14 00:44:11 -07:00
Chad Austin
20d38e2239 linearize control flow in EdenServer::mount
Summary:
The error handling in EdenServer::mount was unnecessarily
complicated. Rely on thenValue and thenError to simplify the control
flow.

Reviewed By: xavierd

Differential Revision: D44699195

fbshipit-source-id: b94e513bf198f38e4614ccfa18ffab37bb43ff87
2023-04-14 00:44:11 -07:00
Chad Austin
774494ba52 introduce FsChannel with a completeInvalidations method
Summary:
A common FsChannel base class allows removing some ifdefs from
EdenServiceHandler. With some effort, we should be able to find the
correct abstractions that allow us to entirely decouple particular
FsChannel implementations from the rest of the inode layer.

Reviewed By: kmancini

Differential Revision: D44657395

fbshipit-source-id: 9702186f1d0c9ce76a11e766010f5899e2b517af
2023-04-14 00:44:11 -07:00
Muir Manders
a88140ee87 clone: don't hardcode remotenames.hoist config
Summary: Don't hardcode remotenames.hoist to "remote". I didn't end up using a different value for this config, but probably an improvement worth committing anyway.

Reviewed By: quark-zju

Differential Revision: D44857509

fbshipit-source-id: 68a3660827d16083231ad98dc57321ac1ce3a377
2023-04-13 18:37:07 -07:00
Muir Manders
2ee397d83d clone: infer selectivepull from URL fragment
Summary: Now if the clone source URL contains a fragment, we persist the fragment as the repo's remotenames.selectivepulldefault. This gives a user friendly way of specifying the default bookmark you are interested in.

Reviewed By: quark-zju

Differential Revision: D44857510

fbshipit-source-id: 54cffeebb76d6a9dc603adcc6ad58ab17568050c
2023-04-13 18:37:07 -07:00
Muir Manders
77afb4ac3e clone: don't delete repo on error if --debug
Summary: If the user specifies --debug, don't delete the repo after an error when cloning. This makes it easier to debug clone failures.

Reviewed By: quark-zju

Differential Revision: D44857512

fbshipit-source-id: 921dcfdf472826aae407564b9f8b788e53058d20
2023-04-13 18:37:07 -07:00
Muir Manders
3404b172a1 clone: persist remotenames.selectivepulldefault to repo config
Summary:
Now if you specify "--config remotenames.selectivepulldefault=whatever", we will persist it to the repo's config.

Note that this is still not good UX. See later diff that adds support for specifying default branch as URL fragment.

Reviewed By: zzl0

Differential Revision: D44857513

fbshipit-source-id: b8474f5d54e5d597c0ff44e9d689ccbfcc3068b3
2023-04-13 18:37:07 -07:00
Muir Manders
514aed138f config: delete commented out code from convert.rs
Summary: I'm sure the Python code was useful during development, but it adds an unnecessary layer of complexity/noise to the reader.

Reviewed By: quark-zju

Differential Revision: D44857515

fbshipit-source-id: 19a5165b402cd2c1e8a367edb64862c2bdeae18f
2023-04-13 18:37:07 -07:00
Muir Manders
d24a45984d clone: escape slashes in repo name
Summary:
Canonical repo names can/will have slashes in them. We shouldn't convert slashes to directories on disk; just a bad idea.

When choosing the clone destination, use the basename. It could make sense to clone "foo/bar" into "foo_bar" instead of just "bar", but let's maintain the existing/expected behavior for now.

For internal uses, we percent encode the reponame. For example, the hgcache directory for "foo/bar" will be "foo%2Fbar". This is to minimize chance of collision. If we named the cache dir "foo_bar", that would collide unpleasantly with a repo named "foo_bar".

I relaxed reponame inference a bit to allow slashes in URLs like "test:foo/bar". This was purely so I could test with a reponame containing slashes.

A better long term approach is to use the hash of a canonicalized URL, but that is a bigger change.

Reviewed By: quark-zju

Differential Revision: D44857514

fbshipit-source-id: 4fa0b83a0660b81e89fc96b50ecbeb93869dd2b2
2023-04-13 18:37:07 -07:00
Muir Manders
c616b2ecf2 debugruntest: report "ls" error when arg doesn't exist
Summary: Make the debugruntest "ls" impl report an error if an argument doesn't exist on disk. This matches real "ls" behavior, and is important feedback when you've messed up the arguments.

Reviewed By: quark-zju

Differential Revision: D44857511

fbshipit-source-id: 0467e2c5e175882bb8033186235be36e5798bf7f
2023-04-13 18:37:07 -07:00
Muir Manders
b7057519a6 config: add ConfigExt::must_get
Summary:
must_get is like get_nonempty_opt but returns an error if the value is unset or
empty. This makes it easy to propagate an error if the desired config is not
set.

I also updated a few spots to use must_get and got rid of a superfluous error type.

Reviewed By: quark-zju

Differential Revision: D44857516

fbshipit-source-id: cdecd7a68d4e3d8248cae977f4cdf7b553b6af74
2023-04-13 18:37:07 -07:00
Katie Mancini
7db085fe32 add a tail option to eden debug log
Summary:
Xavier just taught me about `cat -tail -wait`. I was watching the logs in vscode
on windows. Let's make a tail version of `eden debug log` so everyone else can
easily figure out how to tail the logs on all platforms.

Reviewed By: chadaustin

Differential Revision: D44941688

fbshipit-source-id: e86b18025f780dda69005ad9a31b1cb11d395261
2023-04-13 17:01:22 -07:00
Adam Miskiewicz
54300ad213 fsmonitor: fix empty path in dirfilter (#601)
Summary:
Fixes the bug discussed in Discord here: https://discord.com/channels/1042527964224557107/1042527965256364157/1095764831480590467

Running the ignore matcher on an empty path produces incorrect results. In the rust implementation, this isn't an issue, because there are directory matchers that run on the directory result. In the Python treestate bindings, we don't have that functionality, so it returns an empty string.

This makes this logic match the code in `dirstate.py` ([line ~925](https://github.com/facebook/sapling/blob/main/eden/scm/edenscm/dirstate.py#L925-L926)) where we check for path being an empty string.

This fixes `sl status` (and related functionality) when fsmonitor is enabled and there's a complex gitignore file that ignores files in the root directory.

Pull Request resolved: https://github.com/facebook/sapling/pull/601

Test Plan: Added Mercurial integration test and manually tested locally

Reviewed By: quark-zju

Differential Revision: D44961756

Pulled By: zzl0

fbshipit-source-id: 57dd0d052ceeb184694c6f3b1a71ac53bf0e1028
2023-04-13 16:20:03 -07:00
Katie Mancini
a886d9d171 prevent extra retry in hgimporter
Summary:
This continues my slashing of fetch retries. This diff is 2x (for a total of
-2 now) fetch retry.

The importer prefetches the tree and then gets the tree. both can cause network
fetches, so when the prefetch fails, the get will retry the network request.

If I am guessing again I think the cause was similar to the last diff:
get use to be a local only check, but now its not anymore so we are exposed to
more potential network fetch retries.

It should be safe to remove this retry because we still kill and restart the
importer if the importer has errors, which should cover any successful re-trys.

With this change we are now down to what looks like 3 network request attempts
per request.

Reviewed By: xavierd

Differential Revision: D44526625

fbshipit-source-id: 455903bdc73c9513106c4e048274d5bb08085a38
2023-04-13 15:56:07 -07:00
Zhaolong Zhu
5799178b25 copytrace: select the last when one file are copied and renamed to multiple files
Summary: We don't have plan to support this one-to-many mapping, since it will make copytrace complexity increase exponentially in theory. For now, we just pick the last copy in ascending alphabetical order. The reason why we do this is to make the selection deterministic, so the behavior will be consistent on different platforms and Rust implementations.

Reviewed By: quark-zju

Differential Revision: D44901629

fbshipit-source-id: 154b515c7043d4a5e45e1f2077f6930baf354e81
2023-04-13 15:46:41 -07:00
Zhaolong Zhu
bcc252f9c1 copytrace: enable eagerepo for test-fb-ext-copytrace.t
Summary:
In order to test new copytrace logic, we need eagerepo for finding
renames from the file content header.

Reviewed By: quark-zju

Differential Revision: D44816781

fbshipit-source-id: 129b729e1508d4e60e7d0c994c3163cdbdf09353
2023-04-13 15:10:50 -07:00
Zhaolong Zhu
6201e9a6af copytrace: delete todo comments for adding tracing statements
Summary: added tracing statements and delete todo comments.

Reviewed By: quark-zju

Differential Revision: D44816782

fbshipit-source-id: 5ef40a85e0adeaaf6bda83c9aae9c2d59c667b17
2023-04-13 15:10:50 -07:00
Xavier Deguillard
fa3beade42 integration: enable hg.debug_clear_local_caches_test on Windows
Summary: Of the 3 tests, 2 are passing, enable them.

Reviewed By: chadaustin

Differential Revision: D44938105

fbshipit-source-id: c9a06624122b14b51be3dcaeee101d8c69d36cc1
2023-04-13 08:52:40 -07:00
Mark Juggurnauth-Thomas
34cb109590 benchmarks/simulated_repo: remove simulated repo benchmark
Summary: This benchmark was used during development of Mercurial data derivation, however it is very synthetic and we haven't used it in a long time.  Remove it to ease the burden of maintenance.

Reviewed By: mitrandir77

Differential Revision: D44707860

fbshipit-source-id: 6dd2ac893b4020a0c77847c4f10848ba20d96e38
2023-04-13 06:39:07 -07:00
Mark Juggurnauth-Thomas
0911a84ac3 mercurial_derivation: use instrumented blobstore and database
Summary: Replace the usage of `benchmark/simulated_repo`'s repository with an ordinary test repository with instrumented blobstore (via `DelayedBlobstore`) and database (via `SqliteCallbacks`).  This removes this dependency on this code.

Reviewed By: mitrandir77

Differential Revision: D44707861

fbshipit-source-id: 49d4c2b43aa4dc64b10d94e21d8d242c97e05415
2023-04-13 06:39:07 -07:00
Mark Juggurnauth-Thomas
e533299ac8 sql: add sqlite callbacks
Summary:
We want the ability to observe and change the behaviour for sqlite connections.  Add the ability to register callbacks that are called whenever the multithreaded sqlite connection is acquired.

No change in behaviour yet.  We will use these in a future diff.

Reviewed By: mitrandir77

Differential Revision: D44707859

fbshipit-source-id: f8156e294bbc51b612a6e38604804b4f815ed919
2023-04-13 06:39:07 -07:00
Mark Juggurnauth-Thomas
79aec45cef mercurial_derivation/test: move blobrepo test to mercurial derivation
Summary: The blobrepo test is actually a test of mercurial derivation, so move it there.

Differential Revision: D44676336

fbshipit-source-id: 2f7f002a91171a7081ceacb3c6f10b9c62824bfd
2023-04-13 06:39:07 -07:00
Mark Juggurnauth-Thomas
ff47f69198 derived_data/test: reorganise file layout
Summary: Move the library down into its own test directory with a `src` directory.

Differential Revision: D44676334

fbshipit-source-id: cd65adaf2b4a445f13b05d700be7a30492cadb97
2023-04-13 06:39:07 -07:00
Mark Juggurnauth-Thomas
de3117ffcc derived_data/filenodes_derivation: reorganise file layout
Summary: Reorganise filenodes derivation so that it matches mercurial derivation.

Differential Revision: D44676333

fbshipit-source-id: bb5e11cb5a8344f3f7e812e1e53360355b1ce36b
2023-04-13 06:39:07 -07:00
Mark Juggurnauth-Thomas
b4a51d76b7 derived_data/mercurial_derivation: reorganise file layout
Summary: Rename to `mercurial_derivation` and create a proper `src` directory.  I plan to make this change consistently across all derived data types, but will start with Mercurial derived data so that I can add a test.

Differential Revision: D44676335

fbshipit-source-id: aae67df807575e532636dd46c4655f135d2d57b0
2023-04-13 06:39:07 -07:00
Thomas Orozco
a029499590 third-party/rust: clean up an unused fixup
Summary: Missed removing it in D44951990, doesn't do anything.

Reviewed By: zertosh

Differential Revision: D44955773

fbshipit-source-id: 158281265eed8ba20cf931d4a37d335012fac614
2023-04-13 06:22:13 -07:00
Thomas Orozco
3e4187c3c9 third-party/rust: unfork prost
Summary: PR got landed!

Reviewed By: IanChilds

Differential Revision: D44951990

fbshipit-source-id: 1d60be52ffc292965e7ce55ec098a9be3acb6aea
2023-04-13 05:07:06 -07:00
Liubov Dmitrieva
89ca08ca45 follow up clean up dead code
Summary:
follow up clean up dead code

forgotten in earlier diff

Reviewed By: YousefSalama

Differential Revision: D44931222

fbshipit-source-id: 6ec965ae5c7851693432fadc9b71df6a967259bb
2023-04-13 02:26:55 -07:00
Michael Cuevas
1dece1d7a9 kill python prefetch-profiles (again)
Summary: `prefetch-profile` has been completely removed from the experimental command list for some time now, and there's no way any environment could be using it. It's safe to delete this code now!

Reviewed By: xavierd

Differential Revision: D44113592

fbshipit-source-id: f144b713c6e35de4691071afebbe7a829886b893
2023-04-12 20:27:23 -07:00
Xavier Deguillard
f93a937d13 inodes: move caching of sha1+size from OverlayFileAccess to FileInode
Summary:
We've seen several cases on Windows where `hg status` is extremely slow due to
the working copy having 10k+ materialized files. Reading through the code,
EdenFS ends up computing the sha1 of all of these files for every `hg status`
call which is quite costly.

On Linux and macOS, both the sha1 and the filesize of materialized files were
cached in the OverlayFileAccess code, but this had the downside of being very
small (100 entries) and not compilable on Windows. Instead of storing it in the
OverlayFileAccess, we can make use of the newly added
`FileInodeState::MaterializedState` to store both the size and the sha1. Beyond
working on Windows, this also comes at no-additional memory usage.

Reviewed By: chadaustin

Differential Revision: D44737138

fbshipit-source-id: 28cf14928de4e685cb21819915f7be7e7a64047b
2023-04-12 15:00:02 -07:00
Liubov Dmitrieva
ee02876029 deprecate skip list based version of api (client)
Summary:
deprecate skip list based version

this is part of the effort to deprecate skip lists infra known as **Skip Lists Deprecation**

this endpoint is not called, it is safe to remove it either client first or
server first

also, we don't need to maintain two endpoints to check correctness, we passed that phase.

Reviewed By: zzl0

Differential Revision: D44916440

fbshipit-source-id: 05f623cc07718f1c9aa3d835d7654b47d3728d2d
2023-04-12 14:39:46 -07:00
Liubov Dmitrieva
45f72cf652 deprecate skip list based version of api
Summary:
deprecate skip list based version

this is part of the effort to deprecate skip lists infra known as **Skip Lists Deprecation**

this endpoint is not called, it is safe to remove it server side first

we don't need to keep both for checking correctness, we passed that phase!

Reviewed By: YousefSalama

Differential Revision: D44916005

fbshipit-source-id: 662cfa20ad44346011126e0ae3aae69deb719dbc
2023-04-12 14:39:46 -07:00
Liubov Dmitrieva
39687024b1 fix test
Summary: change test to call correct endpoint

Reviewed By: YousefSalama

Differential Revision: D44915161

fbshipit-source-id: 81deaf9ab1b66a1cc5fdff2fbd1eedc0c1aef79d
2023-04-12 14:39:46 -07:00
Mark Shroyer
52f68c1c1e Disable projfs_enumeration integration test if ntapi missing
Summary:
fbcode_builder doesn't currently know how to build a Python extension module,
which means the Windows oss build fails on trying to load ntapi if we don't
pass the `--no-tests` flag to getdeps.  Ideally we add extension module support
to the builder, but for now let's just disable the test case if the extension
module is unavailable.

Reviewed By: chadaustin

Differential Revision: D44804035

fbshipit-source-id: 10da54f6ea7d3699ac42421ee5cf57d883509bdd
2023-04-12 10:51:18 -07:00
generatedunixname89002005307016
3eb9cd2c7b Lint failure adding annotations to eden/integration/projfs_buffer.py
Reviewed By: zzl0

Differential Revision: D44911459

fbshipit-source-id: 26e22a3fd4a6c493794bc36c361dc1c70ae2d9f6
2023-04-12 09:51:28 -07:00
generatedunixname89002005307016
8b7ee4be7c Add annotations to eden/scm/edenscm/ext/snapshot/labels.py
Reviewed By: zzl0

Differential Revision: D44831472

fbshipit-source-id: 4813a43dbbe98e75751f604064d133a726fa20be
2023-04-12 09:36:05 -07:00
generatedunixname89002005307016
6579e0b911 Add annotations to eden/scm/edenscm/hooks.py
Reviewed By: zzl0

Differential Revision: D44814520

fbshipit-source-id: 4e04c45bdca7171d812c5616993932ea7d8237f2
2023-04-12 09:32:23 -07:00
generatedunixname89002005307016
c9c51e6fa4 Add annotations to eden/scm/edenscm/ext/extorder.py
Reviewed By: zzl0

Differential Revision: D44868907

fbshipit-source-id: 909402e3af08b48656550e937a10214ddaeaa031
2023-04-12 09:30:00 -07:00
Pierre Chevalier
512037a028 Migrate from clap 3 to clap 4
Summary:
See the list of breaking changes upstream:
https://github.com/clap-rs/clap/blob/master/CHANGELOG.md#400---2022-09-28

Reviewed By: markbt

Differential Revision: D44704538

fbshipit-source-id: a651f3c37a5f0de852ac26332131c0d70d697811
2023-04-12 09:15:41 -07:00
Martin Conraux
9f5b978bf0 update comfy-table
Summary: Update comfy-table to 6.4.1

Reviewed By: zertosh

Differential Revision: D44744141

fbshipit-source-id: 3206b40a292a6b6ca03bcc7532bff21aa70046b6
2023-04-12 08:55:19 -07:00
Muir Manders
70b82edccc metrics: log the (first) mononoke host we talk to
Summary: Log the first mononoke host we connect to. Under normal circumstances all connections from a particular client should go to a host in the same datacenter, so this will allow us to look at performance trends taking into account cross datacenter factors.

Reviewed By: zzl0

Differential Revision: D44900086

fbshipit-source-id: c9bb38dac419a8faf468c6bb79a44af3c152c502
2023-04-12 08:47:07 -07:00
Liubov Dmitrieva
3d7819efab log duration for origin request
Summary:
log duration for the origin request

so that we will be able configure replay in a more flexible way

Reviewed By: clara-9

Differential Revision: D44910760

fbshipit-source-id: 8d716376702283e24bb4151eb0a68b8bc2e57e6f
2023-04-12 05:56:04 -07:00
Mark Juggurnauth-Thomas
064d46dfd1 mononoke_api: when diffing, filter out missing copy sources
Summary:
An invalid bonsai changeset or mutable rename could lead to a copy source that does not exist.

For Mercurial derived data, we already ignore this.  Do the same for general diffing.

Reviewed By: mitrandir77

Differential Revision: D44909673

fbshipit-source-id: ac754e0e483e75976afb07078e57bc1f33008a17
2023-04-12 05:28:09 -07:00
Mark Juggurnauth-Thomas
515b140897 repo_factory: construct sql more consistently
Summary:
In the repo factory, we do different things for sql connection creation in tests and prod.  In prod we cache `MetadataSqlFactory` instances for each metadata database configuration, and request a new connection from the cached factory each time.  In tests, this doesn't work, as requesting a new sqlite connection from the factory is the same as opening the file again, which can be slow for large numbers of connections, so instead we cache connections directly in the repo factory, which isn't really the right place.

We can fix this by making the `MetadataSqlFactory` handle the caching of sqlite connections for us.  This makes the repo factory consistent between prod and test.  It also means the `MetadataSqlFactory` can hold on to the original connection to the sqlite database and perform the creation queries directly, rather than having to hold it separately in the wrapper around `SqlConnections`, and we can deduplicate the code for opening the database, too.

Reviewed By: mitrandir77

Differential Revision: D44665118

fbshipit-source-id: 1c7d45ac1900d5f2b36285e01159924d0cdb09eb
2023-04-12 01:48:40 -07:00
Mark Juggurnauth-Thomas
8ea1da962c backsyncer: remove connections from TargetRepoDbs
Summary: These connections are no longer used, so they and their setup code can all be removed.

Differential Revision: D44635160

fbshipit-source-id: 4407a9318086b61942523cf551988e394c6df2e1
2023-04-12 01:48:40 -07:00
Mark Juggurnauth-Thomas
6224b73493 tests_utils: extract random repo generation from simulated repo benchmark
Summary: This is already used by a couple of other tests, so it makes sense to move it out of the benchmark.

Differential Revision: D44635161

fbshipit-source-id: 41414b66b380ea1d5635c6131df4fa3f3084fcfc
2023-04-12 01:48:40 -07:00
Mark Shroyer
afb10611d1 Add config to disable doctor checks
Summary:
This adds the configuration `doctor.ignored-problem-class-names` so that we can
make doctor ignore individual problem classes via config rollout.

This doesn't actually stop the checks from running, but it stops reporting (or
attempting fixes for) ignored problems. Ignored tests will still be logged in the
edenfs_events table's

Reviewed By: xavierd

Differential Revision: D44720584

fbshipit-source-id: 954d1131dfbbf6a3264abf55b5e0f01ab61836d0
2023-04-11 18:53:10 -07:00
Muir Manders
15d8a74ff2 rcutil: add warning for duplicate configs
Summary: Warn user about potentially confusing duplicate config entries when we are making automated edits to repo/user config file.

Reviewed By: quark-zju

Differential Revision: D44876243

fbshipit-source-id: 7d50df7f55e68f3655f6086156e803e52a2b4154
2023-04-11 17:51:25 -07:00
Muir Manders
b48f2144af rcutil: handle duplicate keys better
Summary: When there are duplicate config keys present, we now update the final (load bearing) one instead of the first one.

Reviewed By: quark-zju

Differential Revision: D44875407

fbshipit-source-id: fa546482cbbdb432fb7d02a716e4692022388dc5
2023-04-11 17:51:25 -07:00
Xavier Deguillard
39c4b2a309 prjfs: handle invalidation concurrently to stop
Summary:
We've seen cases where invalidation is happening concurrently to
`PrjfsChannel::stop`. In that case, `getInner` would return a `nullptr` and
thus crash EdenFS as the code doesn't handle `nullptr` gracefully.

The root cause of why `stop` is being called on a mount that is still being
used is not entirely clear at this point due to the complexity of the
mount/unmount code which chadaustin is currently looking into. While this diff
should be revisited once Chad has reworked mount/unmount, we can make the code
correct by simply handling the `nullptr` case to avoid crashing.

Reviewed By: chadaustin

Differential Revision: D44875003

fbshipit-source-id: 977c59af9fcf0ae2c66929f22489370c18b92f94
2023-04-11 17:28:23 -07:00
Muir Manders
9a47a90b52 debugnetwork: test mononoke connectivity via local auth_proxy
Summary: If auth_proxy.unix_socket_path is configured, use that when testing for Mononoke HTTP connectivity.

Reviewed By: johansglock

Differential Revision: D44883873

fbshipit-source-id: 1c30645072842391ad9aa6b2548ee87bd1449896
2023-04-11 17:24:32 -07:00
generatedunixname89002005307016
394036b283 upgrade pyre version in fbcode/eden - batch 1
Differential Revision: D44881818

fbshipit-source-id: ae9f23f8032e877541745a0418bb40174cc78de8
2023-04-11 16:59:03 -07:00
Jun Wu
56d9b52517 rebase: support more descriptive conflict labels
Summary:
Added a config option `experimental.rebase-long-labels`. Once set to true,
produce more descriptive conflict markers "dest (rebasing onto)" and
"source (being rebased)" on conflicts.

Eventually we probably want this to be the default everywhere. For now, not
all users are compatible with this change so it's not yet the default.

Reviewed By: muirdm

Differential Revision: D44847924

fbshipit-source-id: b832f362cc1dd80e25a3fd80e0f334bffc4b12d8
2023-04-11 15:49:08 -07:00
Jun Wu
b7b797a485 clone: migrate revlog to lazytext after clone
Summary: This avoids revlog and its problematic code paths for all `pull` commands.

Reviewed By: sggutier

Differential Revision: D44805076

fbshipit-source-id: a4efacf111f03cda5752fe1b25d26a278c25f242
2023-04-11 15:32:51 -07:00
Mark Juggurnauth-Thomas
5ca0d3803d walker: stop logging ODS stats per blob type
Reviewed By: mitrandir77

Differential Revision: D44752057

fbshipit-source-id: 28d22fd6ab74a82feb5d80da3d34445d6a06445b
2023-04-11 14:38:55 -07:00
Clara Rull
4a173f7127 Migrate commit validator to Clapv3
Summary: Migrate commit validator tool to Clapv3

Differential Revision: D44744111

fbshipit-source-id: ccd68c9d1e11b51121f55968ee5470f6d1ec477d
2023-04-11 11:23:51 -07:00
Rajiv Sharma
7ed783094a Add support for git-extra-headers
Summary: The previous diffs added support in SCS and remote-gitimport for including the `git-extra-headers` as part of the mirrored commits in Mononoke. This diff adds similar support for gitimport.

Differential Revision: D44869271

fbshipit-source-id: 5941b0c8729cd972188cc758837c6c1f1b0f72a1
2023-04-11 08:22:40 -07:00
Rajiv Sharma
d6437e07c8 Log the blobstore key while healing ContentMetadataV2
Summary: The current healing logs just mention that a CMv2 blob was healed, but there is no mention of the actual blobstore key that it healed. This diff updates that.

Reviewed By: mitrandir77

Differential Revision: D44164682

fbshipit-source-id: c156a930716499fb1b5c7b248ce11d6bf88f8281
2023-04-11 05:28:18 -07:00
Rajiv Sharma
0551fadccd Enable double writing of ContentMetadata
Summary: To maintain backwards compatibility for a while, we will be writing both the new `ContentMetadataV2` and the old `ContentMetadata` blobs. This will be behind a tunable which will be removed once we can verify that the code works as expected with `ContentMetadataV2`

Reviewed By: markbt

Differential Revision: D44221076

fbshipit-source-id: 95c01a96198a99e53ab3ea4f1b04b1ba78f4b298
2023-04-11 05:10:37 -07:00
Rajiv Sharma
e5b45f5bf2 ContentMetadataV2: Everything, Everywhere, All At Once
Summary: D44136799 was the backout diff for backing out all the ContentMetadataV2 changes made so far. This was due to the reason that the changes were landed before the backfilling was completed. This diff is the revert of the backout, to be landed when the backfilling is properly completed.

Reviewed By: YousefSalama

Differential Revision: D44195175

fbshipit-source-id: 2872c699cc7c41cf436a1c7123e01a5190db7ece
2023-04-11 05:10:37 -07:00
Katie Mancini
5175eb8887 return value instead of error for non source control types
Summary:
Eden's readdir and getfileAttribute endpoint returns an error when an entry in
a directory has a type that is not: regular file, directory, or symlink.

This causes issues for Buck2 because it propagates this error to the user. For
Buck2 a directory having a file that isn't a regular file, directory, or
symlink isn't an error case, it's just a file Buck2 wants to skip over. Buck2
would like to be able to differentiate real errors getting the filetype (like
say a network error) and having a weird file in some directory.

From chatting with Thomas, Buck2 is unlikely to ever care what type the file
is (if its not a file, dir or symlink). So it's sufficient just let buck2
know it's some "other" type of file. I think it makes sense to just add a non
source control type here. I also considered adding dtype as an attribute, but
I don't think we need it, but we could add that too.

In some cases it can be dangerous to add values to thrift enumeration
(SourceControlType enum we change below)
(reference post: https://fb.workplace.com/groups/thriftusers/permalink/785884732120941/).

But in our case, rust + Buck2 handles new enum types gracefully
(and with exactly the behavior we want):
https://our.intern.facebook.com/intern/diffusion/FBS/browse/master/fbcode/buck2/app/buck2_common/src/io/eden.rs?lines=157

so adding a value to the enum is safe (for buck2).

hack is our other client. they are going to handle it less gracefully:
 https://www.internalfb.com/code/fbsource/[65673fd318750984372aeb5b44036a259a0d85d2]/fbcode/hphp/hack/src/facebook/hh_distc/package/package.rs?lines=441 but from what I can tell hack would also
 error if they tried to list a directory with a socket in it with out this
 change. Will confirm with them that this change is ok with them.

Reviewed By: chadaustin

Differential Revision: D44794698

fbshipit-source-id: 4e3ab7964fa2c0932b0363fb9ad62f24af74480c
2023-04-10 18:28:23 -07:00
Evan Krause
4a699c8899 tests: Replace uses of egrep with grep -E for failing centos tests
Summary:
I saw builds/tests were failing for centos due to a warning "egrep: warning: egrep is obsolescent; using grep -E".

We can instead use grep -E as recommended.

Note: this isn't every single test, but somehow only these tests had failures in the Centos CI job.

Reviewed By: muirdm

Differential Revision: D44848131

fbshipit-source-id: ba182e8c866ac6bd649f820b76097e4677295105
2023-04-10 16:59:17 -07:00
Muir Manders
b8bb5dc518 pullcreatemarkers: configure post-pull hook in extension
Summary: Configure post pull "debugmarklanded" hook in the requisite extension to avoid trying to run the hook when the extension is disabled.

Reviewed By: zzl0

Differential Revision: D44646572

fbshipit-source-id: 1ac2dd97d35616683b87223a97ebbe7aecaa0a91
2023-04-10 16:25:13 -07:00
Muir Manders
397386825b manifest: don't crash for submodules
Summary:
Don't crash on the "m" flag used to mark submodules in the manifest.

Also, deprecrate "sl manifest" in favor of "sl files". The "sl manifest --all" flag doesn't work anymore, anyway.

Reviewed By: sggutier

Differential Revision: D44772327

fbshipit-source-id: bad76f0defe95c4a11df9b606e56983583dc5e32
2023-04-10 15:47:28 -07:00
Genevieve (Genna) Helsel
e5314344dd add --force option to eden_fsck C++ binary
Summary: We offer the `--force` flag with the python implementation, this adds it for the C++ implementation in preparation for migration

Reviewed By: kmancini

Differential Revision: D44473785

fbshipit-source-id: 041613ff0d4048b40b02f7d8f024c78d659516f0
2023-04-10 15:32:12 -07:00
Andres Suarez
f28416d323 Update various deps to remove windows-sys <0.45.0
Reviewed By: diliop

Differential Revision: D44825274

fbshipit-source-id: 91a11c1bdf8bca7a4bee7e839d8f5a36d19a555c
2023-04-10 13:26:13 -07:00
Xavier Deguillard
ca6b729898 config: only enable GC on Windows
Summary:
Noticed that this was running while looking at a log on Linux. This does nothing on Linux/macOS besides loading inodes (ie: extra overhead), thus disable it.

Created from CodeHub with https://fburl.com/edit-in-codehub

Reviewed By: genevievehelsel

Differential Revision: D44835074

fbshipit-source-id: 3b80e4ccf0f63d50de395002c6a8d05a5e99952c
2023-04-10 11:23:11 -07:00
Saul Gutierrez
6f235fd970 fix wacky arc debugnamecomplete bug
Summary: Fixes a wacky bug with one of our internal tools

Reviewed By: pushpakrajgautam

Differential Revision: D44811936

fbshipit-source-id: f3b6f07ff035c8d535792dec5add5146c1314f36
2023-04-10 04:38:28 -07:00
Andres Suarez
73afd9815a Remove rust-analyzer
Summary:
rust-analyzer is now built elsewhere see D44593330 and
https://fb.workplace.com/groups/rust.language/posts/24528978643390753

Reviewed By: diliop

Differential Revision: D44809188

fbshipit-source-id: 41ea8980601dc1237e6fdcfc84193d1b038c3553
2023-04-07 20:27:41 -07:00
Adam Pugh
52d0102e6b Grammar Update
Summary:
Grammar update:

"eden debugedenimporthelper command command will be sent to this file."

Removed repeated ‘command’

Created from CodeHub with https://fburl.com/edit-in-codehub

Reviewed By: chadaustin

Differential Revision: D44799690

fbshipit-source-id: 03e70a8ec300d2b635ea02f9e03802a4f44e9d32
2023-04-07 13:52:25 -07:00
Chad Austin
3d4cf0f934 add a script to force unmount every EdenFS mount under TMPDIR
Summary:
We have a force-unmount-all.sh script as a last resort when a Linux
machine has a pile of stuck FUSE mounts.

Introduce a new script that only unmounts the ones under $TMPDIR,
which were probably created by failed integration tests.

Reviewed By: mshroyer

Differential Revision: D44797173

fbshipit-source-id: 41f31cf1e2e57ad07076cf1b2571c739b67b77f0
2023-04-07 13:34:05 -07:00
Zhaolong Zhu
e5f3c0df4a copytrace: fix clippy warning
Summary: fix clippy warning by using replacing match with if let

Reviewed By: quark-zju

Differential Revision: D44728168

fbshipit-source-id: 27a944267263595ea9367c08f6716a3d2f6820bb
2023-04-07 05:24:14 -07:00
Zhaolong Zhu
ab300ac951 copytrace: check if the path is in the target commit when no rename commits found
Summary:
we need to check if the path is in the target commit when no rename
commits found, this fixes a bug found in the previous test

Reviewed By: quark-zju

Differential Revision: D44728170

fbshipit-source-id: 7a039b0f9fee80671653e1557b80b218b58f4e99
2023-04-07 05:24:14 -07:00
Zhaolong Zhu
b172283113 copytrace: refactor vertex_to_tree_manifest
Summary:
refactor vertex_to_tree_manifest  to only process one commit, so it can be used in the following
diff to check if a path is in a commit

Reviewed By: quark-zju

Differential Revision: D44728172

fbshipit-source-id: fc9530b38757d836ca8a5a46e463a5ade510839d
2023-04-07 05:24:14 -07:00
Zhaolong Zhu
0ef35460d5 copytrace: add more unit tests
Summary:
this diff adds more unit tests to cover: multiple renames, non-linear
comit graph, deletes.

This diff contain tests catch a bug in the current implementation, which
will be fixed in the following diffs.

Reviewed By: quark-zju

Differential Revision: D44728169

fbshipit-source-id: b0aaeeffa9008a70bbfe3105cceed3afb3d65d45
2023-04-07 05:24:14 -07:00
Zhaolong Zhu
3b694a9f70 copytrace: add more tracing statements
Summary: add more tracing statements for debugging

Reviewed By: quark-zju

Differential Revision: D44728171

fbshipit-source-id: 6727e2445f6be91087feca17ed3e4fced649e7f9
2023-04-07 05:24:14 -07:00
Zhaolong Zhu
10b0369f9c dag: update doc of DagAlgorithm::sort
Summary: Makes it explicitly mention that `sort` method sorts the set in topo descending order, this is different than the `sort` function in revset, which sort the set in ascending order by default.

Reviewed By: quark-zju

Differential Revision: D44728173

fbshipit-source-id: aa95993b237ebacc587147da9caccdf43ff48b80
2023-04-07 05:24:14 -07:00
Zhaolong Zhu
a73dc83fe8 copytrace: add unit test infra and simple test
Summary: Add test utilities for testing copy trace logic, also added a simple test case as an example.

Reviewed By: quark-zju

Differential Revision: D44559585

fbshipit-source-id: b03796fa3869d94edc528d570d511b1d84b15861
2023-04-07 05:24:14 -07:00
Zhaolong Zhu
cdfebae59a dag: add vertex_fn parameter to ImportAscii trait
Summary:
add vertex_fn parameter to ImportAscii trait, so that we can control
how to generate Vertex from a string: for example HgId expects 20-bytes vertex.

Reviewed By: quark-zju

Differential Revision: D44739947

fbshipit-source-id: c82c95ce4d6c45562c32ad4ccc3e5b40fd517770
2023-04-07 05:24:14 -07:00
Mark Shroyer
b260939c66 Move ProjFS enumerator into getEnumerationData callback
Summary:
Even though we only need the Enumeration in the future's callback, if we don't
move the Enumerator it can get dereferenced while we're awaiting the future
returned by prepareEnumeration().

Reviewed By: xavierd

Differential Revision: D44770398

fbshipit-source-id: a9fc91c0766b4a9f43f566887d714cbde66b1cf3
2023-04-06 19:09:05 -07:00
Xavier Deguillard
7afc5962ef utils: rewrite getMaterializedFileSize
Summary:
This allows errors to be caught and raised as well as getting file sizes bigger
than off_t which is 32-bits on Windows.

Reviewed By: chadaustin

Differential Revision: D44737139

fbshipit-source-id: 16b00c7f436da361b41ffbe8074958519e9bfc81
2023-04-06 18:29:04 -07:00
Xavier Deguillard
2ddf81496b inodes: store a MaterializedState in FileInodeState
Summary:
When the FileInode is materialized, the NonMaterializedState is entirely unused
but still consume memory. On Windows, we've seen cases where the working copy
contains 100k modified files leading to diff taking a really long time due to
EdenFS spending most of its time computing the sha1 of materialized files,
since these are not cached, this computation would be done repeatadly.

For now, this merely creates the scaffolding to enable this caching, future
diffs will move the sha1 and sizes currently stored in the Linux/macOS
OverlayFileAccess in the MaterializedState and care will be taken to invalidate
these on materialization/writes.

For now I've gone with a `union` approach as the existing `Tag` is sufficient
to know which branch of the `union` should be looked at. This is however
potentially error prone, reviewers' opinion on whether I should revamp this and
switch to a `std::variant` would be very welcome.

Reviewed By: chadaustin

Differential Revision: D44652779

fbshipit-source-id: e769f4cc0cd7e8eea0c4cde863cd37f4ceadb01f
2023-04-06 18:29:04 -07:00
Muir Manders
74e9bd7ed9 tests: fix test-eager-exchange.t
Summary:
Tweak revlog commit import to maintain a stable order (this broke after recent change to top sort the commits).

Unfortunately the new stable order is inconsistent w/ fullsegments output in test-eager-exchange.t, so separate the tests.

Reviewed By: quark-zju

Differential Revision: D44768930

fbshipit-source-id: 6757450d7d446373d1b8c943d6cbcc6029b07443
2023-04-06 17:45:16 -07:00
Jun Wu
559c6bef26 parents: use pathhistory to implement 'parents FILE'
Summary:
This works better with Git. The old filenode-based logic does not seem correct
since it might not trigger adjustlinkrev.

Reviewed By: zzl0

Differential Revision: D44751613

fbshipit-source-id: e5a2367e544f1d55c6a2c149fd33db13af623e46
2023-04-06 17:28:52 -07:00
Jun Wu
af8ac9b65b debugshell: make globals() match locals() in interactive shell
Summary: This fixes issues like https://github.com/ipython/ipython/issues/62.

Reviewed By: zzl0

Differential Revision: D44759311

fbshipit-source-id: 5ce94040cef09ac67962c147e86711971c545f91
2023-04-06 17:04:18 -07:00
Xavier Deguillard
02cd4ece0d store: split import queues per Blob/Tree/BlobMetadata
Summary:
There is a collision between Blob and BlobMetadata ObjectId causing crashes in
EdenFS. To avoid these collision, let's just split the request tracker. Kudos
to chadaustin for finding the root cause of the crashes.

Reviewed By: chadaustin

Differential Revision: D44728974

fbshipit-source-id: 52bbc3f5317342ed975507f0a431bf4d3f712d8b
2023-04-06 15:59:56 -07:00
Liubov Dmitrieva
911a35fc62 return usage of commit graph for revlog clones
Summary:
return usage of commit graph for revlog clones

Disabling is no longer needed after D44734552

Reviewed By: quark-zju

Differential Revision: D44760863

fbshipit-source-id: 0ba65f63bf8c980fc0ab9b0dce1ec895f6b5f10d
2023-04-06 14:52:57 -07:00
Katie Mancini
aad9cd3dd1 allow mounting nfs mount
Summary:
I'm getting nfs to run on windows to prototype it and see how feasible it
might be as an option on Windows. PrjFS has a very different model than EdenFS,
and that has made EdenFS correctness on Windows very difficult. NFS may be
easier to get correct, though the performance is suspect. Just exploring
options here.

After this change theoretically we should be able to mount an NFS repo.
This isn't totally true, because I cannot get the Windows NFS client to point
at a specific port, so some port mapper changes are probably going to be needed
before that really works.

NOTE: this one is more than removing ifdefs, please review carefully

Reviewed By: xavierd

Differential Revision: D44155041

fbshipit-source-id: ae424a01dc2073138070253d80e3d101863840fd
2023-04-06 13:00:32 -07:00
Katie Mancini
bca274d519 make NFS Server run on windows
Summary:
I'm getting nfs to run on windows to prototype it and see how feasible it
might be as an option on Windows. PrjFS has a very different model than EdenFS,
and that has made EdenFS correctness on Windows very difficult. NFS may be
easier to get correct, though the performance is suspect. Just exploring
options here.

After this change the NFS Server opens a socket to accept incoming connections!

Reviewed By: xavierd

Differential Revision: D44154505

fbshipit-source-id: 10c679cb390c2bab99591656d6fe96ccdf4443fe
2023-04-06 13:00:32 -07:00
Katie Mancini
04c2b8b54c get NfsDispatcherImpl building on Windows
Summary:
I'm getting nfs to build on windows to prototype it and see how feasible it
might be as an option on Windows. PrjFS has a very different model than EdenFS,
and that has made EdenFS correctness on Windows very difficult. NFS may be
easier to get correct, though the performance is suspect. Just exploring
options here.

After this change NFS builds on Windows!

NOTE: this one is more than removing ifdefs, probably the most non trivial in the stack, please review carefully

Reviewed By: xavierd

Differential Revision: D44153443

fbshipit-source-id: b07e19f8bde1aa455eec97647ea450849133041f
2023-04-06 13:00:32 -07:00
Youssef Ibrahim
f2ae8faeb7 tunables: add special keys :override: and :default: to by-repo tunables
Summary: Sometimes it's desirable to set the value for a by-repo tunable for all repos (e.g. to roll out a change everywhere after testing on some of the largest repos, or to quickly roll back) or to specify a default value, and right now the only two ways of doing this is either to specify the value for every single repo separately, or to have another non-by-repo tuanble that overrides it. Instead let's have two special keys: ":override:" and ":default:", so whenever we try to lookup a by-repo tunable we first check if it's set for ":override:" and use its value if so, otherwise we lookup the repo specific value, otherwise we lookup the value for ":default:".

Reviewed By: markbt, RajivTS

Differential Revision: D44750394

fbshipit-source-id: d8fe074ec700f69e52129dfa7de87b7972d11012
2023-04-06 10:36:48 -07:00
Katie Mancini
df836e85cd remove accidental network fetch
Summary:
This continues my slashing of fetch retries. This diff is -1 fetch retry.

DatapackStore::getTree is not a local only tree access. It may fallback to
fetching from edenAPI.

DatapackStore::getTree is used in the hg importer fallback code path for when
normal edenAPI rust binding fetching fails. It's unnessecary to be doing this
extra network fetch here, because we only want one edenAPI attempt and then to
fall back to the importer.

If I had to guess why this is here:
IIRC this method use to be a local only access to the hgcache. That seems to
line up with the logging comments around this fetch. So I think when the
datapack store gained remote fetching capabilities this one just wasn't changed.

With this change we are now down to what looks like 5 network fetch attempts.

Reviewed By: xavierd

Differential Revision: D44523824

fbshipit-source-id: f5e784660b396ad3a8f1e7effcd7551c3b126521
2023-04-06 10:09:53 -07:00
generatedunixname89002005307016
7870b8259b Add annotations to eden/scm/edenscm/ext/checkserverbookmark.py
Reviewed By: zzl0

Differential Revision: D44612808

fbshipit-source-id: 1f886282a52f47288fdeb105802746dc9c994302
2023-04-06 08:23:27 -07:00
Liubov Dmitrieva
222aea47f2 intro high level transaction for cloud sync
Summary:
intro high level transaction for cloud sync

this is for syncs that are not running with best effort option

the transaction is needed to eliminate repo changed while backing up errors

this is a follow up after https://www.internalfb.com/diff/D41871718 that hasn't resolved the errors fully

Reviewed By: markbt

Differential Revision: D44664729

fbshipit-source-id: da411cd20fb909c22ff8976dd31bd46034a28226
2023-04-06 07:00:57 -07:00
Muir Manders
1d54e0e605 revlog: topo sort commits before adding
Summary:
In certain edge cases, during pull we are using EdenAPI to fetch nodes and feeding them into a revlog changelog (via doublewrite). This was erroring out since the RevlogCommits.add_commits expected nodes to be sorted parent-before-child. Work around by sorting the nodes.
[MSDK] Update icsp_domain_config_type_linter component on ICSP:master
```

Reviewed By: quark-zju

Differential Revision: D44734552

fbshipit-source-id: 7f00a93b93921baa827a55c7c1ec9388b74ac0f7
2023-04-05 20:47:38 -07:00
Chad Austin
7d4a54eb11 DirList -> {Fuse,Nfs}DirList
Reviewed By: xavierd

Differential Revision: D44716052

fbshipit-source-id: 45bd5d4b1e55792a3f43853dd4decc1faf4a1a9e
2023-04-05 16:35:43 -07:00
Chad Austin
6a3f255736 return ImmediateFuture from FuseChannel::flushInvalidations
Summary: We don't want arbitrary callbacks running on the invalidation thread.

Reviewed By: xavierd

Differential Revision: D44657334

fbshipit-source-id: a1c2017334cac45cb66f0f7c50a1215323d297e8
2023-04-05 16:27:02 -07:00
Chad Austin
76b5324623 rename EdenMount::startChannel to startFsChannel
Summary:
To disambiguate Thrift channels from filesystem channels, rename
startChannel to startFsChannel.

Reviewed By: xavierd

Differential Revision: D44657273

fbshipit-source-id: 4b43cf6cf0c094ca273f04bbbcfc0486c3b00cf0
2023-04-05 16:27:02 -07:00
Chad Austin
f885cc00a5 refactor use of TraceBus
Summary:
There's no need to wrap TraceSubscriptionHandle in another struct or
manage its lifetime with shared_ptr. It looks that was done in one
place and then cargo-culted elsewhere.

Reviewed By: xavierd

Differential Revision: D44657251

fbshipit-source-id: d5563626c52192be3e2fa44de2f4819ca3ebe1ec
2023-04-05 16:27:02 -07:00
Chad Austin
a65d1cbd11 small clarifications to TraceBus
Summary:
TraceBus isn't easy to use correctly. Clarify some comments to make
the rules more explicit and unify the two constructors to allow
(noexcept) entry construction in place.

Reviewed By: xavierd

Differential Revision: D44657217

fbshipit-source-id: 1fa7c0e3c4ffb169be2b7b0cd1ffa2ea07dfeeb1
2023-04-05 16:27:02 -07:00
Xavier Deguillard
1205385e36 integration: remove Buck1 tests
Summary: Buck1 is EOL and these tests are thus no longer necessary.

Reviewed By: chadaustin

Differential Revision: D44717980

fbshipit-source-id: bfe0d9977243c35405e1b5cc988b687369488d0c
2023-04-05 15:32:37 -07:00
Mark Juggurnauth-Thomas
64be5511f5 context: reset the scuba sequence counter for loops and edenapi requests
Reviewed By: singhsrb

Differential Revision: D44715322

fbshipit-source-id: ea71ba6ea513916b95129b3e9c60677f70a499be
2023-04-05 15:20:52 -07:00
Barys Skarabahaty
caad6a5862 switch env_logger to 0.10
Summary:
There is a new `Target::Pipe` that could be used to redirect logs to a file. So updating to the latest version which doesn't add any breaking changes.

Also, updating the deprecated call sites:
```
xbgs -sl 'env_logger::from_env' \
| arc linttool debugfilterpaths --take RUSTFMT \
| xargs sed -i 's/env_logger::from_env/env_logger::Builder::from_env/'

arc f
```

Reviewed By: dtolnay

Differential Revision: D44671457

fbshipit-source-id: 6734f2839731b189564d3b7ceffcd95410fe02e8
2023-04-05 14:02:08 -07:00
Saul Gutierrez
2793fd61ef fix debugrebuildchangelog --revlog
Summary: There is a typo in `_clonetotmp` that makes it crash. It should be `ident.configrepofile` instead of `ident.configerpofile`

Reviewed By: muirdm

Differential Revision: D44709074

fbshipit-source-id: 60160d68eea6b5cfafa10c5a053ade44a54724a5
2023-04-05 13:05:17 -07:00
Xavier Deguillard
66811395db service: remove "required" from eden.thrift
Summary: This is deprecated and Thrift is warning about it, remove it.

Reviewed By: fanzeyi

Differential Revision: D44695237

fbshipit-source-id: 6f91f50574d2898d98cfb9c732c2d15e5789087a
2023-04-05 12:24:50 -07:00
Muir Manders
a0d0db81be blame: remove "--skip" option
Summary:
This experimental option allowed you to automatically "jump" past the specified revisions when annotating a file. The idea is you could skip big codemods/renames etc. that touch a lot of lines without meaningful changes.

However, no one uses it. The idea is good, but to use it you need to know a priori what revs you want to skip. A better integration might let you configure known annoying revisions, or maybe let you filter commits by their commit message.

Plus, any decent blame UX allows you to easily jump passed boring commits.

Reviewed By: zzl0

Differential Revision: D44596603

fbshipit-source-id: 3e5707bb2e14aecaf4f56388afb7eb49951b6d31
2023-04-05 12:05:57 -07:00
Muir Manders
b6e6497203 blame: support fetching blame data from EdenAPI
Summary:
If experimental.edenapi-blame is configured and the repo has an edenapi client, the annotate command will fetch blame data from the new blame endpoint.

Currently this doesn't support any of the whitespace options since the server only provides whitespace sensitive blame data. We can probably emulate the whitespace insensitive behaviors locally with more work.

Reviewed By: mitrandir77

Differential Revision: D44596604

fbshipit-source-id: 73d7462d0ded2d6941b704dfb0294e52f462879a
2023-04-05 12:05:57 -07:00
Muir Manders
911de56fb9 handlers: add "blame" handler
Summary:
This handler simply exposes the existing blame derived data over EdenAPI.

The main work is re-indexing the commit index so it can be a simple list instead of a VecMap.

Any error is propagated in-band in the results. I was a little surprised to learn that errors within the HandlerResult stream are ignored (i.e. not propagated to client). It seems like the stream items should have an envelope type to allow automatic Result propagation from server to client.

Reviewed By: quark-zju

Differential Revision: D44596606

fbshipit-source-id: 0ae9d501a35e3e930fd4cbe710fd3e76f493312c
2023-04-05 12:05:57 -07:00
Muir Manders
42fdfd8b8e blame: add edenapi client support
Summary: Add HTTP client and py bindings methods for performing EdenAPI "blame" operation.

Reviewed By: zzl0

Differential Revision: D44596608

fbshipit-source-id: 1961921b5157772b255cbc89140f8697530ee5fa
2023-04-05 12:05:57 -07:00
Muir Manders
5853e03874 utils: make to_hg_path operate on MPath
Summary:
The one existing user has MPath in hand (and so does my upcoming code).

Also, defer the error context to avoid copying bytes (again) when there is no error. Note that the ParseError returned by RepoPathBuf::from_utf8 itself contains the bad bytes, but there doesn't seem to be a good way to share those bytes without losing context.

Reviewed By: mitrandir77

Differential Revision: D44596605

fbshipit-source-id: d9b1f635a7e5b90828f934707845a2efcb5c08a5
2023-04-05 12:05:57 -07:00
Muir Manders
6380c56f3a blame: add edenapi types
Summary:
These mirror the Mononoke BlameV2 derived data.

I tweaked the #[auto_wire] macro to support a new #[no_default] attribute. This made it possible to stick a Result<_, ServerError> into my type without having to hand implement anything else (since Result doesn't implement Default, which otherwise was required for #[auto_wire]).

Reviewed By: quark-zju

Differential Revision: D44596607

fbshipit-source-id: 9f2cc22d9ef43deefd32d4cfff67d350045ea845
2023-04-05 12:05:57 -07:00
Zeyi (Rice) Fan
51bb5d524a Back out "debugnamecomplete: include remotenames"
Summary:
Original commit changeset: e0a130c04c80

Original Phabricator Diff: D44694398

Solving the `arc feature` problem in favor of D44695559

Reviewed By: muirdm

Differential Revision: D44713896

fbshipit-source-id: 4b870d0288e6e81577d8d398b1fb42d4e8b68dc9
2023-04-05 11:47:54 -07:00
Andres Suarez
8c65432abb Update to lru-0.10.0
Summary: https://github.com/jeromefroe/lru-rs/blob/0.10.0/CHANGELOG.md#v0100---2023-03-04

Reviewed By: mroch

Differential Revision: D44709877

fbshipit-source-id: abc8e10e723e25c92f257b6d5d53701a84e6269f
2023-04-05 10:34:45 -07:00
Egor Tkachenko
f5b4489fc2 Derive the latest underived commit for bookmark instead of all one-by-one.
Summary:
Currently WBC on each bookmark change will try to find all underived cs_ids and will request derivation for them one-by-one. This is redundand because both old path (using derivation manager) and new path (DDS) doing that discovery internally and will derive all dependency.
This diff just removing the part when WBC asks for derivation of each commits and just requests the latest underived commit, however it will still doing discovery of underived commits.
The next step would be to add an API for DDS to answer queries about derived bookmarks locations. This way we could remove discovery part completely.

Reviewed By: RajivTS

Differential Revision: D44536860

fbshipit-source-id: 3867abdf095141b89da44242a35327da02ab05f8
2023-04-05 10:09:48 -07:00
Muir Manders
7eee965002 debugnamecomplete: include remotenames
Summary: Recently D44515578 removed remotenames from the set of names, but internal internal tooling was depending on that.

Reviewed By: fanzeyi

Differential Revision: D44694398

fbshipit-source-id: e0a130c04c803e51a6e7f8a284b572047ffc0ee9
2023-04-05 08:27:16 -07:00
Rajiv Sharma
06c3d8a71b Populate git extra headers in gitimport
Summary: Now that the dependent logic is in place, this diff parses the git commits and extracts the git headers. It then passes these git headers while creating the corresponding changeset at Mononoke end using SCS's `repo_create_commit` method.

Differential Revision: D44705976

fbshipit-source-id: 464695e273908ef7642514b08158be4affc32ac2
2023-04-05 08:22:28 -07:00
Liubov Dmitrieva
dd4c17e918 introduce h2 support
Summary:
Introduce **h2** support into mononoke server.

Remove alpn crate that repeats the standard "select_next_proto" method

Server now offers the following protocols: hgcli, h2, http/1.1 in this order in protocol negotiation.

We will select the first protocol supported by the server which is also supported by the client.

This will add h2 support server side but won't change protocols currently used (because h2 is not offered client side right now, while http/1.1 is explicitly set).

We then later will switch **only** Eden Api Traffic to H2 by enabling the following config client side via slow rollout:

```
[edenapi]
http-version=2
```

We might need to tune some settings on proxygen side before that.

Wireproto traffic will continue to be obliged to set http/1.1 client side explicitly, which is totally fine because it needs web socket upgrade.

###  At a high level, HTTP/2:

* is binary, instead of textual
* is fully multiplexed, instead of ordered and blocking
can therefore use one connection for parallelism
* uses header compression to reduce overhead
* allows servers to “push” responses proactively into client caches

Reviewed By: mzr

Differential Revision: D44540283

fbshipit-source-id: 560d80d68d5d364adee122881d12cf61ba9f1695
2023-04-05 03:53:22 -07:00
Youssef Ibrahim
61d2cfda56 commit_graph_compat: clean up enable_writing_to_new_commit_graph and enable_reading_from_new_commit_graph
Summary:
Double writing is enabled for all repos for a long time, so it's safe to delete enable_writing_to_new_commit_graph.
enable_reading_from_new_commit_graph was never used since we needed more granular tunables.

Reviewed By: Croohand

Differential Revision: D44624559

fbshipit-source-id: a06a0f2079bb735e93d72d0d24bbc7ae684600a7
2023-04-05 03:20:07 -07:00
Mark Shroyer
13a2b2cf34 Drop log level for getScmStatusV2()
Summary:
Our logs are currently full of messages about the duration of
semifuture_getScmStatusV2(), which isn't very helpful.  This drops the default
level to DBG3 so that we only log at DBG2 when the request takes longer than
one second.

Reviewed By: xavierd

Differential Revision: D44693481

fbshipit-source-id: 9ff8e04ab39e960050e64930a023949962360b9c
2023-04-04 19:36:14 -07:00
Saul Gutierrez
826713fd85 clean various Rust lint warnings on Windows
Summary: As title says. Compiling on Windows has been kind of annoying lately due to the number of warnings I've seen, which this cleans.

Reviewed By: muirdm

Differential Revision: D44690961

fbshipit-source-id: 37ae8e48e4aa181ac909b3ec90c76a1438b24489
2023-04-04 18:34:22 -07:00
Muir Manders
8018c68305 sampling: only allow one creation of sampling file
Summary:
There is an issue where children sl processes inherit SCM_SAMPLING_FILEPATH and write to the same file as the parent process. This messed up the sampled data since the child's "command_duration", for example, could clobber the parent's.

Fix by only allowing one process to create SCM_SAMPLING_FILEPATH. This way the child (e.g. backgroundfsync hook) will not be able to output metrics.

Reviewed By: zzl0

Differential Revision: D44645799

fbshipit-source-id: 11f41343107802f9fd9ae2dc0fc7a9e1925859d8
2023-04-04 17:57:02 -07:00
Muir Manders
72c1ae759b sampling: use Rust to log samples
Summary: Expose sampling-category-for-key and append-sampling-event methods from Rust to Python to replace relevant logic in ui.py. This consolidates things, and may fix the issue where corrupted keys like "foo{" were getting into the sampled data.

Reviewed By: zzl0

Differential Revision: D44645798

fbshipit-source-id: e158ed7434435e1d29222cda2fc1cf0ee345010a
2023-04-04 17:57:02 -07:00
Muir Manders
eacc4ce300 sampling: switch to global state for sampling config
Summary: This makes it easier to share the sampling config with Python. In particular I want to get down to only having a single place open the SCM_SAMPLING_FILEPATH file to make it easy to fix a couple bugs (see next diff).

Reviewed By: zzl0

Differential Revision: D44645800

fbshipit-source-id: 12a0da6d1356b6c116224a3c3552692bd5aa656a
2023-04-04 17:57:02 -07:00
Muir Manders
7f630ef746 sampling: move sampling config to separate crate
Summary: I want to expose the sampling file to Python, so first let's move it to a non-tracing related crate.

Reviewed By: zzl0

Differential Revision: D44645801

fbshipit-source-id: 14da917acdc3529e17502d81846229e3ae8854e2
2023-04-04 17:57:02 -07:00
Xavier Deguillard
672b2dd726 cli: force enable-sqlite-overlay to be set on Windows
Summary:
On Windows, this should always be set to true. Unfortunately, we've rolled out
a bad EdenFS release that overwrote all of these configs and set them to false,
breaking several users.

Reviewed By: fanzeyi

Differential Revision: D44683911

fbshipit-source-id: 4d8efb3402f967b2e35fd333c858fe939307e6f0
2023-04-04 16:06:47 -07:00
Xavier Deguillard
dcf0ab0be7 config: force enable sqlite overlay on Windows
Summary:
On Windows, the sqlite overlay is always enabled despite what the config says,
encode this in the code.

Reviewed By: MichaelCuevas

Differential Revision: D44682918

fbshipit-source-id: 751a763a59f43ebcac30b8884eaf1fbd4033d1cf
2023-04-04 16:06:47 -07:00
Manu Bretelle
9d7b96ec41 sync with latest upstream now that changes have been merged
Summary:
The latest "main" contains all the patches that we were carrying on my
fork so far. Bonus point, hyperx is not a depedency anymore so we can also get
rid of this.

Reviewed By: zertosh

Differential Revision: D44682428

fbshipit-source-id: cbb1da18edce7478a5454d1a3ba70bd8767e089c
2023-04-04 15:55:35 -07:00
Jon Oh
3f6ab04069 Make hg stable commands work on windows
Summary: The hg stable commands fail to work on Windows. This is because the hg code calls a shell script to run the necessary hg commands. This diff adds a port of the shell script into python to let it work on Windows.

Reviewed By: skotchvail

Differential Revision: D44591662

fbshipit-source-id: 5d376702ccc648fe01f541b2d673ae39f954739b
2023-04-04 11:36:01 -07:00
Katie Mancini
96f6c56b7a windows write path code tour
Summary:
[Code Tour](https://github.com/microsoft/codetour) is an extension which allows you to annotate an ordered list of code pointers with descriptions, as a way of touring you through a codebase.

This diff adds a couple of tour files which are loadable by anyone who has the extension and loads this tour.

This tour walks through how we process "write requests" in the PrjFS version of Eden.

Reviewed By: chadaustin

Differential Revision: D44654254

fbshipit-source-id: e7e00e301e9445cc4f5875689a35c40bf5ad8b99
2023-04-04 11:12:24 -07:00
Katie Mancini
b3af56d80f windows read path code tour
Summary:
[Code Tour](https://github.com/microsoft/codetour) is an extension which allows you to annotate an ordered list of code pointers with descriptions, as a way of touring you through a codebase.

This diff adds a couple of tour files which are loadable by anyone who has the extension and loads this tour.

This tour walks through how we process "read requests" in the PrjFS version of Eden.

Reviewed By: chadaustin

Differential Revision: D44645249

fbshipit-source-id: 5a3a620139d95f9298d9b0ce81064d49c1c297d2
2023-04-04 11:12:24 -07:00
Chad Austin
6fd2db3802 add hg import queue events to ActivityBuffer
Summary:
This is a slight behavior change, but I need queue events published to
ActivityBuffer so I can track the live set of fetches.

The impact will be that `eden trace hg --retroactive` will show 2/3 of
the number of events that it did. We can bump the capacity if that's
problematic.

Reviewed By: xavierd

Differential Revision: D44594520

fbshipit-source-id: 5b22169403402d729ff929b4b4bec6bb76d54737
2023-04-04 10:42:45 -07:00
Chad Austin
c590ea8a82 unconditionally enable HgQueuedBackingStore's ActivityBuffer
Summary:
ActivityBuffer is enabled by default and we rely on `eden trace hg
--retroactive` working. For HgQueuedBackingStore, unconditionally
enable ActivityBuffer, and give a capacity config setting independent
from the others.

Reviewed By: xavierd

Differential Revision: D44593656

fbshipit-source-id: 284bad0d19315d250a4ab69f06439393dbeaf5d1
2023-04-04 10:42:45 -07:00
Chad Austin
29bc2406ff fix the activityBufferMaxEvents ConfigSetting's case
Summary: We only capitalize type names.

Reviewed By: xavierd

Differential Revision: D44593407

fbshipit-source-id: 9f0d841e6ff5c40d6a6c6ca3637a40fefcf5d084
2023-04-04 10:42:45 -07:00
Thomas Orozco
22e700ccf3 (reland) rust/third-party: update to futures 0.3.28
Summary:
Note: this is a re-land of D44623815, which was was reverted because of a land race with D44626072

In particular this fixes `FlattenUnordered` having a nasty deadlock, but also
some other  bugs:

```
# 0.3.28 - 2023-03-30

* Update to syn 2. This raises MSRV of utility crates to 1.56. (#2730, #2733)
* Fix bug in `FlattenUnordered` (#2726, #2728)

# 0.3.27 - 2023-03-11

* Add `TryFlattenUnordered` (#2577, #2590, #2606, #2607)
* Add `AbortHandle::is_aborted` (#2710)
* Add `AbortRegistration::handle` (#2712)
* Make `BiLock` strict-provenance compatible (#2716)

# 0.3.26 - 2023-01-30

* Add `Either::as_pin_mut` and `Either::as_pin_ref` (#2691)
* Add `Shared::ptr_eq` and `Shared::ptr_hash` (#2691)
* Implement `FusedStream` for `Buffered` (#2676)
* Implement `FusedStream` for all streams in `ReadyChunks` (#2693)
* Fix bug in `FuturesOrdered::push_front` (#2664)
* Remove `Fut::Output: Clone` bounds from some `Shared` methods (#2662)
* Remove `T: Debug` bounds from `Debug` implementations of `mpsc` and `oneshot` types (#2666, #2667)

# 0.3.25 - 2022-10-20

* Fix soundness issue in `join!` and `try_join!` macros (#2649)
* Implement `Clone` for `sink::Drain` (#2650)

# 0.3.24 - 2022-08-29

* Fix incorrect termination of `select_with_strategy` streams (#2635)

# 0.3.23 - 2022-08-14

* Work around MSRV increase due to a cargo bug.
```

Reviewed By: zertosh

Differential Revision: D44632588

fbshipit-source-id: bdd87cb02b3aef63a65b1f9b852579225adfedbd
2023-04-04 10:14:43 -07:00
Xavier Deguillard
f613702fef doctor: re-enable check_hg_status_match_hg_diff
Summary:
When this check was previously enabled, we saw 2 issues from users:
 - The check failing due to status taking more than 5s,
 - The check having false positive.

The first one can be fixed by increasing the timeout on the Thrift client, the
second one is anything but clear at first sight. Digging a bit deeper, one
issue became apparent. In:
    if modified_file not in diff:
The type of `modified_file` is a `Path`, while the type of `diff` was a
`Set[str]` (the type annotation was wrong). If we manually test this, here is
what we get:

  % python3
  Python 3.8.6 (default, Feb 10 2023, 17:15:29)
  [GCC 11.x 20221024 (Facebook) 11.2.1+] on linux
  Type "help", "copyright", "credits" or "license" for more information.
  >>> from pathlib import Path
  >>> a = {"a/b.c", "c/d.c"}
  >>> a
  {'c/d.c', 'a/b.c'}
  >>> Path('c/d.c') in a
  False
  >>> a = {Path("a/b.c"), Path("c/d.c")}
  >>> Path('c/d.c') in a
  True
  >>>

The check would have thus failed, which would have led to false positives.

Lastly, this also fixes a potential false negative, where the number of
modified files could be the same as the files in diff when the latter includes
an added/remove file but is missing one of the modified file. Removing the
check comparing both is sufficient to avoid this issue.

Reviewed By: chadaustin

Differential Revision: D44558090

fbshipit-source-id: 0cc83a87758a5feeff78c38b210ebd91fa5d58f5
2023-04-04 09:51:41 -07:00
Duncan Hill
3081646bb0 Update eden/scm/edenscm/ext/hgsql.py to resolve 3.10 DeprecationWarning
Summary:
Context
==

When the code being changed is called from a test or program using Python 3.10, deprecation warnings appear.

`DeprecationWarning: setDaemon() is deprecated, set the daemon attribute instead`

Python 3.10 is rolling out in fbcode, so it will be nice to have one less DeprecationWarning.

Implementation
==

* sed -i -E 's/(\s+)(.*)\.setDaemon\(True\)/\1\2.daemon = True/'

Reviewed By: muirdm

Differential Revision: D44620221

fbshipit-source-id: b243b5e8947c918f865efa3c46ffdc8c0e530243
2023-04-04 09:37:33 -07:00
Muir Manders
1dcb7966fc tests: turn on eagerepo for a bunch of tests
Summary: These are the tests that passed after adding "$ eagerepo". I attempted to turn on eagerepo for all tests that didn't contain "$ eagerepo" or "configure modern".

Reviewed By: quark-zju

Differential Revision: D44445379

fbshipit-source-id: b283be6d5249f74e11a3205622961e457587e93b
2023-04-04 08:42:03 -07:00
Chad Austin
100ee511c0 minor comments
Summary:
While reading through our uses of ActivityBuffer, I noticed an
opportunity to amortize the cost of publishing import events.

Add some comments to note that.

Reviewed By: xavierd

Differential Revision: D44643270

fbshipit-source-id: 1b68f904b86d91fab91af01a4e8b169dc381ad33
2023-04-03 23:40:55 -07:00
Chad Austin
7eacc91e4f use RingBuffer in ActivityBuffer to avoid allocations
Summary:
This should reduce the number of allocations when pushing and popping
events into ActivityBuffer.

Also, remove -inl.h because our clangd does not support it.

Reviewed By: xavierd

Differential Revision: D44593366

fbshipit-source-id: 7dc0f2aa457b44bebe9471edd3c7e688d09534f5
2023-04-03 23:40:55 -07:00
Chad Austin
baf60f0a42 add a RingBuffer
Summary:
`std::deque` has poor performance and bucketing in GNU libstdc++, and
sometimes we just need a ring buffer without paying for folly's
LockFreeRingBuffer.

Introduce a simple RingBuffer atop `std::vector` for later use in
ActivityBuffer.

Reviewed By: xavierd

Differential Revision: D44593248

fbshipit-source-id: 13303c27b184002fc74aec9ae6e9133c70bab6bb
2023-04-03 23:40:55 -07:00
Chad Austin
76eaffa280 fix MSVC CMake build
Reviewed By: genevievehelsel

Differential Revision: D44484403

fbshipit-source-id: 9ceca9a0c9deeff31727501f0b35405c781aff1a
2023-04-03 14:43:56 -07:00
Zhaolong Zhu
fc798609de github: move post-* hook to uisetup
Summary:
based on the doc of writing extensions, post-* hooks should be setup in the `uisetup`

```
10.1. uisetup
* Changes to ui.__class__ . The ui object that will be used to run the command has not yet been created.
...
* Setup of pre-* and post-* hooks

10.2. extsetup
* Changes depending on the status of other extensions. (if extensions.find('mq'))
* Add a global option to all commands
* Extend revset

10.3. reposetup
* All hooks but pre-* and post-*
* Modify configuration variables
* Changes to repo.__class__, repo.dirstate.__class__
```

Reviewed By: sggutier

Differential Revision: D44632035

fbshipit-source-id: f37bb052a2ab225d43cf7f305b0bcccedb4add9c
2023-04-03 14:29:16 -07:00
Mark Juggurnauth-Thomas
a7bf8e9615 caching_ext: add bypass for filling no-op memcache
Summary: When calling `fill` methods on a no-op memcache, we do all the work to serialize the data and then throw it away.  Add a quick check at the start of the fill method to exit early.

Reviewed By: YousefSalama

Differential Revision: D44503801

fbshipit-source-id: fd490bb5cce70ee1bca931e55e1671faec09e894
2023-04-03 13:48:10 -07:00
Mark Juggurnauth-Thomas
cb0bd67f70 commit_graph: don't prefetch if we only have a hint
Summary: The `Prefetch::Hint` variant indicates that prefetching is possible, but should not be acted upon unless an intermediate caching layer determines that the prefetch should be included.  That means when we ask for the target, we shouldn't return a hinted target.

Reviewed By: liubov-dmitrieva

Differential Revision: D44498446

fbshipit-source-id: 56a0fb3b09de985cca9989335375daf972e43276
2023-04-03 13:48:10 -07:00
Mark Juggurnauth-Thomas
5110cf02c6 commit_graph: do not look-up memcache for prefetches
Summary: If we have missed in cachelib, and been asked to prefetch, then memcache fetches are actually slower than the prefetch would be, even if memcache is warm. Instead, go straight to the database and prefetch from there.

Reviewed By: mitrandir77

Differential Revision: D44498103

fbshipit-source-id: 944c26d553a770e054f38f478cf2bd475afa413f
2023-04-03 13:48:10 -07:00
Mark Juggurnauth-Thomas
daf0d17391 commit_graph: prefetch first parents when computing ancestors difference
Summary: When computing ancestors difference, we need all of the commits on the `head` branches, not just the skew binary steps.  Prefetch all of them.

Reviewed By: YousefSalama

Differential Revision: D44498105

fbshipit-source-id: acf08930361f03c76685a94fff2c5a41a99089b3
2023-04-03 13:48:10 -07:00
Mark Juggurnauth-Thomas
69ad9115f3 commit_graph: make prefetch steps a parameter of prefetch
Summary: Make the number of steps taken a parameter of prefetching, so that we can vary it based on prefetch type.

Reviewed By: YousefSalama

Differential Revision: D44498104

fbshipit-source-id: 9d24af68ea620fd11a18d9dbaa822fc9848fdd3c
2023-04-03 13:48:10 -07:00
Genevieve (Genna) Helsel
1313e6a1c4 fix prefetch profiles config parsing in Rust cli
Summary: If this config was not set, it would default to `false`, and we would not use it. Instead, make these configs optional and hardcode the default.

Reviewed By: fanzeyi

Differential Revision: D44635468

fbshipit-source-id: 2464439dc20ba90745b9783f491514c5d63e2c76
2023-04-03 12:39:45 -07:00
Genevieve (Genna) Helsel
d44ad26b2e generalize FsckTest
Summary: In preparation for extending this to a paramatarized test for different `InodeCatalog` types, this generalizes the object types in the already existing test

Reviewed By: chadaustin

Differential Revision: D44633728

fbshipit-source-id: d06a9ed146ad5ea65f11f0aa16bd2725aec604dc
2023-04-03 12:12:34 -07:00
Mark Isaacson
3463e3d61b Revert D44623815: rust/third-party: update to futures 0.3.28
Differential Revision:
D44623815

Original commit changeset: 343ddb9277e1

Original Phabricator Diff: D44623815

fbshipit-source-id: 2d99e8d24fd9b13343dfeb082788b0a6258fbe8c
2023-04-03 09:25:13 -07:00
Thomas Orozco
159cf5c5e6 rust/third-party: update to futures 0.3.28
Summary:
In particular this fixes `FlattenUnordered` having a nasty deadlock, but also
some other  bugs:

```
# 0.3.28 - 2023-03-30

* Update to syn 2. This raises MSRV of utility crates to 1.56. (#2730, #2733)
* Fix bug in `FlattenUnordered` (#2726, #2728)

# 0.3.27 - 2023-03-11

* Add `TryFlattenUnordered` (#2577, #2590, #2606, #2607)
* Add `AbortHandle::is_aborted` (#2710)
* Add `AbortRegistration::handle` (#2712)
* Make `BiLock` strict-provenance compatible (#2716)

# 0.3.26 - 2023-01-30

* Add `Either::as_pin_mut` and `Either::as_pin_ref` (#2691)
* Add `Shared::ptr_eq` and `Shared::ptr_hash` (#2691)
* Implement `FusedStream` for `Buffered` (#2676)
* Implement `FusedStream` for all streams in `ReadyChunks` (#2693)
* Fix bug in `FuturesOrdered::push_front` (#2664)
* Remove `Fut::Output: Clone` bounds from some `Shared` methods (#2662)
* Remove `T: Debug` bounds from `Debug` implementations of `mpsc` and `oneshot` types (#2666, #2667)

# 0.3.25 - 2022-10-20

* Fix soundness issue in `join!` and `try_join!` macros (#2649)
* Implement `Clone` for `sink::Drain` (#2650)

# 0.3.24 - 2022-08-29

* Fix incorrect termination of `select_with_strategy` streams (#2635)

# 0.3.23 - 2022-08-14

* Work around MSRV increase due to a cargo bug.
```

Reviewed By: zertosh

Differential Revision: D44623815

fbshipit-source-id: 343ddb9277e1703104e516d07fe0610b5020930a
2023-04-03 08:30:49 -07:00
Zhaolong Zhu
3f6cd0c1b1 github: run 'pr_marker' as a hook
Summary:
We made 'pr_marker' run inline instead of as hook in D43276199, but this can cause
nested event loop runtime error in `sl pr pull`. This diff makes 'pr_marker' run as a
Python hook to avoid the nested event loop.

The difference between current hook (this diff) and previous hook is that we are running
it as a Python object instead of shelling out to `sl` command.

https://github.com/facebook/sapling/issues/58

Reviewed By: quark-zju

Differential Revision: D44531268

fbshipit-source-id: 5270b7172d7b2c22a9c9e715d7cb5b42181cff53
2023-04-03 06:39:58 -07:00
Mark Shroyer
5a5081f95e Use sw_vers to get macOS version for rage
Summary:
Some Python versions don't return the correct macOS version from
`platform.mac_ver()`, so let's use `/usr/bin/sw_vers` instead.

Reviewed By: xavierd

Differential Revision: D44594569

fbshipit-source-id: ee52f11aad76361b780845de8218b2f365f0ecfe
2023-03-31 17:13:09 -07:00
Xavier Deguillard
e83f2680dc inodes: use an EdenConfig for the OverlayFileAccess cache size
Summary:
Using an EdenConfig instead of a GFlags allows for rolling out config changes
automatically while GFlags do not allow this.

Reviewed By: chadaustin

Differential Revision: D44593575

fbshipit-source-id: 2b3e6858c031ba63b89787c3456542e79671d4ea
2023-03-31 16:29:07 -07:00
Mark Shroyer
78031282c6 top: Don't crash on small terminals
Summary:
`eden top` would previously crash if its terminal window was resized too small,
due to incorrectly specifying a negative padding width in a format specifier.

Reviewed By: xavierd

Differential Revision: D44564714

fbshipit-source-id: 936f346ce7e7f5cb0f18cdbffa269cb0fd06be91
2023-03-31 14:35:41 -07:00
Chad Austin
56c1538580 prevent enabled command fallback to Python when it's run without --help
Summary:
I'm introducing a new Rust-only command implementation, and I never
want it to fall back to Python help, even if it's run without a
required option. Therefore, handle
DisplayHelpOnMissingArgumentOrSubcommand as well as DisplayHelp.

Reviewed By: fanzeyi

Differential Revision: D44560239

fbshipit-source-id: 43c418da3c980a34a11277c82bf350822b0bc71b
2023-03-31 11:08:05 -07:00
David Tolnay
b16ffe2361 Unfork and update reqwest
Reviewed By: zertosh

Differential Revision: D44556211

fbshipit-source-id: 4a4b924163db5270f956aff58e0e2087d115715c
2023-03-30 18:48:13 -07:00
Andres Suarez
c50f383869 Update tempfile from 3.4 to 3.5
Reviewed By: quark-zju

Differential Revision: D44524245

fbshipit-source-id: 167471d01b0afbbc34ced88574dbfb09799aadf6
2023-03-30 17:11:37 -07:00
Genevieve (Genna) Helsel
8a1dc69e3a default enable-sqlite-overlay to true on Windows in python
Summary:
This config is already hardcoded to default to true on Windows in the C++ where it is consumed, and is set to true during clone, but in the case where the config is not set on disk, we should also default it to true in the python.

```
    def _get_enable_sqlite_overlay(
        self, instance: EdenInstance, overlay_type: Optional[str]
    ) -> bool:
        if overlay_type is None:
            # The sqlite backed overlay is default only on Windows
            return sys.platform == "win32"

        return overlay_type == "sqlite"
```

```
  auto enableSqliteOverlay =
      repository->get_as<bool>(kEnableSqliteOverlay.str());
  // SqliteOverlay is default on Windows
  config->enableSqliteOverlay_ =
      enableSqliteOverlay.value_or(folly::kIsWindows);
```

Reviewed By: chadaustin

Differential Revision: D44544561

fbshipit-source-id: 78f3b7c72934a377ffedcd6503b6948d282d2f49
2023-03-30 14:58:06 -07:00
Zeyi (Rice) Fan
f212c09b54 show commit message in zsh completion
Summary: Commit messages in ZSH completion!

Reviewed By: quark-zju

Differential Revision: D44515578

fbshipit-source-id: dc651d5a391ffa8503ec9514c8ff92227d08a26e
2023-03-30 13:28:39 -07:00
Chad Austin
fa20833684 sort the subcommands alphabetically
Summary:
They were in random order. Sort them alphabetically before adding a
new one.

Reviewed By: fanzeyi

Differential Revision: D44525570

fbshipit-source-id: a574b6c377f76b4fbad5d7210f772a215ad35cf1
2023-03-30 11:54:14 -07:00
Chad Austin
42017237c7 replace Display instance with a name() function
Summary:
Display is a stronger constraint than what we need, which is a way to
get `&`static str` from a subcommand.

Reviewed By: fanzeyi

Differential Revision: D44525506

fbshipit-source-id: 7fa2f8665ed4c986c25aa58197083e93b5b059cc
2023-03-30 11:54:14 -07:00
Pierre Chevalier
95d005132a Fix flaky cross-repo-globalrevs test
Summary:
This test used to be detected as flaky in mode/dev-rust-oss and flaky, but not detected as such in mode/opt.

This was due to a race condition between fresh and warm bookmarks, which take a while to update due to WBC.

Using the helper functions to wait for bookmarks to get warm, or directly querying fresh ids, fixes the issue.

Reviewed By: RajivTS

Differential Revision: D44543648

fbshipit-source-id: f70b16609fe995341b84a77e590efdc3d71b4fdf
2023-03-30 11:53:36 -07:00
generatedunixname89002005307016
7e54ae0f7a Add annotations to eden/scm/edenscm/ext/rage.py
Reviewed By: quark-zju

Differential Revision: D44536985

fbshipit-source-id: 1ab3b2cf22c0cc285b45bbfe9ff3fbc2d56dbb17
2023-03-30 10:48:08 -07:00
Pierre Chevalier
5c2ec7a021 Really fix test that sometimes breaks contbuild
Summary:
D44297278 was an attempt at fixing this test, but the regex for lines with DEBUG
wasn't actually correct as it's not actually the first pattern in the strings being grepped.
It may be preceded by some spaces.

Yesterday, we saw a contbuild breakage caused by this.
https://www.internalfb.com/intern/sandcastle/job/9007200167370789/insights

Relax the grep step to achieve the intent of the previous diff.

Reviewed By: RajivTS

Differential Revision: D44536438

fbshipit-source-id: a40719f4669b55b2442715bc9350b8dcce7a9747
2023-03-30 05:09:43 -07:00
Mateusz Kwapich
dc7a5cea3e separate out tests with disabled network access
Summary:
Running tests with network access disabled is much slower. Let's separate those
test targets out so on CI we run with and without network access disabled. For
iterating during developement the tests with network access enabled are
usually enough.

In this diff I:
 * add `disable_all_network_access_target` option to `dott_test` rule that adds the extra test target disabling network access
 * convert existing opt-out list into options on test target - this required  separating some targets as the config is now on per-target not per-test level

Reviewed By: clara-9

Differential Revision: D44474156

fbshipit-source-id: 780fc81c24b22e2dcae98901cd604dc50f16c70c
2023-03-30 04:31:24 -07:00
Genevieve (Genna) Helsel
d01d855a74 delete old overlay doctor check and fix default value for enable-sqlite-overlay in python
Summary: This rollout has long been finished (the initial rollout from sqlite -> tree). However, I recently renamed tree -> sqlite, which can trigger incorrectly trigger this check since we assume `enable-tree-overlay/enable-sqlite-overlay` is false if its not in the config, but the config is only set to true upon clone. This behavior does not affect the C++ b/c we only write the config during clone.

Reviewed By: xavierd

Differential Revision: D44523497

fbshipit-source-id: ef19af0932fb8f7747bd7b90b8eabe92c1ddc13c
2023-03-29 20:30:02 -07:00
Mark Shroyer
504f959759 Fix PrjFS Enumerator quadratic complexity
Summary:
This removes unnecessary quadratic work during directory enumeration. Instead of iterating over the entire set of directory entries and performing string matching on each of PrjFS's invocations of `getEnumerationData`, we now compute this once per enumeration by keeping state in a new `Enumeration` type.

With this change, listing with cmd.exe's `dir` becomes fast. However, PowerShell core 7's `ls` can still be slow because it seems to devolve to single-entry (PRJ_CB_DATA_FLAG_ENUM_RETURN_SINGLE_ENTRY) fetches past a certain directory size. Further work will be needed to make `ls` fast in PowerShell.

This improves performance listing a directory with 151433 entries:

|        | Dev `dir` | Opt `dir` |
|--------|-----------|-----------|
| Before | 15m23s    | 20s       |
| After  | 13s       | 5s        |

Reviewed By: chadaustin, xavierd

Differential Revision: D44150897

fbshipit-source-id: 251171df800eec6f1f917b65abeea37c3808f2fa
2023-03-29 18:34:52 -07:00
Mark Shroyer
6203052f67 Add integration test for ProjFS enumeration
Summary:
On Windows, the `NtQueryDirectoryFile` low-level API exposes some behaviors—such as restarting partway through a directory enumeration, setting filename filters, and requesting single entries at a time—that are implemented by our ProjFS provider, but were not previously covered by our integration tests.

This change adds coverage by exposing `NtQueryDirectoryFile` via a Python extension module, then exercising it on an EdenFS mount in a new test.

Reviewed By: xavierd

Differential Revision: D44356956

fbshipit-source-id: 4114a0be95092b8276156ba7fd895f64d9e64c3a
2023-03-29 18:34:52 -07:00
Muir Manders
3215b15fd5 status: treat symlinks as regular files when unsupported
Summary: Tweak Rust status code to explicitly treat symlinks as regular files if the VFS doesn't support symlinks. This fixes weirdness where they were previously considered "untrackable" and wouldn't show up at all in "hg status".

Reviewed By: sggutier, zzl0

Differential Revision: D44521987

fbshipit-source-id: 8944ab115635268c997e5cb443d870b71c353f83
2023-03-29 17:02:41 -07:00
Xavier Deguillard
51c5503e98 service: support remote fetching from eden debug blobmeta
Summary:
Now that EdenFS can fetch blob metadata from the server, let's make sure to
plug it to the `eden debug blobmeta` command.

Reviewed By: kmancini

Differential Revision: D44186943

fbshipit-source-id: a64f1384cf312e3c677505c330cfc82469fb83f3
2023-03-29 15:35:52 -07:00
Xavier Deguillard
e8c214db57 store: support fetching aux data via ObjectStore
Summary:
Now that the Mercurial backingstore knows how to fetch aux data, let's thread
this through the ObjectStore.

Reviewed By: kmancini

Differential Revision: D44110102

fbshipit-source-id: c57da05066d80fee199e45b4a4223168a196e3de
2023-03-29 15:35:52 -07:00
Katie Mancini
c76ead3eda get mountd building on windows
Summary:
I'm getting nfs to build on windows to prototype it and see how feasible it
might be as an option on Windows. PrjFS has a very different model than EdenFS,
and that has made EdenFS correctness on Windows very difficult. NFS may be
easier to get correct, though the performance is suspect. Just exploring
options here.

Reviewed By: xavierd

Differential Revision: D44153341

fbshipit-source-id: 8351c72e1ad4dd41090a6289aadebc6749bdf056
2023-03-29 12:52:44 -07:00
Katie Mancini
9265f1e7df get mount rpc building on Widnows
Summary:
I'm getting nfs to build on windows to prototype it and see how feasible it
might be as an option on Windows. PrjFS has a very different model than EdenFS,
and that has made EdenFS correctness on Windows very difficult. NFS may be
easier to get correct, though the performance is suspect. Just exploring
options here.

Reviewed By: xavierd

Differential Revision: D44153119

fbshipit-source-id: 4d6034ea3c7c417d69da5ce54256ae8751ba2a73
2023-03-29 12:52:44 -07:00
Katie Mancini
3c3dc3ae07 get nfsd3 building on windows
Summary:
I'm getting nfs to build on windows to prototype it and see how feasible it
might be as an option on Windows. PrjFS has a very different model than EdenFS,
and that has made EdenFS correctness on Windows very difficult. NFS may be
easier to get correct, though the performance is suspect. Just exploring
options here.

Reviewed By: xavierd

Differential Revision: D44153042

fbshipit-source-id: 012adea3c89e9c4b37c08cff685e3937d2c6678b
2023-03-29 12:52:44 -07:00
Katie Mancini
6cf70b37d5 get rpc server building on Windows
Summary:
I'm getting nfs to build on windows to prototype it and see how feasible it
might be as an option on Windows. PrjFS has a very different model than EdenFS,
and that has made EdenFS correctness on Windows very difficult. NFS may be
easier to get correct, though the performance is suspect. Just exploring
options here.

Reviewed By: xavierd

Differential Revision: D44152440

fbshipit-source-id: 70de1a7dfd986b60e57079dd9f1d20a6b63dbc0f
2023-03-29 12:52:44 -07:00
Katie Mancini
ae9b25a51b get portmapper client building on Windows
Summary:
I'm getting nfs to build on windows to prototype it and see how feasible it
might be as an option on Windows. PrjFS has a very different model than EdenFS,
and that has made EdenFS correctness on Windows very difficult. NFS may be
easier to get correct, though the performance is suspect. Just exploring
options here.

Reviewed By: xavierd

Differential Revision: D44152981

fbshipit-source-id: fb2788fd2334ad0debf3d45bcb6bb04ca5667b1f
2023-03-29 12:52:44 -07:00
Katie Mancini
7ff6f41868 make stream client build on Windows
Summary:
I'm getting nfs to build on windows to prototype it and see how feasible it
might be as an option on Windows. PrjFS has a very different model than EdenFS,
and that has made EdenFS correctness on Windows very difficult. NFS may be
easier to get correct, though the performance is suspect. Just exploring
options here.

Reviewed By: xavierd

Differential Revision: D44152888

fbshipit-source-id: d213f87921d4505429aea42bfa1007a97f89f9dd
2023-03-29 12:52:44 -07:00
Katie Mancini
f18a34cc0d Getting NfsDispatcher building on Windows
Summary:
I'm getting nfs to build on windows to prototype it and see how feasible it
might be as an option on Windows. PrjFS has a very different model than EdenFS,
and that has made EdenFS correctness on Windows very difficult. NFS may be
easier to get correct, though the performance is suspect. Just exploring
options here.

NOTE: this one is more than removing ifdefs, please review carefully

Reviewed By: xavierd

Differential Revision: D44152305

fbshipit-source-id: ee39db08a53762f23bf184cc6dec41ec28627cda
2023-03-29 12:52:44 -07:00
Katie Mancini
d15b6ccd81 get nfs_utils building on Windows
Summary:
I'm getting nfs to build on windows to prototype it and see how feasible it
might be as an option on Windows. PrjFS has a very different model than EdenFS,
and that has made EdenFS correctness on Windows very difficult. NFS may be
easier to get correct, though the performance is suspect. Just exploring
options here.

NOTE: this one is more than removing ifdefs, please review carefully

Reviewed By: xavierd

Differential Revision: D44152041

fbshipit-source-id: 21affcc417dce492c2846902225686334eb2dc30
2023-03-29 12:52:44 -07:00
Katie Mancini
6ccae0c2f5 Get nfs_rpc building on Windows
Summary:
I'm getting nfs to build on windows to prototype it and see how feasible it
might be as an option on Windows. PrjFS has a very different model than EdenFS,
and that has made EdenFS correctness on Windows very difficult. NFS may be
easier to get correct, though the performance is suspect. Just exploring
options here.

Reviewed By: xavierd

Differential Revision: D44151904

fbshipit-source-id: c14fa313b2817c3d55f616f4252a0611965ead78
2023-03-29 12:52:44 -07:00
Katie Mancini
bdeeebcd24 get rpc building on Widnows
Summary:
I'm getting nfs to build on windows to prototype it and see how feasible it
might be as an option on Windows. PrjFS has a very different model than EdenFS,
and that has made EdenFS correctness on Windows very difficult. NFS may be
easier to get correct, though the performance is suspect. Just exploring
options here.

Reviewed By: xavierd

Differential Revision: D44151833

fbshipit-source-id: 5d39f9d3de527cd21506b8473555f9dbd2a587bb
2023-03-29 12:52:44 -07:00
Katie Mancini
444a19e5e9 get xdr building on Windows
Summary:
I'm getting nfs to build on windows to prototype it and see how feasible it
might be as an option on Windows. PrjFS has a very different model than EdenFS,
and that has made EdenFS correctness on Windows very difficult. NFS may be
easier to get correct, though the performance is suspect. Just exploring
options here.

Reviewed By: xavierd

Differential Revision: D44151636

fbshipit-source-id: 0f13b997064d96995f48b658ccf0ecac6477dad8
2023-03-29 12:52:44 -07:00
Katie Mancini
ce0287d81c get oss windows build back to functioning
Summary:
The external OSS build is broken because thrift has a really long path and
cargo/git on Windows do not lick such long paths.

I'm not fixing that. But the external OSS build is the only one we run in CI any
more. In the meantime the internal build has broken because no one has been
watching.

There were 4 different breakages.

Reviewed By: chadaustin

Differential Revision: D44189633

fbshipit-source-id: 2eedbc2b3bbf5d1def075d99f11f2273dbb1f4ab
2023-03-29 12:52:44 -07:00
generatedunixname89002005307016
1ef2474bf8 Add annotations to eden/scm/edenscm/clone.py
Reviewed By: sggutier

Differential Revision: D44498751

fbshipit-source-id: 0f83dbf845ab56028cc641e99df870130a2c320a
2023-03-29 12:37:31 -07:00
Katie Mancini
aedf3967a0 remove multiple unnessecary retries within hg importer fetches
Summary:
Currently a single eden fetch causes 13 attempts to fetch the data.

By default hg hs 3 configured retries for edenapi fetch operations.

In the direct rust fetching code we have disabled these retries because we
use the importer as a retry, so these are not worth it.

We should disable them in the importer too.

There are still many retries. The importer internally will attempt 2 retries
and eden retries the importer once when it fails. So there are at least 5
attempts to fetch data still.

Those other retries are perhaps ensuring correctness, so we need to be more
careful with them. But these should be safe to remove.

This is a 3x reduction in retry attempts.

Reviewed By: fanzeyi

Differential Revision: D44482325

fbshipit-source-id: 96a501c8e9421e5d8aef92b697a6ed5e19c69194
2023-03-29 11:35:29 -07:00
Katie Mancini
216294c531 enable all known tests blocked by asciitransform issue
Summary:
Fixing the asciitransform issue, unblocks a lot more tests.

This enables all the ones we know that were blocked by this.

Reviewed By: mshroyer

Differential Revision: D43966515

fbshipit-source-id: dfd988f81ec9b931f2d3bc6f34ad4ad82c2f2a61
2023-03-29 11:33:45 -07:00
Katie Mancini
3a1455aeaa enable restart tests
Summary:
These tests seem fine? Maybe someone already fixed them?

But even with stress runs I can't get them to fail. I'll try on my intel too
to make sure it's not that.

Reviewed By: genevievehelsel

Differential Revision: D43986058

fbshipit-source-id: 7e3702a7efbd4637efbb235e626b421e9a3d28a1
2023-03-29 11:33:45 -07:00
Katie Mancini
a80963b8b6 enable takeover tests on mac
Summary:
The takeover tests are failing in a couple ways.

First, there are failures:

multiprocessing seems to behave differently on mac than linux.
The process calls cause locking issues when "pickling". multiprocessing seems
kind un reliable, and we don't really need it in either of the used places.

Second. there are timeouts:
accessing an fd that was open before takeover seems to hang sometimes.
I can not manually repro on my M1, but don't have time to dig in right now, so
I will just leave a comment with some info on the issue and leave these disabled
for now.

Reviewed By: mshroyer

Differential Revision: D44000288

fbshipit-source-id: 76ef085967a495ffd3ab0a8aae337960368d75e0
2023-03-29 11:33:45 -07:00
Michael Cuevas
08f5547ea1 Windows: fix warnings in daemon code
Summary:
Building EdenFS with `-Werror` option reveals a number of errors:
* shadow
* unused parameters
* sign-compare

This diff fixes unused param warnings and sign comparison issues. For now, we'll ignore the shadowing error since it's in folly/portability and would be quite tough to fix.

Reviewed By: fanzeyi

Differential Revision: D44440807

fbshipit-source-id: 9d061e6cd7689cca65433ffa2f0fa738fa0aee00
2023-03-29 11:13:25 -07:00
generatedunixname89002005325677
d73aed440b Daily arc lint --take RUSTFMT
Differential Revision: D44494810

fbshipit-source-id: 3a4c5c76d0e8c498315337415896f48a9f229ceb
2023-03-29 09:19:36 -07:00
Zhaolong Zhu
c4aedd48c5 copytrace: add debugcopytrace command
Summary:
Add a way to debug copytrace binding, this can be used in .t test for
testing copytrace binding as well

Reviewed By: quark-zju

Differential Revision: D44449566

fbshipit-source-id: 1b5cc6bbf747edd449fb6e98c1bdba9527515353
2023-03-29 08:17:11 -07:00
generatedunixname89002005307016
6af7a9a5e3 upgrade pyre version in fbcode/eden - batch 1
Differential Revision: D44490624

fbshipit-source-id: 7708232daa5e0c905a330f2fe0176fc1f7dd7bc0
2023-03-28 23:22:23 -07:00
Saul Gutierrez
c2cf6460ff debugruntest: allow nested ifs
Summary:
Allows nesting `#ifs` macros on debugruntest.

This can be useful if we have something like

```
#if no-windows
...
#if fsmonitor
...
#endif
...
#endif
```

Reviewed By: quark-zju, zzl0

Differential Revision: D44447876

fbshipit-source-id: 0f5a136cbed7f235a53b619a5bb3b593ffff7d8c
2023-03-28 19:02:07 -07:00
Saul Gutierrez
e92be900f8 symlinks: make eagerepo aware of Windows symlink option
Summary: Recently we added the `experimental.windows-symlinks` config to make repos initialized with that config add `windowssymlinks` to the working copy requirements. That, however, didn't apply to the `eagerrepo`. This meant that tests initializing repos using eagerrepo would not have this behavior, which made writing `.t` tests expecting that in the requirements somewhat awkward.

Reviewed By: quark-zju

Differential Revision: D44444534

fbshipit-source-id: def5c30267aa91bf6d2a72514644538285f80b8b
2023-03-28 19:02:07 -07:00
Saul Gutierrez
1a6ec2a008 eagerepo: make eagerrepo aware of configs when creating a repo
Summary: It could be useful to make `eagerrepo` to take in a config option so that it could set in certain values on the working repo or in the backing store requirements. For instance, we might want to make `eagerrepo` able to set Windows symlinks.

Reviewed By: quark-zju

Differential Revision: D44465174

fbshipit-source-id: 122f2428dcaa2e866fa7d7774e12dee2b3fe5eee
2023-03-28 19:02:07 -07:00
Chad Austin
1d1afbb13c remove check_macfuse
Summary:
We've largely migrated everyone off of macFUSE. Now we can remove the
doctor check.

Reviewed By: fanzeyi

Differential Revision: D44479361

fbshipit-source-id: 6332c5d47a043797ce7e6b823f6c81e0f6ae33a7
2023-03-28 17:41:09 -07:00
Chad Austin
b3a5d787d1 remove flaky assertions from EdenConfigTest
Summary: These tests fail on my laptop because they search the actual filesystem for certs.

Reviewed By: genevievehelsel

Differential Revision: D44478611

fbshipit-source-id: 2d53fc642f7d5fbda2f82d493e20b67c1dd32513
2023-03-28 17:40:20 -07:00
Muir Manders
c0e88ce6a2 graphql: fix graphql queries from prod
Summary:
I accidentally referenced a non-existent "edenscm.httpclient.HTTPSConnection" when switching http libraries in the graphql client. Tweak code to work with the new library.

I also killed the ca_bundle arg since it was never actually passed from graphql.py into anything.

Reviewed By: sggutier

Differential Revision: D44478636

fbshipit-source-id: 50e78ab52f1db98fcb6b14f0fc1cac9ea6662abf
2023-03-28 16:47:55 -07:00
Max 👨🏽‍💻 Coplan
5656ac6a08 chg: don't crash when user has more than 16 groups on macOS (#573)
Summary:
🐛(chg): don't crash when user has more than 16 groups on macOS
D43676809 (OSS: 49ee17f2bf) introduced a check for whether the chg server and
sl process have different permissions.  We run `getgroups` in two different
places:
1. using `os.getgroups` in sl client in Python
2. using libc's `unistd/getgroups` in chg server in C

Essentially the way this works is we call `os.getgroups` in the client (Python)
and `unistd/getgroups` on the chg server (C).  Then, the server compares the
results.  If they're the same, then both processes have the same permissions,
otherwise they might be different.

However, `getgroups` on macOS has a key limitation that it will only return a
max of `NGROUPS_MAX` groups (16 groups on my machine, defined in
`sys/param.h`).  You can remove this limit by defining
`_DARWIN_UNLIMITED_GETGROUPS` or `_DARWIN_C_SOURCE`[^1].

`os.getgroups` in Python is compiled with `_DARWIN_C_SOURCE`[^2] but chg does
not, meaning that the result of `getgroups` is different in our Python and C
code.

This commit defines `_DARWIN_UNLIMITED_GETGROUPS` for chg so `getgroups` will
have consistent behavior. (the alternative is patching CPython to unset
`_DARWIN_C_SOURCE` which is worse)

Special thanks to strager for helping me debug this 👍🏻

Pull Request resolved: https://github.com/facebook/sapling/pull/573

Test Plan:
1. have user with <=16 groups
2. run `sl --version`
3. confirm it works

4. have user with >16 groups
5. run `sl --version`
6. notice sl failing with error "chg: abort: too many redirections."

7. apply this patch
8. repeat steps 4-5
9. confirm it works

[^1]: https://opensource.apple.com/source/xnu/xnu-3247.1.106/bsd/man/man2/getgroups.2.auto.html
[^2]: 28d369e070/configure.ac (L267)

Reviewed By: sggutier

Differential Revision: D44378466

Pulled By: quark-zju

fbshipit-source-id: 402aa56bcacd2d6d2af9bed66e2c3be13738c435

Co-authored-by: strager <Strager.nds@gmail.com>
2023-03-28 16:29:42 -07:00
Zhaolong Zhu
dd514e6692 copytrace: make read_renamed_metadata API async
Summary:
Our current practice is only using `block_on` in Python bindings, so this diff is to change the `read_rename_metadata` to an Async function and also remove the `block_on`s in its implementations, so it is consistent with other APIs.

In the longterm, we'd like to remove those Async APIs, but we will to use a lib to help us migrate them in an automatic way, consistent APIs will make the migration process eaiser.

Reviewed By: quark-zju

Differential Revision: D44199939

fbshipit-source-id: a75d1356e373f3d883da4ab972520a665587eb23
2023-03-28 13:28:54 -07:00
Zhaolong Zhu
a6daf1870c pycopytrace: add python binding for copytrace
Summary: Python binding for copytrace, so it can be used in Python world

Reviewed By: quark-zju

Differential Revision: D44152527

fbshipit-source-id: 233986efddb855188ce9ada6cace70a57f834b9c
2023-03-28 13:28:54 -07:00
Zhaolong Zhu
b957d86e58 pydag: add ImplInto support for getting DagAlgorithm from dagalgo
Summary: make `cl.dag` able to be used as a `dagalgo` -> `DagAlgorithm` converter, this will be used by pycopytrace.

Reviewed By: quark-zju

Differential Revision: D44152513

fbshipit-source-id: 1e211063160509587fe807789716f23787e2705e
2023-03-28 13:28:54 -07:00
Zhaolong Zhu
d9a17dd507 copytrace: update DagCopyTrace::new
Summary: Fill the missing part of DagCopyTrace::new

Reviewed By: quark-zju

Differential Revision: D44110425

fbshipit-source-id: 32f9cfc949a56eb60d5589258ae6da87ea26cb5a
2023-03-28 13:28:54 -07:00
Zhaolong Zhu
f151ced705 copytrace: implement trace_rename API
Summary: trace_rename API will do forward search, backward search, or both based on the relationship of src and dst commits

Reviewed By: quark-zju

Differential Revision: D44106975

fbshipit-source-id: 69dc8c16cea32f060b94dd6306a346a2a953e0a4
2023-03-28 13:28:54 -07:00
Zhaolong Zhu
161fe3b48a copytrace: implement trace_rename_forward API
Summary:
This will be used for searching renames from `base` to `dst` commits

```
dst
 |
 | src
 | /
base
```

Reviewed By: quark-zju

Differential Revision: D44094783

fbshipit-source-id: 5943b5aa6bc9b1a22b75738749d934887475dd5e
2023-03-28 13:28:54 -07:00
Zhaolong Zhu
dc27514f4e copytrace: abstract reusable functions from trace_rename_backward
Summary:
refacotr the trace_rename_backward API, so that we can reuse the
common parts in trace_rename_forward API in the following diff

Reviewed By: quark-zju

Differential Revision: D44448494

fbshipit-source-id: 997a338c5f2e9e52d1d7bb3d54641980d9119797
2023-03-28 13:28:54 -07:00
Zhaolong Zhu
95e0240416 copytrace: implement trace_rename_backward API
Summary: This diff implements `trace_rename_backward` API

Reviewed By: quark-zju

Differential Revision: D44082134

fbshipit-source-id: e4df6256eba6993571284e5876efbf2ad6d7a26b
2023-03-28 13:28:54 -07:00
Steven Luscher
fad2239212 Update githelp to advise when sl clean --dirs is necessary (#575)
Summary:
Whenever there's a path or the `-d` flag, `git clean` implies that cleaning should be done recursively, into directories, removing empty ones as it goes.

The equivalent in Sapling is `sl clean --dirs`.

Closes https://github.com/facebook/sapling/issues/564.

Pull Request resolved: https://github.com/facebook/sapling/pull/575

Test Plan: .t test

Reviewed By: quark-zju

Differential Revision: D44350217

Pulled By: zzl0

fbshipit-source-id: 72bef3d23c5d92ffbd275b4e57bf218f570ca71f
2023-03-28 12:47:24 -07:00
generatedunixname89002005307016
1293d3bac3 Add annotations to eden/scm/edenscm/ext/infinitepush/infinitepushcommands.py
Reviewed By: quark-zju

Differential Revision: D44458348

fbshipit-source-id: 709be54ed9160fc9990ce6778da49667aa18a018
2023-03-28 12:43:10 -07:00
Jun Wu
e84a78abe5 nodeipc: notify ISL about commit rewrites
Summary:
`scmutil.cleanupnode` is the "common" code path for commit rewrites (except for
"split"). Update it to notify ISL about the commit rewrite source and
destination.

Reviewed By: muirdm

Differential Revision: D44439674

fbshipit-source-id: 9e8bb7b12aba31619d0a843fdf9939682afe3e53
2023-03-28 09:22:28 -07:00
Jun Wu
dd2fc39ce7 nodeipc: initialize IPC before spawning threads
Summary:
The NodeIpc initialization logic might remove environment variables, which
might be unsafe for multi-thread process. Therefore let's explicitly initialize
it before spawning threads.

Reviewed By: muirdm

Differential Revision: D44439675

fbshipit-source-id: c0363e272f56632047d2eab035492f503a0315ef
2023-03-28 09:22:28 -07:00
Jun Wu
b3f0b4d6de pynodeipc: bindings to nodeipc
Summary:
See the previous diff for context. This diff adds Python bindings for the node
IPC feature. Right now only the singleton's send and recv features are exposed
driven by use-case.

Reviewed By: muirdm

Differential Revision: D44435527

fbshipit-source-id: 6343a3ecf633f7f1a12aca85eaf973ae86a1be10
2023-03-28 09:22:28 -07:00
Jun Wu
6afe2e6732 nodeipc: utility to communicate with nodejs via a side channel
Summary:
We want a way to report information (like what commits are changed to what
other commits) to ISL. This diff adds a way to communicate JSON values with
nodejs parent process using the `'ipc'` feature defined in nodejs stdlib.

This way, we can communicate using structured data instead of plain text, and
preserve the existing stdout/stderr (comparing to other solutions like
`rebase|metaedit -q -T '{nodechanges|json}'`).

Reviewed By: muirdm

Differential Revision: D44435528

fbshipit-source-id: e804a25a25dfff31c25b13b16f9bc86ab4e8306f
2023-03-28 09:22:28 -07:00
Mark Juggurnauth-Thomas
6b5bb09b71 sql_commit_graph_storage: implement prefetching of changeset edges
Summary:
Implement prefetching of commit graph edges via recursive common table expressions.

Prefetching can be performed either by the first parent edge, or by the skip tree skew ancestor edge.  We can add more edges later on, however the nature of the `mononoke_queries!` macro means each one needs its own, only slightly customized, version of the SQL query that performs the operation.

Reviewed By: liubov-dmitrieva

Differential Revision: D43455724

fbshipit-source-id: 75f19533f1f4e9d118a098469bbe3f8afb5f7f92
2023-03-28 05:25:45 -07:00
Mateusz Kwapich
1f3635f8a2 disallow deleting files in native pushes
Summary:
The `native_push_only_deny_patterns` contains the list of paths that should be
changed only via pushrebase operations.

I think the `native_push_only_deny_patterns` should be moved into its own hook
but let's start from fixing current behaviour and refactor later.

Reviewed By: liubov-dmitrieva

Differential Revision: D44433734

fbshipit-source-id: 2da93e84763cdfb7ee997cb148d4eac288fba27f
2023-03-28 05:05:33 -07:00
Muir Manders
afe4cd2290 smartset: fix commit text prefetching for repo scans
Summary:
Use nameset instead of idset to underly the fullreposet. The idset does not prefetch nodes, so there was a serial location_to_hash call for each "repo[rev]" context lookup. The nameset prefetches nodes under the hood, so "repo[rev]" is fast and the next layer of commit text prefetching fills up its 10k batch quickly.

Note that anything hitting this code will still be extremely slow since it scans all commits in the repo.

Reviewed By: zzl0

Differential Revision: D44438396

fbshipit-source-id: e1275a7a45f54cae1978820eb36d99a212fc4236
2023-03-27 19:12:15 -07:00
Muir Manders
5b042fa73f tests: fix test-status-ignored.t
Summary: There was the classic same second race condition that left files NEED_CHECK after commit, and the tracing message had changed.

Reviewed By: quark-zju

Differential Revision: D44442614

fbshipit-source-id: 97486163301045825922f9b68ec00ff12e5432a7
2023-03-27 19:03:49 -07:00
Muir Manders
26dafdfc70 status: fix dir-becomes-symlink detection (watchman)
Summary:
Use the "exists" field from watchman to detect when a file has been moved behind a symlink. Watchman reports it properly as not-exists, but if we naively vfs.metadata(path), it may appear to be unchanged.

I added another layer of Option<> to the file metadata so watchman fs can explicitly say "this file doesn't exist", as opposed to only "I don't have metadata".

The alternative approach is to "audit" paths before we lstat them, but that is slow and we want to avoid if possible.

Reviewed By: quark-zju

Differential Revision: D44187187

fbshipit-source-id: e24a43cbdb36d9aabf2b0b7ae0c4d2eab66394c4
2023-03-27 19:03:49 -07:00
Muir Manders
ee6e258244 status: use watchman metadata to avoid lstat() calls
Summary: Now the Rust status requests file mode, size and mtime from watchman and uses them for file comparison in lieu of lstatting the files. This way, if nothing has changed (think fresh instance), or if file size has changed, we don't need to hit the disk at all!

Reviewed By: quark-zju

Differential Revision: D44033614

fbshipit-source-id: 54cd8bd6dddd7fb88e9538d72174ae88b2118550
2023-03-27 19:03:49 -07:00
Muir Manders
d81ff485ca status: add failing test for watchman optimization
Summary: Add a test showing we fetch file metadata after watchmant tells us a file changed. I'm going to optimize this away buy querying and using watchman's file metadata.

Reviewed By: quark-zju

Differential Revision: D44033616

fbshipit-source-id: 8b098a5868e20283d2fc98b198c70c4b086b9657
2023-03-27 19:03:49 -07:00
Muir Manders
cd760409ef workingcopy: add a file metadata abstraction
Summary: Add a Metadata type to abstract across the various places we get file metadata from. This doesn't buy us much right now, but will allow us to easily inject file metadata from Watchman into our file comparison logic.

Reviewed By: quark-zju

Differential Revision: D44033617

fbshipit-source-id: ed08e44df9ff44bb23e8fff031d431c4a519eaa4
2023-03-27 19:03:49 -07:00
Muir Manders
9166243220 chg: fix some compilation warnings on Mac
Summary: Use some #pragmas to ignore unreachable code warnings because sigemptyset on Mac can't return -1.

Reviewed By: quark-zju

Differential Revision: D44344187

fbshipit-source-id: bf650d20c38c950899aec3d8e7f91d18db4c031d
2023-03-27 13:34:31 -07:00
Muir Manders
0604dc8936 workingcopy: move HgModifiedTime to a new module
Summary: Going to be adding more "metadata" related stuff that depends on HgModifiedTime, so move this type first.

Reviewed By: quark-zju

Differential Revision: D44033613

fbshipit-source-id: 30c6173fc069fbb7553d6d9fffaea0fc774cb72f
2023-03-27 11:54:35 -07:00
Muir Manders
6ff1694cd5 status: add progress bar when updating treestate
Summary: This can take a few seconds if there are a ton of files (e.g. watchman fresh instance).

Reviewed By: quark-zju

Differential Revision: D44033611

fbshipit-source-id: 8e033eef68e2f4560b859d35f78da139f86abc97
2023-03-27 11:54:35 -07:00
Muir Manders
02dbee5d8d status: fix "comparing files" progress bar
Summary:
When using watchman, we show a progress bar as we compare the contents of files. Due to how the file detector works, this progress bar was staying at zero and suddenly jumping to the end. Fix by moving the progress bar into the ParallelDetector. I had to add a stupid method to the detector trait to set the total number of files.

I don't think the FileDetectorTrait is quite right. Ideally the user of the detector would own the progress bar. It would set "total" based on the work it has, and increment "position" as it receives results. However, currently you can't receive results until you have finished publishing work. We should tweak things to make this possible.

Reviewed By: quark-zju

Differential Revision: D44033612

fbshipit-source-id: a22b237eaf98f3bd55f5f79eccc3fe42e733a297
2023-03-27 11:54:35 -07:00
Muir Manders
9f970c188b status: show watchman crawl progress bar in rust
Summary:
While we are waiting for watchman to crawl the repo, call "debug-root-status" and pipe the file count into a progress bar.

The similar Python logic renders the "crawling" progress bar until the crawl is done and then proceeds with the query. In Rust I made it render the progress bar concurrently with the query. This should show the progress bar even if the repo has never been watched before (i.e. when there is no crawl until the query happens).

Reviewed By: quark-zju

Differential Revision: D44033615

fbshipit-source-id: 3c97fa7a63cd090b5ace82d7385f887e564eb9cf
2023-03-27 11:54:35 -07:00
Muir Manders
3f2ac5a8e1 workingcopy: skip root dir of nested repos in MultiWalker
Summary: The parallelized MutliWalker was skipping nested repo dot dirs (e.g. ".sl"), but wansn't skipping sibling files to the dot dir.

Reviewed By: quark-zju

Differential Revision: D43970586

fbshipit-source-id: 0cfd703a067f7db2087a6e692316eab192330b54
2023-03-27 11:54:35 -07:00
Muir Manders
83bb7745ef status: fix dir-becomes-symlink detection (non-watchman)
Summary:
Fix detection of a directory being replaced by a symlink. When the walker iterates tracked files not seen during the walk it now directly emits "deleted" events instead of going through the file detector. If tracked files had the same size and mtime "through" the symlink, the file detector's lstat() call would make it seem like there were no changes.

The alternative approach is to "audit" paths before we lstat them, but that is slow and we want to avoid if possible.

Reviewed By: quark-zju

Differential Revision: D44187186

fbshipit-source-id: 5678d6027b74283608bd0430e7acd3ae16cfb046
2023-03-27 11:54:35 -07:00
Muir Manders
f6c20c146d status: surface "invalid file type" errors
Summary: Show a warning about fifo etc. files instead of aborting the command.

Reviewed By: quark-zju

Differential Revision: D44187185

fbshipit-source-id: c4c01436ad21e4e15fcae9c5d04f1aaacc7e5c80
2023-03-27 11:54:35 -07:00
Muir Manders
744090a4f7 status: fix symlink dirty check
Summary:
The manifest stores a file as executable or symlink (mutually exclusive). A symlink on disk also has the executable bit(s) set, so the fs metadata (and by extension the mode in the dirstate) appears to be both symlink and executable. This is a recipe for confusion.

In Python it seems to work because the dirstate mode and fs mode both store the execute bit for symlinks, so they match when compared for executableness. (Although I wouldn't be surprised if they could get out of sync somehow.) The symlinkness check is achieved through the "flags" which does not include "x" if the file is "l".

Fix in Rust be applying the flags logic to the dirstate and fs metadata as well. In other words, if a file is a symlink, don't report it as executable. This makes the manifest file mode compare naturally with the dirstate and filesystem.

Reviewed By: quark-zju

Differential Revision: D43970590

fbshipit-source-id: b459e466dace5ee1c9cc7505d3c780be6ecd4685
2023-03-27 11:54:35 -07:00
Jun Wu
f1697c5aea debugstack: add the ability to export wdir()
Summary:
Supporting exporting the wdir() virtual commit could make it easier for ISL to
obtain file contents for interactive commit or amend.

Before this change it will error out in the Rust dag layer, since the Rust dag
layer does not know about the special wdir commit (yet). This diff works around
it by adding some special logic about it. Note in the long term we would like
to add the virtual commits directly to the Rust dag logic so they can be
calculated without special casing.

Reviewed By: evangrayk

Differential Revision: D44231011

fbshipit-source-id: 27fce76afd2399502b30e15cca6c8f8986e1bc34
2023-03-27 10:39:27 -07:00
Jun Wu
aeed9b3e47 debugstack: "foo_bar" -> "fooBar"
Summary: "fooBar" matches the Javascript style more closely.

Reviewed By: evangrayk

Differential Revision: D44231009

fbshipit-source-id: 9fcad73a8454044d573472f446e0d7ff7cb90d88
2023-03-27 10:39:27 -07:00
Jun Wu
3377f02823 debugimportstack: command to import a stack
Summary:
This is the reversed direction of `debugexportstack`, to create commits from
automation. It also supports `goto` and `reset` to support partial commit
(commit, reset), absorb (commit*, reset), amend (commit*, goto) cases.

Reviewed By: muirdm

Differential Revision: D44231010

fbshipit-source-id: 03d2e5a7d577a2c6becb5e7d9f162fea191ad9af
2023-03-27 10:39:27 -07:00
Jun Wu
d65ce0c0c9 test-debugexportstack: add coverage test
Summary: Check that the test cases actually cover various logic in debugexportstack.

Reviewed By: zzl0

Differential Revision: D44231012

fbshipit-source-id: dbb24c7f87ecd11d23aae1707b68f77486177ef7
2023-03-27 10:39:27 -07:00
Jun Wu
97d4cc1d2e testing: add assertCovered for testing Python function coverage
Summary:
This makes it easier to verify that a complex Python function is fully
exercised.

Reviewed By: zzl0

Differential Revision: D44231013

fbshipit-source-id: 6269dae56acff4f29a6aa5b7ad0ab89c33601ee1
2023-03-27 10:39:27 -07:00
Zhaolong Zhu
23277a24c2 edenapi: add debug info for edenapi configs
Summary: Add debug info for edenapi configs to verify if it load the static_system configs correctly

Reviewed By: quark-zju

Differential Revision: D44298145

fbshipit-source-id: 96efb86c4e96a945b7329ae1e9cba3fdf57a5128
2023-03-27 10:20:51 -07:00
Ilia Medianikov
e9f9002dda scs/land_stack: log small repo commits to mononoke_new_commit category
Summary:
During cross-repo pushrebases, we need to log new commits both in large and small repos. But currently, due to the code organization, it is not too hard to forget logging in the small repo. Which is what happened in case of SCS land_stack method.

This land path was not covered, and only large repo commits were logged. For example, this led to most public opsfiles commits being missing from the category (sync to opsfiles_backup uses different code path and exposes the discrepancy):
{F912075962}
(https://fburl.com/scuba/mononoke_new_commit/8q0nbq8i)

Reviewed By: markbt

Differential Revision: D44187074

fbshipit-source-id: bba2bf112fc9326ae5fc177d421ec936a2bb5322
2023-03-27 09:28:24 -07:00
Mark Juggurnauth-Thomas
8aced3e694 cmdlib: move tokio runtime out of environment
Summary:
The environment is passed into the async runtime via an `Arc`.  If the last reference to the environment is dropped from within the runtime, then we end up destroying the runtime from within the runtime, which is an error.

Move the runtime out of the environment, and store it in the `MononokeApp` (new) or on the stack in `main` (old).  This means the runtime will live on the stack outside of the async runtime, and so execution of all async code should be complete when they are dropped.

Reviewed By: YousefSalama

Differential Revision: D44299775

fbshipit-source-id: 9a93ba49a8bbf376defdd0b5ddb1d6546b5ff12b
2023-03-27 07:13:45 -07:00
Liubov Dmitrieva
881cbac1ff rename "edenapi_replay_unsampled_duration_threshold_ms" to
Summary: rename to match edenapi_req_dumper_sample_ratio

Reviewed By: markbt

Differential Revision: D44416302

fbshipit-source-id: a7693c5e6d02e2c802b7da9702eb7ac2cad00c42
2023-03-27 06:59:37 -07:00
Liubov Dmitrieva
e09402f047 improve proxygen health check to take into account requests load
Summary:
Improve proxygen health check to take into account requests load. Configurable with a tunable.

Let's separate two completely different health checks because otherwise it is very confusing, and now we can configure them differently.

One is used for tupperware **/health**, and I created another one for monitoring VIP health  **/proxygen/health_check**.

**Background:**

During the overloads, we can see request load is very high (number of concurrently running requests), this is a good signal to see that a server is overloaded. So let's set up a limit like **20K requests** load and fail health check for a while until load decreases, so traffic can be automatically diverted to other tasks.

https://fburl.com/scuba/mononoke_test_perf/my8rnt9n

In a normal situation load is never higher 10K, see MAX metric

https://fburl.com/scuba/mononoke_test_perf/aqdf7pwm

Threshold can be configured via a tunable

**Current set up:**

At the moment we use nginx health check (default)

It’s configured to have health check every 10000ms https://www.internalfb.com/code/configerator/raw_configs/ti/teams/server_health/traffic_proxygen.nginx.json

**Current Alerts:**

The VIP health is based on the health check of the backend and the VIP has an alert will escalate to our oncall if some become unhealthy

https://www.internalfb.com/code/configerator/[master]/raw_configs/ti/alerts/vip-alerts/scm-mononoke-intern.detector

https://www.internalfb.com/code/configerator/[master]/raw_configs/ti/alerts/vip-alerts/scm-mononoke-intern_fail_open.detector

It will fire a major alert at **65%** capacity and then a ubn at **50%** capacity, this is per **DC**.

The alert is specific for us, we can reconfigure if we need

**New health check**

We can configure a custom health check using this editor:

https://www.internalfb.com/intern/traffic/editor?backend_workspace[0]=source_control_services.scm_mononoke&backend=source_control_services.scm_mononoke

We can create a new one like https://www.internalfb.com/intern/traffic/editor?backend_workspace[0]=source_control_services.scm_mononoke&health_check_workspace[0]=source_control.scm_mononoke_healthcheck&health_check=source_control.scm_mononoke_healthcheck

**New monitoring**

We can reconsider if **65% capacity and then a ubn at 50% capacity per DC** is what we need.

**TW health check has a different purpose**

TW will kill a task if health check fails for a configured period of time. For out tasks restarts are expensive.

https://www.internalfb.com/intern/wiki/Tupperware/Monitoring/Service_Health/#task-lifecycle-and-healt.

Reviewed By: clara-9

Differential Revision: D44369243

fbshipit-source-id: 3a2a1a1f83f1b17217e44026d19eb7c317859f7d
2023-03-27 06:44:07 -07:00
Zhaolong Zhu
1c92d0d72a debugcrdump: fix the issue of multiple downstream bookmarks
Summary:
Curently, `debugcrdump` returns an empty string for `branch` if there are multiple downstream remote bookmarks. This diff returns the first bookmark as the best guess, which should be the bookmark (commit) that the current local commit is based on.

Caveat: for multiple downstream bookmarks, it's a best effort guess, the algorithm is like:
1. For a given commit, find the first public ancestor.
2. For that ancestor commit, find all descendant commits that have remote
bookmarks sorted in ascending order.
3. If the descendant remote bookmarks contain "master", return that.
4. Otherwise report the first remote bookmark as the current branch. For draft commit,
this should be (best guess) the remote bookmark on which the draft commit was based
if user didn't run pull from remote server.

For example, if your commit graph looks like this, it will return `bookmark1` (first one) as the branch name, this is probably what you are expecting.

```
Y: public bookmark2
|
| a: draft (your local commit)
|/
X: public bookmark1
```

But if you run a `hg pull`, then the graph might look like below, it's impossible to know for certain which remote bookmark the local commit was made against. For now we also pick `bookmark1` as a guess.

```
Z: public bookmark2
|
|
Y: public bookmark1
|
| a: draft (your local commit)
|/
X: public
```

Related diff: D17814487, this was the diff that first added `branch` field.

Reviewed By: sggutier

Differential Revision: D44355664

fbshipit-source-id: b5287578d82c756f2d7035ae5ffa9a542ab957a0
2023-03-27 06:42:32 -07:00
Zhaolong Zhu
f3dfb881ca debugcrdump: add test-crdump-branch.t
Summary: this is for reproducing the issue of T148764976

Reviewed By: sggutier

Differential Revision: D44360807

fbshipit-source-id: 14400f9abc3ef6ca8e72d1c4a1f20b6ada6361fa
2023-03-27 06:42:32 -07:00
Liubov Dmitrieva
d401d3b747 improve README
Summary: improve README

Reviewed By: YousefSalama

Differential Revision: D44416831

fbshipit-source-id: 783fd3515e7b8ddcb344d5595a0a0ac90e04a865
2023-03-27 06:30:06 -07:00
Pierre Chevalier
7ff2ceffb5 Unflake segmented changelog test
Summary:
This test has been flaky practically since its creation, although below the threshold to be detected as such some of the times.
Looking at its journal, it failed its first stress run and more than half
of the stress runs thereafter (failed 1920 of them, passed 1519 of them).

The assumption that the test makes that we will always take the local path first
is not stable and has never been.

Match the test's expectations to the actual behaviour of mononoke for now.

If the behaviour is problematic, let's tackle it in its own time.

Note that this test was written here D34276252 in reaction to a change to
segmented changelog here D34041066 and the discussion on that diff is relevant
to establish the correctness of the code.

Reviewed By: RajivTS

Differential Revision: D44297278

fbshipit-source-id: 07f42fc11ca0aa637b59b5fc46263b65d624e0a4
2023-03-27 05:11:34 -07:00
Egor Tkachenko
bdd11d99e8 Add logging when service requests remote derivation
Summary: After enabling remote derivation we've lost related to derivation logging in the parent scuba table (like SCS server). This diffs add log tags, which indicates when we requested remoted derivation and when it was finished. In case of the error we already had the logging in place.

Reviewed By: Croohand

Differential Revision: D44297304

fbshipit-source-id: 1e2f6e279e111ce01b2feaf950a11c7b69a314cf
2023-03-27 01:36:08 -07:00
Genevieve (Genna) Helsel
98208bd49c scmstore: add --local flag to debugscmstore
Summary: useful for checking if an object is in the hgcache or not

Reviewed By: quark-zju

Differential Revision: D44316641

fbshipit-source-id: f16093ec1659a8f139b88e702dbd1d8646319c8a
2023-03-25 16:19:06 -07:00
Michael Cuevas
607c148bc6 integration: remove unused import in update_test
Summary: title

Reviewed By: xavierd

Differential Revision: D44349843

fbshipit-source-id: 21e3ff2c32e63d8885b9bbe3222fefb235708550
2023-03-24 21:21:47 -07:00
Michael Cuevas
d5286fd21a integration: move _open_locked to utils module
Summary: In the next diff, we'll use this util function to acquire an exclusive handle to a file for a prjfs integration test.

Reviewed By: xavierd

Differential Revision: D44349708

fbshipit-source-id: ded7037266f539c681569f0c90f875717760fed5
2023-03-24 21:21:47 -07:00
Michael Cuevas
96622ff4bd PrjFS: add LogEvent for fileNotification failures
Summary: We are running into fileNotification() failures way more often than we expect on Sandcastle (5% of certain jobs are failing). Let's add some logging here to see if the failures are also happening to users.

Reviewed By: xavierd

Differential Revision: D44350819

fbshipit-source-id: 3be7578dccc297071280f528b53270a63994a99d
2023-03-24 21:21:47 -07:00
Chad Austin
e419dd2799 remove the reference-counting overhead from DurationScope
Summary:
DurationScope has a pair of atomic reference count operations at the
beginning and end of every recorded duration. To avoid that overhead,
reference EdenStats with RefPtr and, in production EdenFS, store a
global, unowned EdenStats object.

This gives us the benefits of explicit dependencies and no global
state in tests, while avoiding atomic RMWs in the release build.

Reviewed By: xavierd

Differential Revision: D44323723

fbshipit-source-id: 1b3384d2e6a0a2959fd79774a8ba46afc4c176ca
2023-03-24 13:50:40 -07:00
Pierre Chevalier
7ef796bc1c Derive Default on Enums
Summary:
In Rust 1.68.0, the `derivable_impls` clippy lint [got smarter](https://github.com/rust-lang/rust-clippy/pull/10161).
Fix all instances of that lint in Mononoke, mute one that's impractical to address.

Reviewed By: markbt

Differential Revision: D44378068

fbshipit-source-id: 473a051a7001d9596db43f47b56cbad5f5db7efe
2023-03-24 13:41:24 -07:00
Pierre Chevalier
c0a82f23bd Remove useless into_iter() calls
Summary:
In Rust 1.68.0, the `useless_conversion` clippy lint [got smarter](https://github.com/rust-lang/rust-clippy/pull/10020).
Fix all instances of that lint in Mononoke.

Reviewed By: markbt

Differential Revision: D44378069

fbshipit-source-id: acfd6c77c6a400830c378b4040661323e7232441
2023-03-24 13:41:24 -07:00
Michael Cuevas
5ec5c7d563 Back out "edenfsctl: log stderr from Python commands"
Summary:
Original commit changeset: 8c2f66457761

Original Phabricator Diff: D44111246

This seems to be causing stdout ordering issues too, possibly because of PYTHONUNBUFFERED environment variable

Reviewed By: fanzeyi

Differential Revision: D44356269

fbshipit-source-id: 707495d785987308d9c4617a582ccb8613ed5016
2023-03-24 13:08:53 -07:00
Mark Juggurnauth-Thomas
7adc50cf69 edenapi: monitor long-running requests
Summary: If an EdenAPI request is taking too long, we currently have no signal into this until it either completes or is cancelled.  As for wireproto, add logs for long-running requests.

Reviewed By: liubov-dmitrieva

Differential Revision: D44340299

fbshipit-source-id: e24bed96505964c519ea85748207670ded3baacb
2023-03-24 11:05:45 -07:00
Mark Juggurnauth-Thomas
917e1865f3 edenapi: add tunable limit for large tree metadata
Reviewed By: mitrandir77

Differential Revision: D44334056

fbshipit-source-id: b5c79c767876caba4720191b97180eaea202c78e
2023-03-24 11:05:45 -07:00
Mark Juggurnauth-Thomas
e78f4fba36 stats: log streams stats when streams are cancelled
Summary:
When streams are cancelled we lose all of their stats, as they only get logged after the stream is polled to completion.

Make the stream stats callback synchronous (we don't actually use its async nature), which means we can call it from a `Drop` implementation, allowing us to log the stats even when the stream is not completed.

To distinguish the two cases, we add a "completed" flag, which is true if the stream was polled to completion.

This also makes `completion_time` optional, as we don't have a value for this if the stream was never polled at all when it got dropped.

`TimedStream` had an implicit fuse-like nature (once completed the stream would never yield anything again), which we rely upon, so make sure this property is maintained.

Reviewed By: liubov-dmitrieva

Differential Revision: D44331959

fbshipit-source-id: 5a7d9875a4d7fd4276c304b6c30ff45c6b990b38
2023-03-24 11:05:45 -07:00
Mark Juggurnauth-Thomas
efddf499d1 virtually_sharded_blobstore: ensure future is removed even if cancelled
Summary:
As Croohand pointed out on D44183928, if the shared future is cancelled, the `WeakShared` will linger in the collection until the next read of that key.  If the read of that key never comes, it will never be cleaned up.

Switch to a scopeguard, that we move into the future.  This will execute the code to remove the shared future whether the future succeeds, fails, or is dropped.

Reviewed By: Croohand

Differential Revision: D44342772

fbshipit-source-id: 37fb15d126d8289d61ab33f64f6e1cf9f7a8550d
2023-03-24 10:02:48 -07:00
generatedunixname89002005307016
4f0cd7b2d2 Add annotations to eden/scm/edenscm/ext/github/pr_marker.py
Reviewed By: zzl0

Differential Revision: D44367495

fbshipit-source-id: 8b33e503317b478e151aa252aec8b91a40bf0f9c
2023-03-24 09:52:19 -07:00
Ilia Medianikov
6ae2f500f4 mononoke/scribe_logging: override WhenceScribeLogged to always log to prod instead of default
Summary:
In production we use Logger to log to Scribe (e.g. to "mononoke_new_commit" category). It has WhenceScribeLogged enum field which can be "default", "prod", "sandbox", etc.

Without override, Logger sets "default" value that usually resolves to "prod", **but** it resolves to "sandbox" if code is run from devserver. "sandbox" means we log data to "/sandbox" category instead of usual place.

This is confusing/harmful for us since we only configure to use Logger while working with prod data. For example, if we run SCS locally and land to prod using "land_stack", the commit will go to prod while logging will go to sandbox category. On the other hand, if we run Mononoke Bootstrap to work with a test repo, we don't use Logger at all so the "sandbox" category has no benefit.

We can add more complexity to the Mononoke logging configuration, so we are able to override WhenceScribeLogged in any way we want. But for now, I suggest overriding it in place with "prod" value since we only use Logger in prod. Later we can even simplify the config by removing the old way of logging directly to Scribe and leave just two options: test (log to file) and prod (log via Logger using the "prod" override).

Reviewed By: markbt

Differential Revision: D44118890

fbshipit-source-id: 8d4b9faa6f1f2da1faa96db35dd567102ccde34d
2023-03-24 08:39:35 -07:00
Muir Manders
2d2c96b796 graphql: update things to work off-vpn
Summary:
We use interngraph GraphQL queries for a few things (phabricator diff info, scmquery log integration).

First, move the graphql endpoint config from static to dynamic config and vary it based on domain.

Finally, set x-x2pagentd-inject-cat in GraphQL request header when using x2pagentd. This replaces the oauth token mechanism, even for existing VPN/corp use. Note that the off-vpn endpoint rejects requests with both x-x2pagentd-inject-cat header and access_token in the body. We can delete the oauth stuff once we are confident in the x2pagent usage here.

Reviewed By: quark-zju

Differential Revision: D44317674

fbshipit-source-id: 329d63207fd9a5b19a145e12b491e270b5924571
2023-03-23 22:17:29 -07:00
Muir Manders
4ad9fbcf60 graphql: respect auth_proxy.unix_socket_path
Summary:
Send graphql queries over the local proxy socket, if configured. This is a prerequisite for off-VPN compatible access.

I added an escape hatch config phabricator.use-unix-socket we can use to disable this if someone breaks.

Also, kill apparently dead phabricator_graphql_client_requests.py.

Reviewed By: quark-zju

Differential Revision: D44317673

fbshipit-source-id: 52b58ce7899ce7291b700a9fe206da6011f740e5
2023-03-23 22:17:29 -07:00
Muir Manders
c0dcb56428 dynamicconfig: bust cached config when vpnless config changes
Summary: Compare file mtimes so we synchronously regenerate dynamic config if the user has modified /etc/mercurial/vpnless. This way things will work off-VPN immediately after writing "1" to /etc/mercurial/vpnless.

Reviewed By: evangrayk

Differential Revision: D44263217

fbshipit-source-id: 1f09591336b7dc1294e1f21fafebce7962859d70
2023-03-23 22:17:29 -07:00
Muir Manders
2a8cae6908 dynamicconfig: support fetching remote config off VPN
Summary:
To support VPNless access, we need to fetch the remote config through x2pagentd, setting a CAT related header.

I tweaked the order of config loading so the remote config fetch has the system "auth_proxy.unix_socket_path" config setting available.

Reviewed By: quark-zju

Differential Revision: D44263216

fbshipit-source-id: 5b8e6c4c9c7a5ab22ecfcfa62a537623931a63bf
2023-03-23 22:17:29 -07:00
Chad Austin
5aa50eb024 remove some unnecessary includes from ObjectStore.h
Summary:
ObjectStore.h includes too many headers. Replace several with forward
declarations.

Reviewed By: xavierd

Differential Revision: D44323736

fbshipit-source-id: 944cd72fd758df4363493f87a573d91245a45b6a
2023-03-23 20:04:45 -07:00
Xavier Deguillard
3ba7532fe7 config: flip the default of several rollouts
Summary:
All of these configs have been enabled by default for a bit, let's change their
default before we can fully remove them from the code.

Reviewed By: genevievehelsel

Differential Revision: D44234768

fbshipit-source-id: 922093a64b91c9a45f84349ea50afc1c08fd6a39
2023-03-23 13:14:55 -07:00
Jeremy Fitzhardinge
3fe40d1f02 third-party/rust: update tracing-subscriber for Option<Filter>
Summary: Import https://github.com/tokio-rs/tracing/pull/2402 until it lands.

Reviewed By: zertosh

Differential Revision: D41689583

fbshipit-source-id: f1923244fcc652ba4dfcd6064aa37926a2b79bc7
2023-03-23 12:41:48 -07:00
Michael Cuevas
03bb49ffcd PrjFS: fix compiler warning and possible bug
Summary:
XLOG(DFATAL) is non-fatal in production builds, so it's possible we'll fall through here. It's unclear what the compiler will do in this scenario, so let's make sure we return folly::unit to avoid any compiler weirdness.

This may be causing a frequent crash on Sandcastle hosts where we're panicking after logging this DFATAL error. The crash looks like it's coming from an invalid instruction, so falling through here could be the root cause.

Reviewed By: xavierd

Differential Revision: D44314543

fbshipit-source-id: 6d23ffa221d7af4e7be641349eab1eb9027443a1
2023-03-23 10:18:33 -07:00
Mark Juggurnauth-Thomas
2fa948e8a5 warm_bookmarks_cache: add warmer for bssm
Summary: Basename suffix skeleton manifests are not been warmed by the warm bookmark cache.  This means requests that need these are slowed down while they are derived.  Add a warmer for them.

Reviewed By: yancouto

Differential Revision: D43906545

fbshipit-source-id: e1f77b5fe2a7a4512bfc49bf8047afef9b441fa9
2023-03-23 10:09:00 -07:00
Muir Manders
0d801b07d9 kill phabricator extension
Summary: This doesn't appear used anymore (superseded by phabdiff and phabstatus extensions).

Reviewed By: evangrayk

Differential Revision: D44263215

fbshipit-source-id: 323da45474a6cd1f9df730fdce23f4f42e836fb8
2023-03-23 07:24:46 -07:00
Liubov Dmitrieva
26fb45f25f do not sample out slow requests
Summary:
do not sample out slow requests in edenapi replay

we already don't sample them in mononoke test perf

if we also don't sample here, we will have more insight in those and also we will be able to replay

Reviewed By: clara-9

Differential Revision: D44258777

fbshipit-source-id: 597fc475062b23eb24b0c61024eea9046b808420
2023-03-23 04:13:52 -07:00
Mark Juggurnauth-Thomas
931e89a1cd virtually_sharded_blobstore: deduplicate reads of large blobs
Summary: Deduplicate reads of large blobs by using a shared future for any in-flight reads.  If another read for the same key comes in after then we will read it again, but there should be at most one read in flight for a particular key at a time.

Reviewed By: Croohand

Differential Revision: D44183928

fbshipit-source-id: d6911422a6e16b3dd246dd48cbce4390e6856940
2023-03-23 02:22:35 -07:00
Mark Juggurnauth-Thomas
7eae254179 virtually_sharded_blobstore: make it possible to convert Ticket to static lifetime
Summary: Make it possible for tickets to become `'static` by using `std::borrow::Cow` for the borrowed values, and converting to the owned variant if needed.  We will use this to shared futures that hold a ticket.

Reviewed By: Croohand

Differential Revision: D44262842

fbshipit-source-id: 2c549b2f2f3724c6485b41463b973273211dfe77
2023-03-23 02:22:35 -07:00
Mark Juggurnauth-Thomas
d3b53a9bfd virtually_sharded_blobstore: move awaited check to inner struct of Ticket
Summary:
The `awaited` boolean on the `Ticket` structure and corresponding `Drop` makes it impossible to move out of the fields of `Ticket`.  This is inconvenient, especially since it only enables a unit test check.

Move the field to a structure that's internal to the `Ticket`.  We still check for failure to await, as dropping the `Ticket` with a `CheckAwait` that hasn't been marked as awaited will still panic during tests when the inner `CheckAwait` gets dropped.

Reviewed By: Croohand

Differential Revision: D44270321

fbshipit-source-id: 29429c40243b31dcc1a5046969b85fb7a15fd0aa
2023-03-23 02:22:35 -07:00
Mark Juggurnauth-Thomas
b1c504f22c mononoke_api: remove success log for new commit graph
Summary: This log was useful while we were testing the new commit graph, but now it is too noisy and should be removed.

Reviewed By: liubov-dmitrieva

Differential Revision: D44297423

fbshipit-source-id: c9969d4a0b4709ea2065f19508ae6b51a7ee6baf
2023-03-23 01:30:34 -07:00
Michael Cuevas
f6ade70378 edenfsctl: log stderr from Python commands
Summary: We previously only logged the error code of any failed Python commands. This means we have no insight into why Python commands were failing.

Reviewed By: chadaustin

Differential Revision: D44111246

fbshipit-source-id: 8c2f66457761ddd8b90ff4fb307152cd27ffa00a
2023-03-22 21:12:36 -07:00
Xavier Deguillard
d1d5134f70 prjfs: add telemetry for invalidation times
Summary:
During checkout, these 2 are called a large amount of time, let's make sure we
have some telemetry so we can understand how much time is spent doing
invalidation during checkout.

Reviewed By: chadaustin

Differential Revision: D44311711

fbshipit-source-id: 5af62fe7fd4b37972458bc545bfaa2f4b4d2ca53
2023-03-22 20:04:41 -07:00
Xavier Deguillard
317e55ca91 inodes: use EdenStats with shared_ptr, not raw pointers
Summary:
This makes lifetime easier to reason about, and allows easier use of
DurationScope (see next diff).

Reviewed By: chadaustin

Differential Revision: D44311712

fbshipit-source-id: 1f9f4cbcc59bafeb464e2b39a248958cedaf9ca6
2023-03-22 20:04:41 -07:00
Xavier Deguillard
dfb6efba3c config: change nfs.iosize default value
Summary:
Running the benchmarks/random_writes.cpp benchmark on all power of 2 from 4KiB
to 1MiB shows that 16KiB has the best tradeoff between fast random writes and
fast streaming writes.

Reviewed By: chadaustin

Differential Revision: D44320693

fbshipit-source-id: 2d1839caca3c30acdb6ffc675710a68359d03a76
2023-03-22 18:48:31 -07:00
Xavier Deguillard
00db4f8673 integration: remove FOLLY_INIT_LOGGING_CONFIG from helpers
Summary:
This one slipped through D44263797 and allows for integration tests to be run
with Buck2 on macOS.

Reviewed By: fanzeyi

Differential Revision: D44315942

fbshipit-source-id: d2de0773ba68f13fca9e8d5c067b82653646c757
2023-03-22 17:05:50 -07:00
Jun Wu
a5a9ea884b contrib: add a script to measure gca performance in hg and git
Summary:
I would like to refer to some performance data of `gca` in the Segmented
Changelog doc.

Initially I was trying to make `drawdag` fast since it can use an elegant
syntax `A001..A999` and can work for both git and hg formats
(`debugexportrevlog` can be used to create repos that the upstream Mercurial
can understand). However it turns out to be a lot of work to make `drawdag`
"just" fast so I ended up writing dedicated scripts to create repos with
millions of commits.

Reviewed By: muirdm

Differential Revision: D43373717

fbshipit-source-id: 5ea1753027cb7487099ed00007e4cc0beae8a09a
2023-03-22 15:59:03 -07:00
generatedunixname89002005307016
536c2c3aeb Add annotations to eden/scm/edenscm/ext/infinitepush/bookmarks.py
Reviewed By: quark-zju

Differential Revision: D44214177

fbshipit-source-id: ff1956a5f605bdddafa966d67e3f45995855a0a0
2023-03-22 12:50:49 -07:00
Jun Wu
ee0fb9448c pathhistory: do not use parents outside the requested set to skip segments
Summary:
Parents outside the requested set mislead PathHistory to skip a segment
incorrectly. Detect that and do not skip segment in this case.

Reviewed By: zzl0

Differential Revision: D44305349

fbshipit-source-id: 9c75c4f830e97ff0f54c992bef3ac3aa331edbe1
2023-03-22 11:49:24 -07:00
Jun Wu
eb8a75498f pathhistory: add ways to test PathHistory on a subset of commit graph
Summary:
Previously the pathhistory tests always use the entire commit graph to
initialize PathHistory. This diff adds a way to test it on a subset of
the commit graph.

Reviewed By: zzl0

Differential Revision: D44305350

fbshipit-source-id: 955af0243a89f4f6e8f13da970170021c51dafbf
2023-03-22 11:49:24 -07:00
Andres Suarez
71f5bdec8b Unfork daemonize
Summary:
daemonize-0.5.0 has been released:
https://crates.io/crates/daemonize/0.5.0

Reviewed By: diliop, dtolnay

Differential Revision: D44303114

fbshipit-source-id: 69f7b0d091b92b31cb1b595198f31aeb41bfb601
2023-03-22 11:23:15 -07:00
Andres Suarez
29266dbdee Unfork and update bindgen
Summary:
Both waiting-in PRs have been merged and released:

- https://github.com/rust-lang/rust-bindgen/pull/2319
- https://github.com/rust-lang/rust-bindgen/pull/2326

Adding `artifact = "bin"` removes the need for the `lib.rs` patch:

- 357927634f

Reviewed By: jsgf

Differential Revision: D44301594

fbshipit-source-id: d5ac1b54b099655e8e87974e42439bcd32aa5aed
2023-03-22 11:23:15 -07:00
Mateusz Kwapich
18fee6dffd flush bookmark cache in the pull test
Summary:
Sometimes the tests run so fast that we're being served stale version of the
bookmarks.

This may cause the test to occasionally take the fast path where it expects to take the slow path, and has caused this test to be flaky since its creation (although not always flaky enough to be marked as such).

Differential Revision: D44298928

fbshipit-source-id: 046ce5bc4e005f3d443794202352bfdc5c80895a
2023-03-22 09:55:41 -07:00
Rajiv Sharma
c48b5fe53a Publish liveness metric for ConfigUpdater process
Summary: Youssef accidentally discovered that config hot reloading was not working for SCS server when working on an oncall task. He then went ahead and fixed that issue in D44206206. However, we did not get any notification or alert about this problem and it would have stayed hidden much longer had we not accidentally detected it. This diff adds a liveness metric for the `ConfigUpdater` which will keep publishing every 5 mins as long as the `MononokeConfigs` object is live.

Reviewed By: YousefSalama

Differential Revision: D44293235

fbshipit-source-id: 6f54831c8b1f2154a23c021a7d2d8f01615a7d70
2023-03-22 07:03:04 -07:00
Mark Juggurnauth-Thomas
696884ceb6 gotham_ext: add stream stats gathering
Summary:
A gotham request consists of two parts.  The first part is a future, in which the handler resolves the request and produces the response headers.  The second part is the body which may optionally be a stream.  We added collection of future stats for the first part, but the majority of work may actually be done when computing the stream for the body.

In this diff we add stats collection for that body stream, if it is used.  Since this is separate from the future stats we already collected, we prefix the scuba columns with "stream_" to make it clear this is the stream.

Reviewed By: liubov-dmitrieva

Differential Revision: D44260233

fbshipit-source-id: 9820d3f30fb147740a95d8afc2fc1bf1fcc16aab
2023-03-22 04:40:35 -07:00
Xavier Deguillard
cacde4e855 telemetry: fix typo for hasOverlayFile counter
Summary: The counter should be has_overlay_file, not has_overlay_dir.

Reviewed By: fanzeyi

Differential Revision: D44274455

fbshipit-source-id: 55563a0da14ec0ef1a089e3073cc8fd290d2f35d
2023-03-21 17:05:40 -07:00
Michael Cuevas
22c1162022 redirect: improve error message
Reviewed By: genevievehelsel

Differential Revision: D44108911

fbshipit-source-id: 3f2f83793958c7eedca2bca14fe0a7d60e6fc301
2023-03-21 15:50:30 -07:00
Michael Cuevas
c1e781d702 add logged_by field to edenfs events.
Summary: Add this so we know where events in edenfs_events came from (Python CLI, Rust CLI, or the daemon).

Reviewed By: mshroyer

Differential Revision: D44044474

fbshipit-source-id: e23af5e186121657dfabf25c5c50882cc9aec923
2023-03-21 15:50:30 -07:00
Jeremy Fitzhardinge
0dc6076e71 third-party/rust: update tempfile to 3.4
Summary:
Removes need for patch.

It had already been updated to 3.4 but this just formalizes it.

Reviewed By: jasonwhite

Differential Revision: D44274378

fbshipit-source-id: d17ecbbee06c7df30f689eb859fb31fdf07d8d44
2023-03-21 15:25:59 -07:00
Barys Skarabahaty
0aa47f458d Generalize Hash and add Hash32
Summary:
Generelizing the Hash structure and adding Hash32 support.

Also, added a few basic keyed blake3 methods for that.

This is mainly a preparation to start supporting blake3.

bypass-github-export-checks

Reviewed By: chadaustin

Differential Revision: D44173515

fbshipit-source-id: 87c55d47dabe50c7104f09ee0078f29513068862
2023-03-21 15:12:32 -07:00
Barys Skarabahaty
05a5a1fa3e Add Blake3 support
Summary:
Adding blake3 for the upcoming migration to it.

bypass-github-export-checks

Reviewed By: chadaustin

Differential Revision: D43567300

fbshipit-source-id: a0c81b42309cab65cf68be9be0530c86e0e91e95
2023-03-21 15:12:32 -07:00
Xavier Deguillard
553b4278a0 main: move folly::init default configuration to main
Reviewed By: fanzeyi

Differential Revision: D44263797

fbshipit-source-id: 61a219e98b96f61495eb549c0e01ca635ab29e9f
2023-03-21 14:17:32 -07:00
Zhaolong Zhu
badf6d159d getdeps: remove test-getdeps from Sapling manifest (#4373)
Summary:
X-link: https://github.com/facebookincubator/velox/pull/4373

We are now planning to remove the Sapling getdeps build since Sapling
doesn't use it for open source anyway. The EdenFS getdeps build will adapt one
way or another.

This diff only remove the test step of the Sapling getdeps, which is failing
now. Will remove the entire Sapling manifest the following diff.

Reviewed By: quark-zju

Differential Revision: D44233463

fbshipit-source-id: c29419ab316fb1d0c3131d00b2fe3b4e3bb879e6
2023-03-21 13:04:28 -07:00
Genevieve (Genna) Helsel
b21d2d3e27 use InodeCatalog in FsckTest
Summary: This needs to be generalized for using multiple different `InodeCatalog` types besides `FSInodeCatalog`

Reviewed By: xavierd

Differential Revision: D44236703

fbshipit-source-id: c38b017c0b7d1587fba90d40b527a016f1984fcf
2023-03-21 10:25:29 -07:00
Liubov Dmitrieva
6d9ab31217 bump request_id len
Summary:
bump request_id len

Currently there are conflicts even within the same date https://fburl.com/scuba/mononoke_test_perf/ti2v0ka8
This is confusing. Let's bump.

Differential Revision: D44255577

fbshipit-source-id: 12d4f0ff8a7589da2057d1557fb651583551e329
2023-03-21 09:46:09 -07:00
Alex Taran
902ab02865 fix "Eden is still starting ..." typo
Summary: This is just a tiny typo fix, I saw it today when I ran `$ eden status` after restarting my Mac.

Differential Revision: D44144242

fbshipit-source-id: fd721e41d9e3a3dcd73870a0819618e43e4d089c
2023-03-21 07:12:04 -07:00
Pierre Chevalier
493f85d012 Ignore more memory leaks introduced by the libgit2 upgrade
Summary:
As of the libgit2 upgrade from 0.27.2 to 0.28.5 in D43195307, asan has been complaining about memory leaks coming from libgit2.

It initially caused 468 test failures.
D44096350 fixed 403 of these tests, but 65 are still failing.

Running one of these, we can see two other memory leaks (see test plan) being higlighted.

Mute them.

Differential Revision: D44254572

fbshipit-source-id: 8ae49c49542dda954f66de18cb756709d0c624d3
2023-03-21 07:00:16 -07:00
Xavier Deguillard
94a53c4a93 inodes: add missing loadOverlayDir telemetry
Summary: Somehow I missed this one in D44118779.

Reviewed By: genevievehelsel

Differential Revision: D44236425

fbshipit-source-id: 241f574d61572faa75c864f81279305f50b45abe
2023-03-20 17:20:19 -07:00
generatedunixname89002005307016
9251963b71 Add annotations to eden/scm/edenscm/commands/debugmetalog.py
Reviewed By: quark-zju

Differential Revision: D44202171

fbshipit-source-id: 654365adf939f0dc041074b209be9acdbdfb822c
2023-03-20 12:48:49 -07:00
Mark Juggurnauth-Thomas
cc8c4a2f2d throttledblob: fix Display name
Summary: The `ThrottledBlob` impl of `Display` erroneously calls itself `ReadOnlyBlobstore`.  Fix it.

Reviewed By: mitrandir77

Differential Revision: D44222306

fbshipit-source-id: 2f4e3ef27322a7842f7fcb5ac6436fb91bc1230f
2023-03-20 12:41:57 -07:00
Genevieve (Genna) Helsel
f2b7d4bc41 use InodeCatalog instead of FsInodeCatalog in OverlayChecker
Summary: In preparation for making `OverlayChecker` work for both `FsInodeCatalog` and `SqliteInodeCatalog`, this migrates `OverlayChecker` to use `InodeCatalog`. Currently this code path can only ever be hit if we're using a `FsInodeCatalog`, so this should not be a behavior change.

Reviewed By: chadaustin

Differential Revision: D44105571

fbshipit-source-id: 0000319a5e78a6adb32ed0f602af173562a1b35a
2023-03-20 12:41:32 -07:00
Genevieve (Genna) Helsel
fd74a4d27b rename TreeOverlay -> SqliteOverlay
Summary: as far as I can tell, we no longer have any callsites using `--overlay-type`, so this diff changes "tree" -> "sqlite" since that more accurately describes the difference between the different overlay options.

Reviewed By: chadaustin

Differential Revision: D44105266

fbshipit-source-id: 40d036222ca3e07c14f3f78aec374d4b6d54eb8a
2023-03-20 12:41:32 -07:00
Saul Gutierrez
c07f393ced requirements: add requirements validation for all commands
Summary: Previously we had some requirements validation logic, but that was only available for Python commands. This makes requirements validation for both Python and Rust commands work.

Reviewed By: zzl0

Differential Revision: D44106560

fbshipit-source-id: 9b435017d336a314f06dc8fff96ec50a6aef8fcf
2023-03-20 11:00:22 -07:00
Yan Soares Couto
3e41a10a42 hg_sync: Use unredacted blobstore
Summary:
We need to copy redacted commits as well, to maintain consistency, otherwise we can't progress the sync.

This is stopping the www import to fbsource.

Reviewed By: RajivTS

Differential Revision: D44217272

fbshipit-source-id: c6c03df1ebc6310688a134b1bfdcb3e19fc3daa7
2023-03-20 09:29:30 -07:00
Pierre Chevalier
82dd44934f Ignore memory leaks introduced by the libgit2 upgrade
Summary:
As of the `libgit2` upgrade from `0.27.2` to `0.28.5` in D43195307, `asan` has been complaining about memory leaks coming from `libgit2`.

This caused 468 tests failures as reported in this task: T147770506.

An initial investigation hasn't quickly led to a resolution of the source of the memory leaks.

Get the tests back to green by suppressing the memory leaks detection from ASAN.
AddressSanitizer: 480 byte(s) leaked in 4 allocation(s).
/data/sandcastle/boxes/fbsource/buck-out/v2/gen/fbcode/94ab8015be307995/eden/integration/__rc__/rc#link-tree/eden/integration/lib/testcase.py:92: === clean up done at 93.718s (+10.623s)
ERROR

======================================================================
ERROR: test_eden_list (eden.integration.rc_test.RCTestNFSGit)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/fbcode/platform010/lib/python3.8/unittest/async_case.py", line 72, in _callCleanup
    self._callMaybeAsync(function, *args, **kwargs)
  File "/usr/local/fbcode/platform010/lib/python3.8/unittest/async_case.py", line 84, in _callMaybeAsync
    ret = func(*args, **kwargs)
  File "/data/sandcastle/boxes/fbsource/buck-out/v2/gen/fbcode/94ab8015be307995/eden/integration/__rc__/rc#link-tree/eden/integration/lib/testcase.py", line 158, in <lambda>
    self.addCleanup(lambda: self.eden.cleanup())
  File "/data/sandcastle/boxes/fbsource/buck-out/v2/gen/fbcode/94ab8015be307995/eden/integration/__rc__/rc#link-tree/eden/integration/lib/edenclient.py", line 134, in cleanup
    self.kill()
  File "/data/sandcastle/boxes/fbsource/buck-out/v2/gen/fbcode/94ab8015be307995/eden/integration/__rc__/rc#link-tree/eden/integration/lib/edenclient.py", line 143, in kill
    self.shutdown()
  File "/data/sandcastle/boxes/fbsource/buck-out/v2/gen/fbcode/94ab8015be307995/eden/integration/__rc__/rc#link-tree/eden/integration/lib/edenclient.py", line 434, in shutdown
    raise Exception(
Exception: eden exited unsuccessfully with status 1

----------------------------------------------------------------------
Ran 1 test in 93.725s

FAILED (errors=1)

Exception: eden exited unsuccessfully with status 1
  File "/usr/local/fbcode/platform010/lib/python3.8/unittest/case.py", line 60, in testPartExecutor
    yield
  File "/usr/local/fbcode/platform010/lib/python3.8/unittest/case.py", line 717, in doCleanups
    self._callCleanup(function, *args, **kwargs)
  File "/usr/local/fbcode/platform010/lib/python3.8/unittest/async_case.py", line 72, in _callCleanup
    self._callMaybeAsync(function, *args, **kwargs)
  File "/usr/local/fbcode/platform010/lib/python3.8/unittest/async_case.py", line 84, in _callMaybeAsync
    ret = func(*args, **kwargs)
  File "/data/sandcastle/boxes/fbsource/buck-out/v2/gen/fbcode/94ab8015be307995/eden/integration/__rc__/rc#link-tree/eden/integration/lib/testcase.py", line 158, in <lambda>
    self.addCleanup(lambda: self.eden.cleanup())
  File "/data/sandcastle/boxes/fbsource/buck-out/v2/gen/fbcode/94ab8015be307995/eden/integration/__rc__/rc#link-tree/eden/integration/lib/edenclient.py", line 134, in cleanup
    self.kill()
  File "/data/sandcastle/boxes/fbsource/buck-out/v2/gen/fbcode/94ab8015be307995/eden/integration/__rc__/rc#link-tree/eden/integration/lib/edenclient.py", line 143, in kill
    self.shutdown()
  File "/data/sandcastle/boxes/fbsource/buck-out/v2/gen/fbcode/94ab8015be307995/eden/integration/__rc__/rc#link-tree/eden/integration/lib/edenclient.py", line 434, in shutdown
    raise Exception(

Buck UI: https://www.internalfb.com/buck2/947a3357-9a80-4a15-b067-fbad6a615fd0
Test UI: https://www.internalfb.com/intern/testinfra/testrun/3096224848534397
RE: reSessionID-765a77c0-c485-4182-be99-f7431d285752  Up: 312 KiB  Down: 498 KiB
Jobs completed: 31. Time elapsed: 109.0s. Cache hits: 100%. Commands: 2 (cached: 2, remote: 0, local: 0)
Tests finished: Pass 4. Fail 4. Fatal 0. Skip 0. 0 builds failed
4 TESTS FAILED
  ✗ fbcode//eden/integration:rc - test_unmount_rmdir (eden.integration.rc_test.RCTestNFSGit)
  ✗ fbcode//eden/integration:rc - test_eden_list (eden.integration.rc_test.RCTestGit)
  ✗ fbcode//eden/integration:rc - test_unmount_rmdir (eden.integration.rc_test.RCTestGit)
  ✗ fbcode//eden/integration:rc - test_eden_list (eden.integration.rc_test.RCTestNFSGit)B
```

After:
```
Buck UI: https://www.internalfb.com/buck2/7091ae16-eb5f-425d-8922-cf278987acb3
Test UI: https://www.internalfb.com/intern/testinfra/testrun/3940649832205800
RE: reSessionID-a06bbda7-b3c4-46c6-998f-7e2280bb7ad8  Up: 558 B  Down: 0 B
Jobs completed: 11. Time elapsed: 113.5s.
Tests finished: Pass 8. Fail 0. Fatal 0. Skip 0. 0 builds failed
```

Reviewed By: kmancini

Differential Revision: D44096350

fbshipit-source-id: 1c8a5308759f2dc90e00b33b8f4e19f2ca53f54f
2023-03-20 08:50:21 -07:00
Muir Manders
df98ce2a84 progress: allow longer topics in wider temrinals
Summary:
Show topics up to 20 chars if terminal width is >= 100.

This is a stop gap until I land my new renderer that uses space more efficiently.

Reviewed By: quark-zju

Differential Revision: D44136359

fbshipit-source-id: 5d59c8b07d930d689b73c3e0fe1c3ee8ce020118
2023-03-20 08:42:20 -07:00
generatedunixname89002005307016
ac21274523 upgrade pyre version in fbcode/eden - batch 1
Reviewed By: yancouto

Differential Revision: D44181498

fbshipit-source-id: 8772acfdcebc86976e588669b63e3200689ca0f4
2023-03-20 07:02:53 -07:00
Youssef Ibrahim
56833294b0 don't drop MononokeApp in wait_until_terminated before termination signal to avoid dropping ConfigHandle
Summary:
When MononokeApp is dropped, the ConfigHandle inside of it gets dropped, and the config updater thread stops receiving updates causing config hot reloading to stop working. This was happening in scs, the land service, and the derived data service (not sure if this is also happening in Mononoke server).
This diff adds an explicit drop in the server closure in wait_until_terminated to make sure MononokeApp is not dropped before receiving a termination signal.

Reviewed By: Croohand

Differential Revision: D44206206

fbshipit-source-id: 7322f516c0dcbf4668cba811bdb582f0e5e2f11c
2023-03-20 06:54:27 -07:00
Liubov Dmitrieva
1d5e907ae0 remove dead code
Summary:
remove dead code

left over from earlier clean up

Reviewed By: YousefSalama

Differential Revision: D44131387

fbshipit-source-id: 20601b5e32777d8b2952120e95a24930ef4d2159
2023-03-20 02:54:29 -07:00
Andres Suarez
18aabd8811 graphql-parser: use upstream rev
Summary:
vmagro deleted his forked and now broke Reindeer importing. Please be
more careful.

https://github.com/graphql-rust/graphql-parser/pull/66 has been merged
but not released.

Reviewed By: dtolnay

Differential Revision: D44198593

fbshipit-source-id: 287f0f3f6860cdf16deb7be80448c2962a9f10a6
2023-03-18 14:44:48 -07:00
Xavier Deguillard
fecc45e91e inodes: recover from corrupted sqlite database
Summary:
We've seen several cases where the sqlite database is corrupted causing EdenFS
to fail to start and requiring manual remediation. On Windows, we can always
reconstruct the sqlite database from scratch due to FSCK being able to build it
from scratch. Thus, we can simply delete the database on disk and continue
starting up.

Reviewed By: chadaustin

Differential Revision: D44155034

fbshipit-source-id: de05c814796ab8f76fd3cd9a3e98df438431c657
2023-03-17 21:38:48 -07:00
Xavier Deguillard
27e7b2b340 telemetry: remove unused stats
Summary: These are unused, let's remove them.

Reviewed By: chadaustin

Differential Revision: D44110103

fbshipit-source-id: 7c292f7be0a79f645afc80ef3e6f405e7edbf282
2023-03-17 14:13:02 -07:00
Xavier Deguillard
afdbd9c2d6 store: fix a typo
Reviewed By: genevievehelsel

Differential Revision: D44110106

fbshipit-source-id: 801aacb3cd1888f10e49c40eaf43640341034a91
2023-03-17 14:13:02 -07:00
Xavier Deguillard
8eb72c47a7 store: allow batch of aux data to be fetched
Summary:
Nothing is being enqueued just yet, but this teaches EdenFS how to fetch
batches of aux data.

In the case where the aux data cannot be fetched, a nullptr auxdata is returned
to the higher level which will then trigger a blob fetch to compute aux data.

Reviewed By: chadaustin

Differential Revision: D44110104

fbshipit-source-id: 53df1496addf3a9dae521ffcdba5b060b8fce16a
2023-03-17 14:13:02 -07:00
Xavier Deguillard
ecc972bd74 store: add support for aux data in hg import queue
Summary:
As a first step towards enabling aux data fetching, we need to allow aux data
to be batch fetched.

Reviewed By: chadaustin

Differential Revision: D44110105

fbshipit-source-id: f9c3f55ffdc5554784b5f38457ef675689664263
2023-03-17 14:13:02 -07:00
Xavier Deguillard
838419fceb service: expose AUX fetching counters and watches through the stack
Summary:
Currently, EdenFS doesn't perform any aux data fetching, instead it fallback to
fetching blobs. In some cases, this can be extremely expensive when the aux
data store is emptied/flushed/rotated leading to non deterministic performance.
On Windows in particular, directory listing always need blob sizes, and thus
getting aux data reliably is critical.

As a first step, let's add some watches through the stack and expose these to
Thrift. This will allow `eden top` and `eden trace hg` to display these
fetches correctly.

Reviewed By: chadaustin

Differential Revision: D44105497

fbshipit-source-id: a3dc5cce1bc3115a2a4effcece6fa0cf0b16f6c8
2023-03-17 14:13:02 -07:00
Xavier Deguillard
e3440801f3 store: remove unecessary move
Summary: By using reference everywhere, we can save on several moves.

Reviewed By: chadaustin

Differential Revision: D44101377

fbshipit-source-id: 9aa9d89570fb0432477e632d108109d292fa63bb
2023-03-17 14:13:02 -07:00
Muir Manders
c38b686c8d remotefilelog: don't prefetch file history when diffing
Summary: I don't think we need file history when diffing commits, so skip it. This can be really slow for files with a lot of history.

Reviewed By: quark-zju

Differential Revision: D44175699

fbshipit-source-id: 945517f58ea9baf9d5e22ca04699d72e8dad72f7
2023-03-17 13:22:24 -07:00
Zhaolong Zhu
5ada2721ca Back out "checkserverbookmark: remove extension and test"
Summary:
Original commit changeset: f120255c4c33

Original Phabricator Diff: D42823312

Reviewed By: quark-zju, mitrandir77

Differential Revision: D44173377

fbshipit-source-id: 91b67299a4eccb6c60d5278bd4b2703d3fc08986
2023-03-17 12:10:13 -07:00
Evan Krause
50c212dc4b redact access-token-like strings from rage
Reviewed By: muirdm

Differential Revision: D43968579

fbshipit-source-id: 1c46c2c43f6bd9b99b6a6694aa8902602c1a1258
2023-03-17 11:54:19 -07:00
Xavier Deguillard
36407b2f7e inodes: add ODS telemetry for the Overlay
Summary:
Our telemetry doesn't capture any data regarding how long Overlay operations
are taking. Since there is a suspicion that checkout is bounded on the Overlay,
let's add these counters to better understand the cost of the Overlay.

Reviewed By: genevievehelsel

Differential Revision: D44118779

fbshipit-source-id: 2e8658c9b0629a0a4f9c6f4535ec876527386b5f
2023-03-17 11:41:26 -07:00
generatedunixname89002005307016
5261fd9f22 Add annotations to eden/scm/edenscm/ext/github/pr_status.py
Reviewed By: zzl0

Differential Revision: D44164341

fbshipit-source-id: b928bbd43a3f088932f85b093fd5a520cc9b5c7b
2023-03-17 10:13:07 -07:00
Rajiv Sharma
7959a58c3a Backing out ContentMetadataV2 stuff
Summary: Backing out ContentMetadataV2 stuff since the backfilling for that data has not yet been done and live traffic would see quite laggy performance if we did it directly in Prod Mononoke. So backing out for now until backfilling is fully complete.

Reviewed By: YousefSalama

Differential Revision: D44136799

fbshipit-source-id: ca403f89b8215f2dfd5582dda7499f1618944f2a
2023-03-17 06:24:03 -07:00
Rajiv Sharma
fbb376053a Generate missing Blake3 alias on x-repo file copy
Summary: Due to backfilling `ContentMetadataV2` in phases, there are some cases where the metadata exists but the `Blake3` alias doesn't. When copying the alias, if the alias is not present, let's regenerate it.

Reviewed By: markbt

Differential Revision: D44132513

fbshipit-source-id: 4185ece38db350b0069dff485a40166bb0cb1c4d
2023-03-17 03:06:23 -07:00
Thomas Orozco
9fd1e0b4d2 third-party/rust: update perf-event
Summary: To get `exclude_user()`

Reviewed By: dtolnay

Differential Revision: D44131122

fbshipit-source-id: f23b67394db0e20cb4e2071a188ae3c5c7b8fe15
2023-03-17 00:53:36 -07:00
Zeyi (Rice) Fan
ce741bb212 integration: label split_test failing reason & improve error reporting
Summary:
It turned out `split_test` is failing for the same reason as other hg tests.

The assert raise hid the actual error so it wasn't very clear. So this diff adds some better reporting for that as well.

Reviewed By: kmancini

Differential Revision: D43962607

fbshipit-source-id: 137016260f286ee9577576d90e9e4372d4db960e
2023-03-16 22:07:10 -07:00
Zeyi (Rice) Fan
52c1bd21f0 integration: enable files,merge,move,rebase,revert,status,update tests
Summary: Most of these tests are already passing, except few of them are having issues with `_asciitransform`.

Reviewed By: mshroyer

Differential Revision: D43960522

fbshipit-source-id: b3bae8d3df1acc6f9b32057367309aff44c93de3
2023-03-16 22:07:10 -07:00
Zeyi (Rice) Fan
f967082176 integration: enable add tests
Summary: After the `._` fix, these tests are passing and we can enable them.

Reviewed By: chadaustin

Differential Revision: D43931347

fbshipit-source-id: c568eeaff5802901a20036c81faac58e44b74820
2023-03-16 22:07:10 -07:00
Jun Wu
82883adb82 pathauditor: update error message in Windows tests
Summary:
This makes `test-invalid-windows-filepath.t` pass with recent pathauditor error
type changes.

Reviewed By: sggutier

Differential Revision: D44153212

fbshipit-source-id: 81e71c48a42ef29eecf3a3a3e117141f43232efb
2023-03-16 16:50:14 -07:00
Jun Wu
8a4ac187c8 distutils_rust: fix Windows detection
Summary: `distutils.util.get_platform()` now returns `win32` without a dash.

Reviewed By: sggutier

Differential Revision: D44153213

fbshipit-source-id: 3fd306f430cc043841526a0aaade80d62b452812
2023-03-16 16:50:14 -07:00
Jun Wu
a218db7daf test-blackbox: update test to match the latest behavior
Summary:
Not sure what changed, but we got:

    --- test-blackbox.t
    +++ test-blackbox.t.err
    @@ -31,6 +31,7 @@
       [process_tree] (this process)
       [command] [*, "confuse"] started by uid 0 as pid 0 with nice 0 (glob) (?)
       [process_tree] (this process) (?)
    +  [legacy][command_info]
       [legacy][command_info]
       [legacy][env_vars]
       [legacy][command_info] (?)

The alias expansion seems broken. Update the test text to mention it.

Reviewed By: sggutier

Differential Revision: D44139337

fbshipit-source-id: b4012eb3ee3340c52e3514dd49c617bdf851a572
2023-03-16 12:35:53 -07:00
Jun Wu
c9aa9a5d46 distutils_rust: set OPENSSL_DIR on macOS
Summary:
Move macOS OPENSSL_DIR logic from onetime-setup.py to distutils_rust.
Hopefully this makes it work for hgbuild which does not run onetime-setup.

`HG_LINKER_FRAMEWORK` is removed since code search shows it is not used.

Reviewed By: sggutier

Differential Revision: D44142250

fbshipit-source-id: b7af87bbdd9eac48b7b00fbd14ca062bc953c727
2023-03-16 11:48:20 -07:00
Xavier Deguillard
5479f3c911 inode: enhance checkout telemetry
Summary:
Understanding how many trees and blobs were accessed but not fetched during
checkout is a useful metric that informs us as to how much was served from
caches. This is useful as checkout is more or less proportional in time to the
number of accessed inodes and the number of accessed trees+blobs will thus tell
us how many TreeInode and FileInode were loaded and traversed.

Reviewed By: chadaustin

Differential Revision: D44117153

fbshipit-source-id: 56991c51f2e4f501486d64ab5598f149f2708b77
2023-03-16 11:27:06 -07:00
Muir Manders
3ca657ab34 sparse: kill "warnfullcheckout" code
Summary: This was never utilized beyond the "warn" stage, and I don't want to implement in Rust, so let's kill it.

Reviewed By: quark-zju

Differential Revision: D43970585

fbshipit-source-id: cea765197a5f547441865a055deb1f13ad9ea28a
2023-03-16 10:58:55 -07:00
Muir Manders
60615dcbf8 sparse: kill marker file detection
Summary: Sparse profiles supported configuring a list of "unsafe" marker files that would cause an error if they accidentally were included in a sparse profile (presumably to avoid unneeded sparse profile growth). However, this feature is not in use anymore, and I don't want to implement it in Rust, so kill it.

Reviewed By: quark-zju

Differential Revision: D43970582

fbshipit-source-id: a6576b8004cc41b3e6f2f0e0040b54e54af2bdc4
2023-03-16 10:58:55 -07:00
Muir Manders
3674a0540b status: fix rust flags comparison
Summary:
Fix rust status when dirstate does not contain executable/symlink flags for a tracked file, and the file's flags have diverged from the manifest.

To achieve this we pipe the filesystem metadata long to the content check since the content check already looks up all the files in the manifest. Before actually doing the content check, it compares the on-disk flags to the manifest flags.

Reviewed By: quark-zju

Differential Revision: D43970583

fbshipit-source-id: 544acfa355cf9d0d2acf59ad9143de6dac349235
2023-03-16 10:58:55 -07:00
Muir Manders
c31321235e status: fix symlink handling
Summary:
Handle case where a directory with tracked files is replaced with a symlink.

In paticular, during status if we get a access-file-through-symlink audit error trying to read the contents of a file for comparison, we now treat the file as deleted.

Reviewed By: quark-zju

Differential Revision: D43970589

fbshipit-source-id: e145d36275e4af18ec77f4fb3b018f85df8f39f6
2023-03-16 10:58:55 -07:00
Muir Manders
2a4c2ad74a pathauditor: use concrete error types
Summary: I need to differentiate the symlink error in the status code path.

Reviewed By: quark-zju

Differential Revision: D43970579

fbshipit-source-id: 7931f83f828352a8f5ca8f90ff037702b0c64369
2023-03-16 10:58:55 -07:00
Muir Manders
a7946d0f17 status: handle crazy mtimes in rust
Summary:
Don't error out for files with negative or huge mtimes. We use the same masking approach as Python for now.

Note that Rust status does not write the mtime back to dirstate in general right now, so success is merely that "hg status" doesn't crash in this case.

Reviewed By: zzl0

Differential Revision: D43970588

fbshipit-source-id: f1ea50eaeeee2fc9b564934ec587c9f02abaf651
2023-03-16 10:58:55 -07:00
Muir Manders
130eae4e18 status: enable rust status in more tests
Summary: Previously this diff fixed eagerepo file store to strip copy metadata, but that was handled better by D43972516. Now this diff just enables rust status in affected tests.

Reviewed By: zzl0

Differential Revision: D43970584

fbshipit-source-id: 8d2f87128a06f33524078d476bd9fb68cf6b642e
2023-03-16 10:58:55 -07:00
Muir Manders
df42ae4d04 workingcopy: add traces to filedetector
Summary: These will help me figure out "status" discrepancies.

Reviewed By: zzl0

Differential Revision: D43970581

fbshipit-source-id: 63ef7578b6aec100b172da9516292aa549b8d318
2023-03-16 10:58:55 -07:00
Muir Manders
1bcc7abff8 tests: enable rust status for debugruntest tests
Summary:
The new status doesn't work w/ legacy repos, so the tests need to be migrated. For each test, first I tried migrating to eagerepo, but in many cases that didn't work. Next I tried a remotefilelog repo (AKA "newclientrepo"). If I still couldn't get the test to work I just disabled rust status. This was mostly in tests that disabled treemanifest or were explicitly coupled with revlogs somehow.

Some tests had acute "hg status" discrepancies, so I left a FIXME(status) and disabled rust status.

I added a new "eagerepo" tinit.sh function that turns on eager format (for client repos). With this, tests doing "hg init" might just work with features that expect a modern repo.

Reviewed By: quark-zju

Differential Revision: D43839499

fbshipit-source-id: ce6d3b2747b90d31bd246c30551bdb55c446112f
2023-03-16 10:58:55 -07:00
Rajiv Sharma
35bd5a1fc9 Remove unused import
Summary: As in title

Reviewed By: YousefSalama

Differential Revision: D44132682

fbshipit-source-id: bb805c3545df700cfb67e3f32cf5957a4a620eac
2023-03-16 07:52:44 -07:00
Saul Gutierrez
416bc02aa2 symlinks: make checklink function universal
Summary: Recycles our POSIX `checklink` implementation so that it can be used with Windows. This should be safe given that D43456961 gates the Windows symlink functionality.

Reviewed By: muirdm

Differential Revision: D43456959

fbshipit-source-id: eaf20b692b118642606cb59ffbc01c3052f05522
2023-03-16 07:33:58 -07:00
Saul Gutierrez
e091385d09 symlinks: add gating for Windows symlinks through store requirements
Summary: This should allow in later diffs to enable symlinks on Windows if users have `windowssymlinks` on their repo store requirements. Additionally, it adds the aforementioned requirement to new repos cloned with the `symlinks.force-enable` config.

Reviewed By: muirdm

Differential Revision: D43456961

fbshipit-source-id: bd2f5a1cb6c3b647ebccb0de556959758a4d7fe2
2023-03-16 07:33:58 -07:00
generatedunixname89002005307016
0d039f7f25 Add annotations to eden/scm/edenscm/ext/interactiveui.py
Reviewed By: zzl0

Differential Revision: D44130885

fbshipit-source-id: 4f7c9cd4c769497ee3d69d16750bba476420e221
2023-03-16 06:56:41 -07:00
Michael Cuevas
2c7bbded01 fix/document stats tests for windows and macOS
Summary: Some of these stats counters don't exist for NFS/PrjFS mounts. I filed tasks (T147665665, T147669123) to add these counters in the future, but until then we will disable some tests.

Reviewed By: kmancini

Differential Revision: D43963755

fbshipit-source-id: 4fd9ab9fa5bc123a6d24c669b655bfb18cf3a0a5
2023-03-15 15:22:51 -07:00
Xavier Deguillard
d066d48aa7 doctor: disable check_hg_status_match_hg_diff
Summary: The check appears to be flaky for an unknown reason.

Reviewed By: chadaustin

Differential Revision: D44104911

fbshipit-source-id: 390a0d11e16d09c5204d829727ee20db37665815
2023-03-15 14:55:24 -07:00
Mark Juggurnauth-Thomas
0f1585f8cf mononoke_api: bound buffering of create changeset futures
Summary:
Create changeset uses `FuturesUnordered` and `FuturesOrdered`.  These are unbounded, so with very large changesets, we may try to do too much work at once.  Switch to `buffered` and `try_for_each_concurrent` so that we can add bounds.

As always, the numbers are somewhat arbitrary: 10 commits at a time, and up to 1000 files at a time.

Reviewed By: mitrandir77

Differential Revision: D44056862

fbshipit-source-id: 6284c207e3768ec0b16371dcd24db53afc0d98d6
2023-03-15 13:50:02 -07:00
Mark Juggurnauth-Thomas
98f52eeaf9 mononoke_api: switch to changesets_creation::save_changesets
Summary: Remove another dependency on the blobrepo crate by migrating to the underlying feature code.

Reviewed By: yancouto

Differential Revision: D44054973

fbshipit-source-id: 612de351beb2d7bffcd98cff629eb787c0184890
2023-03-15 13:50:02 -07:00
Mark Juggurnauth-Thomas
c300bfb676 scs_server: implement repo_create_stack
Summary: Implement the `repo_create_stack` method by calling `RepoContext::create_changeset_stack`.

Reviewed By: mitrandir77

Differential Revision: D44032674

fbshipit-source-id: c3bd9f320579a7c73c1dd47af2290a630aaa789d
2023-03-15 13:50:02 -07:00
Mark Juggurnauth-Thomas
930bacf080 scs_server: extract conversion of create commit parameters
Summary: Extract the code that converts create commit parameters to the internal types.  These methods will be used for creating stacks as well as for creating single commits.

Reviewed By: yancouto

Differential Revision: D44032677

fbshipit-source-id: 25aaeeb129d4523d51bfc27d375180f09c282555
2023-03-15 13:50:02 -07:00
Mark Juggurnauth-Thomas
074ef428e6 mononoke_api: allow creation of stacks of commits
Summary:
Add `create_changeset_stack` to `RepoContext` to allow creation of a stack of commits in one operation.

In addition to previous checks, we must build a stack of the accumulated changes for each of the earlier commits in the stack so that we can check that the stack is internally consistent.  For example, a file can only be deleted once in the stack, or it can be created and then deleted in the same stack.

Reviewed By: mitrandir77

Differential Revision: D44032676

fbshipit-source-id: f08a7df39c52c9de9d6efc728321112ac5ee60f8
2023-03-15 13:50:02 -07:00
Mateusz Kwapich
284370e1cb log max_poll_time
Summary:
Let's see if we have long poll problem anywhere which could *greatly*
contribute to any latency spikes.

Reviewed By: markbt

Differential Revision: D44059679

fbshipit-source-id: c8cb37d65e084de1500bee14773ca8229fb07a0c
2023-03-15 12:30:25 -07:00