Summary: And ignore *.profraw files. There are a bunch of tests failing when run w/ test coverage profiling due to these droppings.
Reviewed By: quark-zju
Differential Revision: D43986480
fbshipit-source-id: 481f88e68c09c6ed3b2903d54f03431c4a04e1c2
Summary:
Add tests to make sure we mark files NEED_CHECK properly even if the given matcher doesn't match the files. Although we try to limit work based on the matcher, we need to at least record NEED_CHECK for files reported by watchman since we will update the watchman clock in the treestate (and won't get notified about the non-matching file next time).
Note that this isn't right for ignored files which should not be tracked in the treestate by default. Will address in following diffs.
Reviewed By: quark-zju
Differential Revision: D43760941
fbshipit-source-id: f445f9576323b730e72d9df1acce2a26b8a3ef50
Summary: Fill in status_detail when the native status falls back to Python due to needing the morestatus extension.
Reviewed By: quark-zju
Differential Revision: D43626599
fbshipit-source-id: 4d4826a9a178557a7a4f649eb9ec7817bf707151
Summary: Add a parallelized FileChangeDetectorTrait impl. It is enabled by default but can be disabled by setting workingcopy.watchman-worker-count=0.
Reviewed By: quark-zju
Differential Revision: D43626598
fbshipit-source-id: b250b5dfa5552b5ee52b993731a09842cc0639f6
Summary:
I want to parallelize the work this object does, but the trait interface is serial (and synchronous):
```
pub trait FileChangeDetectorTrait {
// Check if file size and mtime are unchanged (otherwise queue "maybe changed" result).
fn has_changed(&mut self, ts: &mut TreeState, path: &RepoPath) -> Result<FileChangeResult>;
// Resolve "maybe changed" files by checking contents.
fn resolve_maybes(&self) -> Box<dyn Iterator<Item = Result<ResolvedFileChangeResult>> + Send>;
}
```
It also was a bit annoying to use because it reported results w/ two different types, so the client needed duplicate handling. The new trait allows for asynchronous processing and only returns a single kind of result:
```
// Converting to an iterator signals you are done submitting paths.
pub trait FileChangeDetectorTrait: IntoIterator<Item = Result<ResolvedFileChangeResult>> {
fn submit(&mut self, ts: &mut TreeState, path: &RepoPath);
}
```
I converted the existing concrete implementation to the new trait. It requires the object to buffer more results, but not any file data, so it shouldn't have much of an impact memory wise.
Reviewed By: quark-zju
Differential Revision: D43626597
fbshipit-source-id: 4ffcd9b870ee8a4fba94aa3972cc4e1a299ebec5
Summary: I want to share this logic w/ a different file detector architecture, so pull it out and consolidate into a single free function. This has one concrete advantage of avoiding a duplicate treestate lookup for every file. This may not be the final form, but it's easiest for me right now.
Reviewed By: quark-zju
Differential Revision: D43626600
fbshipit-source-id: 6ee4355110fc76f2542bf78d8be348e894e73cbd
Summary: Add progress bars for work we do processing the watchman (and treestate NEED_CHECK) results.
Reviewed By: quark-zju
Differential Revision: D43626601
fbshipit-source-id: f7e56543955b12a7d89ff9073fa13d2265ba948f
Summary: I thought the `get` method would return the contents of a file path as well, which is not the case. So I added a doc to that function to make the assumption explicit.
Reviewed By: quark-zju
Differential Revision: D43919690
fbshipit-source-id: 10b499e16f1910ee3ac24ef34a95f18e123a95c0
Summary: The fold action collapsed commits up to and including the working copy, but it left the working copy dirty. When it subsequently updated to the new collapsed commit, it "merged" all the files. They merge cleanly since their contents are identical, but we still invoke the merge drivers (why are we invoking merge drivers if the contents are identical?). Fix by using ctx.markcommitted() which updates the dirstate based on what was committed. And, we no longer need to do the "hg.update()" anymore since the working copy will already be on the collapsed commit.
Reviewed By: quark-zju, zzl0
Differential Revision: D43718659
fbshipit-source-id: 26865cca11feb600e21933c60ed83796212da954
Summary:
`nullid` in manifest is invalid (upstream `hg verify` will complain).
The eagerepo `filelog.cmp(nullid, b"")` returns `False` (same content),
which makes `repo.commitctx` think that the file hasn't changed and reuses the
`nullid` in manifest incorrectly.
The original `filelog.cmp(nullid,b"")` would return `True` (different content)
since it calculates the real hash and nullid does not match the real hash of
empty content.
Reviewed By: zzl0
Differential Revision: D43920391
fbshipit-source-id: 7573647440a636ff92c42192a1cf2085c892e4dd
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: markbt
Differential Revision: D43504459
fbshipit-source-id: 3980494108014d687529b77791012a3b57e84903
Summary:
This is intended to be used for ISLv2 stack editing. The command exports
related file contents.
Reviewed By: muirdm
Differential Revision: D43773252
fbshipit-source-id: c8a58c090474efb0e0a79759efc3c7c45e2a97c1
Summary:
As an [user pointed out in #544](https://github.com/facebook/sapling/issues/544), `sl` crashes when `gpg` returns an error code instead of returning a slightly more useful error message.
This diff also changes the gpg flags so that it doesn't error out due to lack of user input. Previously it would return an error 2 when it waited for user input.
Reviewed By: zzl0
Differential Revision: D43860003
fbshipit-source-id: ecfcb6f8cabb736365ea407211437c52f878f0c8
Summary: Using python native base85 encode/decode by removing old implemented reference.
Reviewed By: sggutier
Differential Revision: D43700467
fbshipit-source-id: 8bc223bd9cb0054c0f227557bea719d6f6f91165
Summary: This diff is a basic implementation of `RenameTracer` to pass the unit test added in a previous diff.
Reviewed By: quark-zju
Differential Revision: D43724672
fbshipit-source-id: 1c9bb48064371f97440b7453bb708b7c494f399c
Summary: The for-loop is only iterating the `missing_ids`, so we just need to check if `missing_ids`
Reviewed By: quark-zju
Differential Revision: D43735124
fbshipit-source-id: 557a083854899357f332b38b018fad8a973d70c5
Summary: Add a simple unit test to show how the API will be used and guide the API implementation.
Reviewed By: quark-zju
Differential Revision: D43724673
fbshipit-source-id: 6b5f126b356d7d320040b7e2d5bc61508cf064e7
Summary: In this case, the revlog could be opened, but crashed when trying to add something. Let's catch that error and nuke the undo revlogs.
Reviewed By: evangrayk, zzl0
Differential Revision: D43704364
fbshipit-source-id: 50ba67fa17b4a31676efe9b9925bdb1ff5c574ba
Summary:
Support binary content by prefixing `base85:`.
This makes it easier to produce non-utf-8 content for testing purpose.
Reviewed By: muirdm
Differential Revision: D43773249
fbshipit-source-id: a83706038bcc4865412b694966cfcb4d69c823f9
Summary: This makes the API a bit easier to use.
Reviewed By: muirdm
Differential Revision: D43773251
fbshipit-source-id: 0a6cfb1d4d8812dfda50237d0fca508a0e24a6b8
Summary: If the user hasn't configured their ui.username, I would rather the command error out instead of using <user>@<fqdn>. On Windows in particular, this default gives a very wrong user name that gets immortalized in the commit cloud workspace. It's much less toil for the user to configure the username early.
Reviewed By: quark-zju
Differential Revision: D43668690
fbshipit-source-id: 64c4e0d235b2fe2fa80c76da6e04917573989a9b
Summary:
We've had reports of users getting "cached" permission errors because the pfc/chg server process has a out-of-date list of groups cached.
Linux seems to cache groups for the lifetime of the process, but MacOS seems to update them dynamically. This check shouldn't hurt on MacOS, though.
Reviewed By: sggutier
Differential Revision: D43676809
fbshipit-source-id: 7e4439465410567d83ceeaa4ad58bd332a03a4f7
Summary:
Some time ago we started shipping Python alongside our Windows build, which means that we haven't really supported Cygwin for some time. Thus, we can remove bits of code associated with Cygwin.
The removed lines of code would never really be executed since `sys.platform` (which is what `pycompat.sysplatform` uses) always evaluates to `windows` with the Python build we ship along the Windows build. The value of `sys.platform` is determined when building the Python binary.
Reviewed By: quark-zju
Differential Revision: D43456960
fbshipit-source-id: 659eb8750602fb42f2325b7f16c5497c83ec5d32
Summary:
The revlog clone code path is incompatible with the commitgraph endpoints.
Disable the commitgraph endpoint during revlog clone to fix it.
Reviewed By: muirdm, singhsrb
Differential Revision: D43737424
fbshipit-source-id: 6f1b39faa42fd0e760c5f21682f64bb34a7a417e
Summary:
skip logging as "bad" requests for health checks
health checks are currently implemented like simple connections to the port:
```
def _test_service_is_running(ui):
port = ui.configint("commitcloud", "scm_daemon_tcp_port")
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
if s.connect_ex(("127.0.0.1", port)):
_warn_service_not_running(ui)
s.close()
```
so, skipping errors coming from json parsing for those type of checks
todo: implement a proper health_check request which can be part of migration to
json rpc
Reviewed By: quark-zju
Differential Revision: D43693235
fbshipit-source-id: 689cd3368c665fefd61a86d1125dc8d2aba1354d
Summary: A more correct version of D33745363 (d4d662b828). This makes the hgbuild output easier to look at.
Reviewed By: zzl0
Differential Revision: D43703395
fbshipit-source-id: d72180db85da51f34e0a48843e22237797146c98
Summary: This test started failing after recent Rust "chrono" crate update in D43683906 (69c6d10d30). Chrono now caches the TZ variable on unix, which defeats the test's attempt to change TZ. (The debugruntest test runner runs "hg" commands in-process for speed.) Add a "sleep 1", which is the threshold chrono uses to check for an updated TZ value. Note that the "sleep 1" is still much faster overall than the alternative of disabling the in-process hg execution.
Reviewed By: zertosh
Differential Revision: D43713144
fbshipit-source-id: 7ccedcf75db6b1b1d45dd526ee9018569e8e31f3
Summary:
This update is needed in order to update to routinator-0.12.1
(D43638969).
Deprecated methods have an `_opt` alternative. Before these panicked on
invalid values. Now they return `None` and the panic is made explicit
with `unwrap`. This diff fixes most deprecations, but not those that
require type changes.
https://github.com/chronotope/chrono/releases/tag/v0.4.23
Reviewed By: d16r
Differential Revision: D43683906
fbshipit-source-id: 07a101a148e013d98286e85d5821588a403f5e5d
Summary: The Rust status wasn't detecting files deleted while watchman wasn't running. On the following "sl status", Watchman reports "fresh instance" and gives a list of all the files on disk. We now infer deleted files by comparing the treestate and the list of files that still exist.
Reviewed By: quark-zju
Differential Revision: D43501745
fbshipit-source-id: 790ab8073e88b368e68c981afa8ca03a710d32ff
Summary: Add test demonstrating the native status failing to detect a file deleted while watchman isn't running.
Reviewed By: quark-zju
Differential Revision: D43501744
fbshipit-source-id: 717f212b58aca6c4d2f1bba2979cb1ee4f2919aa
Summary:
These tests stub out watchman and the filesystem and test NEED_CHECK bookkeeping and propagation of pending changedness.
Next I will expand the tests to cover the "fresh instance" case, which has some differences.
Reviewed By: quark-zju
Differential Revision: D43501752
fbshipit-source-id: 60031122d2ad7f4d76f4c478fbe9d426e425ec3b
Summary: Handle clock update in the outer method so we don't have to pass it around so many places.
Reviewed By: quark-zju, zzl0
Differential Revision: D43501747
fbshipit-source-id: 5e1dc7e08b1bb9d1fc4f91a23c4bd6c01ddb902a
Summary: These traits were previously used to abstract the treetate in tests, but the treestate is easy enough to work with. I think it's much simpler overall to use the concrete TreeState in code and tests (more tests to follow).
Reviewed By: zzl0
Differential Revision: D43501754
fbshipit-source-id: 6b106d0d814afbaba14b58e5f2f2fd23c519eeb6
Summary:
There isn't any parallelism, so this type doesn't make sense conceptually. It is used for convenience so various helper structs can hold a mutable TreeState without dealing with references. However, it leads to code such as the FileChangeDetector which needs to lock the mutex O(changed files) times.
Instead, let's just pass `&mut TreeState` as a parameter. The TreeState a fundamental input to most code in here, so conceptually this makes sense to me.
Reviewed By: quark-zju, zzl0
Differential Revision: D43501748
fbshipit-source-id: 3320b0dade2ffc3949e65b91b7adcb3368366d7b
Summary:
This was a container type that didn't have a cohesive purpose. Now most functionality lives in the detect_changes free method.
I will restore test coverage in a later diff once I'm done rearranging things.
Reviewed By: zzl0
Differential Revision: D43501750
fbshipit-source-id: 38904dbc996d7f64f8abc2246fe92d44e2e8cf64
Summary: And fix warnings to use stderr instead of stdout.
Reviewed By: evangrayk
Differential Revision: D43501753
fbshipit-source-id: ba44fd2aa872f1077a22dce0bf8a22d56f22ef1a
Summary:
The WatchmanState struct seems to add an unnecessary level of indirection during pending changes computation, so I want to eliminate it.
In this diff I separate out the core "compute changes given list of needs-check files" into a separate (easily testable) function.
I did not intend any behavior change except for the minor optimization where we no longer add files to "needs_mark" if they came from the treestate originally (i.e. they are already marked, don't need to mark again).
Reviewed By: quark-zju
Differential Revision: D43501751
fbshipit-source-id: e19573e62eb67d03f7ddeddfff703694951c70f6
Summary:
The watchman config fields were only used in one spot, so separate them out of the state.
I'm preparing for some more changes, probably culminating in the elimination of WatchmanState.
Reviewed By: evangrayk
Differential Revision: D43501749
fbshipit-source-id: 7e62ad10b314e1239f7fbe68fa084919bc76330f