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
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
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
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
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
Summary: Python binding for copytrace, so it can be used in Python world
Reviewed By: quark-zju
Differential Revision: D44152527
fbshipit-source-id: 233986efddb855188ce9ada6cace70a57f834b9c
Summary: Fill the missing part of DagCopyTrace::new
Reviewed By: quark-zju
Differential Revision: D44110425
fbshipit-source-id: 32f9cfc949a56eb60d5589258ae6da87ea26cb5a
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Summary: Show a warning about fifo etc. files instead of aborting the command.
Reviewed By: quark-zju
Differential Revision: D44187185
fbshipit-source-id: c4c01436ad21e4e15fcae9c5d04f1aaacc7e5c80
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
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
Summary: useful for checking if an object is in the hgcache or not
Reviewed By: quark-zju
Differential Revision: D44316641
fbshipit-source-id: f16093ec1659a8f139b88e702dbd1d8646319c8a
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
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
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
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
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
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
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
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
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
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
Summary: I need to differentiate the symlink error in the status code path.
Reviewed By: quark-zju
Differential Revision: D43970579
fbshipit-source-id: 7931f83f828352a8f5ca8f90ff037702b0c64369
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
Summary: These will help me figure out "status" discrepancies.
Reviewed By: zzl0
Differential Revision: D43970581
fbshipit-source-id: 63ef7578b6aec100b172da9516292aa549b8d318
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
Summary:
`os.fork()` (used by pfcserver) only duplicates one thread. That is problematic
for `ctrlc` because the background thread that handles the Ctrl+C won't exist
for the forked processes. Fix it by moving the ctrlc setup to after os.fork.
Reviewed By: muirdm
Differential Revision: D44048693
fbshipit-source-id: 5d4391dabb7b4fc6e3cc1e015c7d0acdb017041e
Summary:
Now when fsmonitor.track-ignore-files in the config differs from the value stored in the treestate metadata, we reset the watchman clock to trigger a fresh instance. This makes Watchman walk the repo and return all files. In turn we use this complete list to migrate the treestate to contain or not contain ignored files, depending on fsmonitor.track-ignore-files.
Note that I changed the Python logic to default to track-ignore-files=False, and to assume the absence of the flag in the treestate metadata means the treestate doesn't contain ignored files. I made this change because I didn't want Rust to default to assuming "enabled" because that would trigger a fresh instance the first time "status" is called. I don't think this will materially affect the Python behavior.
Reviewed By: quark-zju, zzl0
Differential Revision: D43789376
fbshipit-source-id: c97fcc83bb7ba2744c6be954246fa8bb499f0c32
Summary:
The main thing is to add methods to TreeState to get and set the entire deserialized metadata. The existing get_metadata_by_key would deserialize the metadata each time it was called.
I removed the Metadata type from most places. It is a wrapper type only used for serialization, so it probably shouldn't be public at all.
I also renamed set_metadata_by_keys to update_metadata, which goes better with the new set_metadata.
Reviewed By: zzl0
Differential Revision: D43970591
fbshipit-source-id: 203cc68acd6476e5e11608fb4858c9abb77ec03c