Summary: Update from 0.2.135 to 0.2.137, the latest version on crates.io, in preparation for backporting a PR in the diff after this one.
Reviewed By: zertosh
Differential Revision: D40874274
fbshipit-source-id: debf9dae82ecc20201470e634f10904a2b308e51
Summary: This updates the libc crate to 0.2.135, which includes the FICLONE constant needed to the given ioctl.
Reviewed By: justintrudell
Differential Revision: D40286796
fbshipit-source-id: acfa115479cd289f478d8d73937be34ced5c4bbb
Summary:
Move config related crates to a subdirectory to make top-level lib/ cleaner:
- configmodel -> config/model
- configparser -> config/parser (or maybe should be called "loader"?)
- configparser/pest-hgrc -> config/pest-hgrc
New crates will be added to config/ later.
Differential Revision: D39033975
fbshipit-source-id: 2b55491c3097442c0787fef33a811a809cbcb7d3
Summary:
X-link: https://github.com/facebookresearch/Private-ID/pull/71
Previous codemod left some crust. This commit cleans up useless uses to use less uses.
Reviewed By: stepancheg
Differential Revision: D38211793
fbshipit-source-id: c852dd1ec617fe81a1d9bd0d8a9e5d2357b9b502
Summary: Not sure how I missed this, but the std library exposes getpid via std::process::id().
Reviewed By: quark-zju
Differential Revision: D36016277
fbshipit-source-id: 263ffdee1b3f7132198abe340c942d0da73a1b1b
Summary: Add wrapper func to util::file that fills in mode perms for you and sets fsync=false. fsync has serious performance costs we don't want to pay normally.
Reviewed By: DurhamG
Differential Revision: D35985476
fbshipit-source-id: 96925bd89f88ed3e15ab3adf1791ebadc3fb6a73
Summary:
This is often more convenient in tests inserting &'static str. I left the String impl since I can imagine cases where borrowed data is not convenient.
I tried to make it generic, but couldn't come up with something that maintained ergonomics for users.
Reviewed By: sggutier
Differential Revision: D35985480
fbshipit-source-id: e3802c35ebd3f945692c004eb34b454e576c9195
Summary:
Context: I am upgrading rustfmt in D35234535.
---
This diff contains all the formatting changes which are idempotent between the old and the new version of rustfmt. It's generated by formatting with the new rustfmt, then formatting immediately again with the old rustfmt. If there are any big changes in here, that's code that old rustfmt used to crash on but new rustfmt handles correctly.
Separating out this part of the changes prior to flipping the rustfmt version switch globally allows the amount of code that needs to be landed atomically to be smaller, since this diff is independent and can land at any point before the rest of the stack.
---
Reviewed By: zertosh
Differential Revision: D35234531
fbshipit-source-id: 2ab036e03d602f6385992283c2b04381550ebae7
Summary:
Now the runlog infers than an hg command is "boring" if the command disables the blackbox. "boring" means the runlog won't touch the watchfile to notify VSCode, and runlog will more aggressively clean up the runlog files.
This is not a good solution, but disabling the blackbox seems to be the only indicator that commands are known spammy. We should probably introduce an explicit option like that can inform the blackbox, runlog and other things that want to separate interesting commands from spam commands.
Reviewed By: quark-zju
Differential Revision: D34979231
fbshipit-source-id: 5aa4291360b71fdab5efa97514977acb085c80e0
Summary: If an hg command determined to be "boring" and the runlog exits cleanly, the runlog now deletes the boring command's runlog entry immediately. This should help keep the number of runlog files under control.
Reviewed By: quark-zju
Differential Revision: D34979233
fbshipit-source-id: d3134fe6fd0c992cbabed16397bfde028582b235
Summary: Rename Logger::new to Logger::from_repo and add Logger::new which can create a logger directly from the required elements. This makes it easier to unit test the Logger.
Reviewed By: quark-zju
Differential Revision: D34979232
fbshipit-source-id: 0963baa7f622893b48b96c7c400c292243321ba2
Summary: I think we prefer dashes over underscores for config flags. These config values aren't actually configured anywhere, so it should be safe to change.
Differential Revision: D34592509
fbshipit-source-id: 4a5e808b492f65b3baa954ce37d66e8ab3bb5770
Summary: VSCode can't use watchman to watch the current location .hg/runlog/watchfile since watchman only lets you watch files at the top level of .hg. Move the runlog watchfile up to .hg/runlog_watchfile to compensate.
Reviewed By: DurhamG, quark-zju
Differential Revision: D34767447
fbshipit-source-id: 67f660d4255603402b0d846081db9034bced10ff
Summary: Add a "watchfile" file that gets touched only when an interesting command is written out to the runlog. "interesting" is defined as not in the runlog.boring-commands config value.
Reviewed By: quark-zju
Differential Revision: D34592501
fbshipit-source-id: f4506ca06649da6adc223990dc83ffda99541a29
Summary: Since `Repo` will soon contain more logic on its own not related to `clidispatcher`, we are moving its own crate.
Reviewed By: DurhamG
Differential Revision: D33883867
fbshipit-source-id: 94414e1e2692962bf491cc2abb4e1d3799cbcc03
Summary: Adds a field for the total of downloaded bytes and another one for the total of uploaded bytes
Differential Revision: D33344429
fbshipit-source-id: ed8a0d15f077f8b3490d5f808f2e8b6f7d674511
Summary:
This adds a top command for `hg` by leveraging `runlog`. Currently it has four columns:
- `PID`: The process ID of the mercurial command
- `PROGRESS`: In case the process has progress bars, the position of the first one divided by the total of the first one. Otherwise `-`.
- `TIME SPENT`: The number of hours, minutes, seconds, and milliseconds the process has been running for. Has the same format as the original top.
- `CMD`: The `hg` subcommand and its arguments.
By now it prints a table instead of refreshing.
Differential Revision: D33177164
fbshipit-source-id: e2a1f274ca86f392cb086fabb46ddf03c2afdadb
Summary:
The "Portions" license cannot be updated automatically. So this is a manual
update using:
sd -s 'Portions Copyright (c) Facebook, Inc. and its affiliates.' 'Portions Copyright (c) Meta Platforms, Inc. and affiliates.' `rg -l Facebook`
sd -s 'Copyright (c) Facebook, Inc. and its affiliates.' 'Copyright (c) Meta Platforms, Inc. and affiliates.' `rg -l Facebook`
Differential Revision: D33420114
fbshipit-source-id: 49ae00a7b62e3b8cc6c5dd839b3c104a75e72a56
Summary:
For invocations of `ensure!` where the argument is one of the comparison operators `==` `<=` `<` `!=` `>=` `>` and the lhs and rhs of the operator both have a `Debug` impl, we now render both sides as part of the error message.
### Example:
```
ensure!(flags.len() <= 40);
```
```
ensure!(kind == Kind::File);
```
Before:
```
Condition failed: `flags.len() <= 40`
Condition failed: `kind == Kind::File`
```
After:
```
Condition failed: `flags.len() <= 40` (99 vs 40)
Condition failed: `kind == Kind::File` (Symlink vs File)
```
Reviewed By: zertosh
Differential Revision: D32598267
fbshipit-source-id: 70fdab6d8f0e3ceceb98e651eab0a73795cadaeb
Summary:
This release helps catch places that the `anyhow!` or `bail!` macros are invoked with a missing fmt argument, such as:
```
- anyhow!("unsupported redirect operation {:?}")
+ anyhow!("unsupported redirect operation {:?}", op)
```
All instances of this in fbcode were fixed in D32266567 (2f440eac7e).
Reviewed By: wqfish
Differential Revision: D32564287
fbshipit-source-id: e9cf5a1376e6c83343de3f3c6ba2925d88334a30
Summary: The hg runlog causes every hg command to write out a runlog file (and create the runlog directory if it doesn't exist). If hg is run as root this can cause permission issues for subsequent hg commands. To mitigate this issue, the runlog feature now disables itself on unix platforms if the process's effective user id is 0 and the .hg directory is _not_ owned by root. The presumption is that if .hg is owned by root then it is normal for hg commands to be run as root.
Reviewed By: quark-zju
Differential Revision: D32368400
fbshipit-source-id: e6cbeb37e28a414a705b7a4eb350e87e34f6faf5
Summary:
This updates the existing Diem & Move crates to the latest release (1.5).
A patch was needed to make feature unification work.
- `diem-crypto` has two exclusive features "fiat" and "u64", with ["fiat"] being the default feature set
- `diem-types` depends on `diem-crypto`, but it doesn't disable the default features, so "fiat" is enabled as a result
- jellyfish-merkle uses both `diem-types` and `diem-crypto` with feature "u64" enabled. This is problematic since "u64" and "fiat" cannot coexist.
- The patch simply disables the default features from `diem-crypto` in the `Cargo.toml` of `diem-types`
The following libraries have been bumped to satisfy version selection:
1. hex: 0.4 => 0.4.3
2. proptest: 0.1 => 1.0
3. proptest-derive: 0.2 => 0.3
4. serde_json: 1.0.60 => 1.0.64
#buildmore
Reviewed By: jsgf
Differential Revision: D31842317
fbshipit-source-id: c4d75b167e32f5f004dc8ed578750d7b2c6fe0ff
Summary: Generated by `sed -i 's/edition = "2018"/edition = "2021"/' common/rust/cargo_from_buck/project_configs/*.toml` and `cargo autocargo` following the autocargo code change in D31830985 and its corresponding MSDK rebuild in D31832311.
Reviewed By: zertosh
Differential Revision: D31832698
fbshipit-source-id: db79024cad311467d5b7c13b7abedc6464f09366
Summary:
Now lower level crates such as indexedlog don't have to pull in the entire util crate.
Note that I also changed atomic_write to no longer apply the umask to the specified mode perms. Since mode perms are required to be explicitly specified, it is a bit weird to modify the perms via umask. I changed the writing of hgrc.dynamic to specify 0644 to match what its previous effective permissions were.
Reviewed By: quark-zju
Differential Revision: D31743404
fbshipit-source-id: a6cc56e1111a345b2c6d2c95c98d771ead076387
Summary: Move fsync logic from indexedlog::utils into util::file's atomic_write. It isn't obvious all the various syncing you need to do to minimize the risk of data loss.
Reviewed By: DurhamG
Differential Revision: D31733192
fbshipit-source-id: 48d7536dc783677901015c1e70b92b1f79ea5f73
Summary: This forces you to set the permissions properly. We now write the runlog files at 0644 instead of tempfile's default of 0600.
Reviewed By: DurhamG
Differential Revision: D31702359
fbshipit-source-id: 874d6676634c78aed8b0f6e918f1d839d6167bd8
Summary:
See previous diff for context. The reorders the `use` statements to make
things a bit more consistent.
Reviewed By: yancouto
Differential Revision: D31751166
fbshipit-source-id: 09c4ddba69ddeae1fc1b996d93fbfa6063e3407d
Summary:
The current rustfmt we use cannot handle `#[cfg(...)] use ...::{...}` properly.
Let's format the files that do not have `#[cfg] use` or are generated first.
The change is done by Ruby code:
list = Dir['{lib,edenscmnative}/**/*.rs'].select {|p|!File.read(p)["generated"]}
system 'rustfmt', *list
$fn = nil
reverts = `hg diff`.lines.map do |l|
$fn = l[/diff --git a\/fbcode\/eden\/scm\/([^ ]*) b\//, 1] || $fn
$fn if l[/-\s*#\[cfg/]
end.compact.uniq
system 'hg', 'revert', *reverts
Reviewed By: yancouto
Differential Revision: D31751037
fbshipit-source-id: dbe0b39e35345b7d1c54cbdf67b8aafd19df9c70
Summary: Bump in preparation for a new release
Reviewed By: brianc118
Differential Revision: D31657479
fbshipit-source-id: eeb2a08c54f6db75b6e515ca0966637f31b906a8
Summary:
Add runlog command to dump out runlog entries. Supports newline delimited JSON or plain text (currently just outputting pretty debug format).
By default it filters to only show running commands, but --all will show all commands (i.e. including exitted/crashed commands).
Reviewed By: quark-zju
Differential Revision: D31128812
fbshipit-source-id: c5b86f4717c2289a99109ba7754080084d7a3ed0
Summary:
When initializing the runlog logger, we probabilistically invoke a cleanup function to delete old log entries. Cleanup happens with a chance of runlog.cleanup_chance [0-1) (i.e. cleanup can be disabled with 0, or run every time with 1). Default chance is 0.01 or 1% of command invocations.
Cleanup iterates over each runlog file and removes it if both:
1. Can acquire shared file lock, meaning the command is no longer running, AND
2. The file's mtime is at least as old as runlog.cleanup_threshold seconds.
Reviewed By: quark-zju
Differential Revision: D31128863
fbshipit-source-id: 7cbb709ab1006e5c86aa265db4ad430db7e69741
Summary: Need this for cargo check/rust-analyzer to work.
Reviewed By: guswynn
Differential Revision: D31319911
fbshipit-source-id: ebd3fa72d8fc3667391a2067f95cab9e5f53301f