Commit Graph

8179 Commits

Author SHA1 Message Date
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
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
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
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
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
Jun Wu
1a697a202e ctrlc: move ctrlc setup to after os.fork
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
2023-03-14 12:35:19 -07:00
Muir Manders
1d91f64789 eagerepo: implement lame copy support
Summary: Add minimal pathcopies() impl that only works for direct parent/child commits. This is for legacy test compat so more tests can be migrated directly to eagerepo.

Reviewed By: quark-zju, zzl0

Differential Revision: D43839498

fbshipit-source-id: 4cee903c9d9838ee1dd013e2fbc5748c3861c444
2023-03-14 07:44:00 -07:00
Muir Manders
6429adfeb4 status: support track-ignore transition in Rust
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
2023-03-14 07:44:00 -07:00
Muir Manders
0d67de8a1d treestate: clean up metadata API a bit
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
2023-03-14 07:44:00 -07:00
Muir Manders
1e2d0449ac status: clear out empty treestate entries
Summary: After clearing the NEED_CHECK flag, delete treestate entry if all flags are empty. This cleans out untracked/ignored files that no longer exist on disk. I don't think this had an impact on correctness or performance, but we should keep things tidy.

Reviewed By: quark-zju, zzl0

Differential Revision: D43789378

fbshipit-source-id: 60777a0a2e9cef2b0dc85f96891513256dc407e1
2023-03-14 07:44:00 -07:00
Muir Manders
f5704eab84 status: fix Rust to not always track ignored files
Summary:
Previously the Rust status processed all results from watchman which meant it would insert ignored files into the treestate (as NEED_CHECK). This had no correctness issues, but probably had some performance impact.

Fix by respecting fsmonitor.track-ignore-files as to whether we should track ignored files in treestate. If it isn't enabled, we skip ignored results from watchman.

Tracking ignored files is required for complete correctness so that the files show up as "?" if they are removed from the ignore rules. We don't have fsmonitor.track-ignore-files turned on due to performance issues tracking a huge number of ignored files, but those issues may be moot now with efficient state flag based treestate walking (needs more work to enable this by default).

Reviewed By: zzl0

Differential Revision: D43789377

fbshipit-source-id: 43630bd3e8bc6b1e43ea20b8c8bd75057bece30c
2023-03-14 07:44:00 -07:00
Muir Manders
922d1491fc workingcopy: don't pass TreeState to FileChangeDetector
Summary: Now that normalized_get() is available on the TreeState, it's less important to let the FileChangeDetector query the treestate. Further, I want to add some logic based on the treestate entry to watchmanfs, and having the caller pass it in means the caller will have it in-hand to use without a redundant query.

Reviewed By: zzl0

Differential Revision: D43970587

fbshipit-source-id: 9b7e7cdeb5654f0fabd5854115af572c32ddd833
2023-03-14 07:44:00 -07:00
Muir Manders
a12a8b9871 treestate: build normalized "get" into treestate
Summary: It saves some allocations and annoyance to have a single method that normalizes the path and fetches the treestate value.

Reviewed By: zzl0

Differential Revision: D43970580

fbshipit-source-id: 4ef7a53cb73736a43f674fa37ee5837d5e952e3c
2023-03-14 07:44:00 -07:00
generatedunixname89002005307016
20a93deb1a Add annotations to eden/scm/edenscm/ext/extlib/phabricator/diffprops.py
Reviewed By: muirdm

Differential Revision: D44054873

fbshipit-source-id: 85836156d0d77d66a879a16e438aaf3d4bafda81
2023-03-14 07:00:16 -07:00
Zhaolong Zhu
919005a88a copytrace: implement find_renames API
Summary:
Added `find_renames`API, this method will find renames files between two commits (TreeManifest). This will be used in the `trace_rename_XXX` APIs to trace the rename history.

```
rename history → loop {
    narrow down to one commit
    find_renames for one commit # compare current commit and previous commit
}
```

Reviewed By: quark-zju

Differential Revision: D43933932

fbshipit-source-id: d83f1c594ebcf8283a3b0a3aa9d9290d0b95d5ed
2023-03-14 06:46:26 -07:00
Zhaolong Zhu
9a62700aaf scmstore: fix clippy warning by deriving default method
Summary: as title

Reviewed By: quark-zju

Differential Revision: D43920386

fbshipit-source-id: 3662d2174613a4ae1cc0e90e036e1028eda6750f
2023-03-14 06:46:26 -07:00
Zhaolong Zhu
6dfd082be4 storemodel: add 'read_rename_metadata' method
Summary: Add `read_rename_metadata` method to `ReadFileContents` trait, so we can read the `rename` info from a file. This will be used in the `find_renames` API in following diffs.

Reviewed By: quark-zju

Differential Revision: D43919689

fbshipit-source-id: 00bc5bdd3563b62a6740aa3fbd5eabe2e8c7e29c
2023-03-14 06:46:26 -07:00
Zhaolong Zhu
fd33687c28 eagerepo: fix read_file_contents to strip out copy from info
Summary:
As discussed [here](https://www.internalfb.com/diff/D43919689?dst_version_fbid=866459527982482&transaction_fbid=935188947842029), eagerepo file's copy_from header is after the p1, p2 prefix, but `get_content(id)` only removes p1, p2 prefix, which vialates the contract of the read_file_contents API https://fburl.com/code/0z0kaxig

This diff strips the copy_from header from the file content.

Reviewed By: muirdm

Differential Revision: D43972516

fbshipit-source-id: a28db20eace8ef980bfa00a3babd362e780f5873
2023-03-14 06:46:26 -07:00
Muir Manders
b31704fa68 pr submit: prefer default-push when pushing commits
Summary: If a user cloned the upstream repo then added their fork as "default-push", we would still try pushing commits to the "default" upstream repo. With this change, we prefer "default-push" when pushing commits.

Reviewed By: zzl0

Differential Revision: D43919071

fbshipit-source-id: fc1ab73ba8ff0b5aee3e34fdf92f8969b9269650
2023-03-13 21:33:40 -07:00
Muir Manders
6c558fc4e4 git: add some Git username validation
Summary:
Having imbalanced or otherwise invalid "<" or ">" in your username messes things up when pushing commits to a Git server. Let's add some basic validation and trigger it before we create Git commits.

Updates #535

Reviewed By: zzl0

Differential Revision: D43926284

fbshipit-source-id: 9a8bc90af5dbff471fbc3083df2be9190c36a611
2023-03-13 20:50:56 -07:00
Zhaolong Zhu
66a60d93bf storeutil: move 'strip_metadata' to a separate crate for reuse
Summary:
Move 'strip_metadata' to a separate create to we can use it in other
crates, for example, we will need it in eagerepo in the following diffs: D43972516, D43919689.

Reviewed By: muirdm

Differential Revision: D43972373

fbshipit-source-id: d8a91eb21229967e37fdae5da9ef8f1baf050b2c
2023-03-13 19:41:12 -07:00
generatedunixname89002005307016
57367c72a7 Add annotations to eden/scm/edenscm/ext/schemes.py
Reviewed By: zzl0

Differential Revision: D43977581

fbshipit-source-id: daa3f2cb56fe3e8a04966e2efbef587d81fbc6d9
2023-03-13 13:02:35 -07:00
generatedunixname89002005307016
0797b0ec59 Add annotations to eden/scm/edenscm/mutation.py
Reviewed By: zzl0

Differential Revision: D44003865

fbshipit-source-id: 8b7f64776943ed554b14618bfef88e855a4e3672
2023-03-13 13:01:38 -07:00
generatedunixname89002005307016
ed3e28047c Add annotations to eden/scm/edenscm/ext/remotefilelog/constants.py
Reviewed By: zzl0

Differential Revision: D44021970

fbshipit-source-id: 7bdcf76e0532f9bc37f3b3c0630b64fd94ed9f8c
2023-03-13 12:11:49 -07:00
generatedunixname89002005307016
5ffd8ff3dc Add annotations to eden/scm/edenscm/ext/commitextras.py
Reviewed By: zzl0

Differential Revision: D44010635

fbshipit-source-id: d53c3639fe697f223bb59712fa900bcc03259af1
2023-03-13 12:10:42 -07:00
Muir Manders
26186f37c7 tests: add default gitignore file
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
2023-03-10 15:57:03 -08:00
generatedunixname89002005307016
7c9dfd7fbc Add annotations to eden/scm/ghstack/logs.py
Reviewed By: muirdm, quark-zju

Differential Revision: D43943656

fbshipit-source-id: 61cbb662e5d60a7d4c4e7e85ff7035b6ccca7305
2023-03-10 15:27:06 -08:00
generatedunixname89002005307016
7566b650d5 Add annotations to eden/scm/edenscm/ext/progressfile.py
Reviewed By: muirdm, quark-zju

Differential Revision: D43813730

fbshipit-source-id: 3117ad1465e0e101f366d46464701c6d39450c0d
2023-03-10 15:19:23 -08:00
generatedunixname89002005307016
8961e854e2 Add annotations to eden/scm/edenscm/i18n.py
Reviewed By: muirdm

Differential Revision: D43657007

fbshipit-source-id: e4ae609752066afddb72a8f6c88cbe67be151eb6
2023-03-10 15:13:32 -08:00
Katie Mancini
260c64e8a7 unbreak mac eden tests allow Bytes and String in c-python code
Summary:
previously the eden tests on my M1 were crashing with this err:

```
HgError: Command [/usr/local/bin/hg --traceback commit -m test foo/new.txt] failed with status -6
stderr:
  Assertion failed: (PyBytes_Check(str_obj)), function _asciitransform, file eden/scm/edenscm/cext/charencode.c, line 181.
```

after debugging this seems to come from the filefoldmap code path:
https://www.internalfb.com/code/fbsource/[6f287df44cebb45baecc1920c86a9aade0a537b6]/fbcode/eden/scm/edenscm/dirstate.py?lines=1599

The issue is that the keys of the dirstate are str objects where the c code in
_asciitransform expects them to be bytes.

notably intel does not seem to trip over this assertion, so the assertion only
seems to happen on arm.

not sure why the assertion only happens there. but anyways ...

We cannot transform the string to bytes in python, because we are not able to
iterate the map in python: https://www.internalfb.com/code/fbsource/[6f287df44ceb]/fbcode/eden/scm/edenscm/eden_dirstate.py?lines=53-70

So we need to make this c function support strings (or at least something in the
c layer support strings).

That's what we are doing here.

We probably could get rid of the support for bytes in this function because ...

There are multiple code paths that call into this function with bytes. There's
this one: https://www.internalfb.com/code/fbsource/[6f287df44cebb45baecc1920c86a9aade0a537b6]/fbcode/eden/scm/edenscm/posix.py?lines=661

but that is doing a conversion from bytes to string right before calling.

and these ones that are dead code paths: https://www.internalfb.com/code/fbsource/[6f287df44cebb45baecc1920c86a9aade0a537b6]/fbcode/eden/scm/edenscm/encoding.py?lines=278%2C300

The first could use string and the second can probably be deleted since we are
on python 3 now: https://www.internalfb.com/code/fbsource/[6f287df44cebb45baecc1920c86a9aade0a537b6]/fbcode/eden/scm/edenscm/encoding.py?lines=489%2C509%2C512%2C516-518

I'll leave it up to the mercurial folks if you want to pursue that option.

Muir and I also looked to see if we could delete the c code altogether, but
that's a bit complicated because python can't iterate an eden dir state, and
this code implicitly uses the c code to iterate the dir state for the python
code. So the python needs to grow the ability to iterate the dirstate, or
larger chunks of this code need to be refactored, I think.

For now I am making the minimal change to get the eden tests running on mac.

Reviewed By: quark-zju, xavierd

Differential Revision: D43962468

fbshipit-source-id: 6145aae4b812f21b7561515544fd7aef956f4e0b
2023-03-10 13:17:34 -08:00
Muir Manders
93c5c35ed9 workingcopy: add more matcher tests for watchman status
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
2023-03-10 10:25:44 -08:00
Muir Manders
361c3de27c status: add status_detail for morestatus fallback
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
2023-03-10 10:25:44 -08:00
Muir Manders
2de7187785 status: parallelize file metadata/content comparison
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
2023-03-10 10:25:44 -08:00
Muir Manders
c2ffc8fedf workingcopy: make FileChangeDetectorTrait parallel friendly
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
2023-03-10 10:25:44 -08:00
Muir Manders
50e95e2756 workingcopy: pull logic out of FileChangeDetector
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
2023-03-10 10:25:44 -08:00
Muir Manders
ed85fe74d7 status: add progress bars for watchman processing
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
2023-03-10 10:25:44 -08:00
Zhaolong Zhu
0b3880c566 storemodel: add doc for 'TreeStore.get' method
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
2023-03-10 06:22:34 -08:00
Muir Manders
f425cf9998 histedit: avoid pointless merge for "fold"/"roll"
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
2023-03-08 15:21:58 -08:00
Xavier Deguillard
990a7c50a7 Back out "Expose seeded_blake3 hash for file data through trees and files endpoint"
Summary:
This broke EdenFS.

Original commit changeset: 398049410801

Original Phabricator Diff: D43504459

Reviewed By: fanzeyi

Differential Revision: D43918233

fbshipit-source-id: 4598bbc8f981b95aac3bce8a387c4df4dd6c73c9
2023-03-08 14:50:25 -08:00
Jun Wu
835df38705 eagerepo: avoid nullid in manifest when creating files
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
2023-03-08 14:14:25 -08:00
Rajiv Sharma
0664733b44 Expose seeded_blake3 hash for file data through trees and files endpoint
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
2023-03-08 04:53:38 -08:00
Jun Wu
a2f185cca6 debugexportstack: command to export information of a stack
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
2023-03-07 14:42:13 -08:00
Saul Gutierrez
fd59a83495 make error message with gpg more informative
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
2023-03-07 13:38:13 -08:00
Shyam Sunkari
75bb37ca25 delete references to b85decode/b85decode
Summary: Using python native base85 encode/decode by removing old implemented reference.

Reviewed By: sggutier

Differential Revision: D43700467

fbshipit-source-id: 8bc223bd9cb0054c0f227557bea719d6f6f91165
2023-03-07 09:57:27 -08:00
Zhaolong Zhu
922f62da53 copytrace: implement RenameTracer API
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
2023-03-06 18:09:02 -08:00
Zhaolong Zhu
27c880b85c pathhistory: check 'missing_ids' instead of 'ids'
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
2023-03-06 18:09:02 -08:00
Zhaolong Zhu
6e02916535 copytrace: add simple unit test for RenameTracer API
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
2023-03-06 18:09:02 -08:00
Muir Manders
810487e4eb undo: catch another type of revlog error
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
2023-03-06 16:58:09 -08:00
Jun Wu
1238c625ba drawdag: support binary content
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
2023-03-06 10:23:37 -08:00
Jun Wu
9f36d40a7b localrepo: expose tonodes in dageval
Summary: This makes the API a bit easier to use.

Reviewed By: muirdm

Differential Revision: D43773251

fbshipit-source-id: 0a6cfb1d4d8812dfda50237d0fca508a0e24a6b8
2023-03-06 10:23:37 -08:00
Zhaolong Zhu
384f91fe66 pathhistory: fix a typo (Split -> Skip)
Summary: as title

Reviewed By: quark-zju

Differential Revision: D43724674

fbshipit-source-id: d1c09dd90476386f986c44a23f6957ea44226af4
2023-03-03 13:10:04 -08:00
generatedunixname89002005307016
f22332f3fe Add annotations to eden/scm/edenscm/tracing.py
Reviewed By: zzl0

Differential Revision: D43768569

fbshipit-source-id: b54f50c1b0e6f97a02954249c7ad6d30eb1613ba
2023-03-03 13:07:30 -08:00
Muir Manders
c25eab9a68 ui: don't default username to <user>@<fqdn>
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
2023-03-02 22:10:45 -08:00
Muir Manders
49ee17f2bf pfc: restart server if groups have changed
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
2023-03-02 18:50:04 -08:00
Muir Manders
e26e09399d tests: fix a couple tests that fail w/ new Git version
Summary:
- Suppress new output from "git bisect" in test-fb-ext-scm-prompt-git.t
- Defeat CVE-2022-39253 security precaution in test-git-submodule-loop.t by configuring protocol.file.allow.

Reviewed By: quark-zju, sggutier

Differential Revision: D43752573

fbshipit-source-id: 2078f2f7e41e29bf59806e8a6a1d8c764dd5e5ae
2023-03-02 16:52:30 -08:00
Saul Gutierrez
8d5b35b873 symlinks: remove support for cygwin
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
2023-03-02 13:14:36 -08:00
Muir Manders
b48f524832 fix some compilation warnings
Summary:
- Fix a couple deprecation warnings related to chrono upgrade.
- Kill some unused fields.

Reviewed By: zzl0

Differential Revision: D43713142

fbshipit-source-id: ff04860b02b5dc881f39b0587ef9eb47f96015a2
2023-03-02 13:08:50 -08:00
generatedunixname89002005307016
22354fff97 Lint failure adding annotations to eden/scm/edenscm/ext/snapshot/metalog.py
Reviewed By: quark-zju

Differential Revision: D43694465

fbshipit-source-id: d915ff6a518be1ec851562a51e128db16c42a3a9
2023-03-02 10:37:53 -08:00
Jun Wu
1aa1135c88 clone: disable http commitgraph during revlog clone
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
2023-03-02 08:52:49 -08:00
Liubov Dmitrieva
7a7e8c0d57 skip logging of bad requests for health checks
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
2023-03-02 00:11:20 -08:00
Liubov Dmitrieva
d0f57e2736 remove unused param
Summary: remove unused param

Reviewed By: quark-zju

Differential Revision: D43693892

fbshipit-source-id: 1dc81af183143fb36b8b5abbdbc4008d51f89a2a
2023-03-02 00:11:10 -08:00
Jun Wu
9d091e0692 github: do not show "marked 0 commits as landed"
Summary: It's pointless and noisy.

Reviewed By: zzl0

Differential Revision: D43704688

fbshipit-source-id: 65b79192de24b4596932c66ec0185e20986cdcf1
2023-03-01 20:06:45 -08:00
Jun Wu
40d0630562 runtests: do not show # ignored not retesting
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
2023-03-01 20:06:45 -08:00
Muir Manders
001508c294 tests: fix test-parse-date.t
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
2023-03-01 15:41:23 -08:00
Andres Suarez
69c6d10d30 Update to chrono-0.4.23
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
2023-03-01 05:04:16 -08:00
Muir Manders
3ea230861e status: detect deleted files after watchman restart
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
2023-02-28 16:44:15 -08:00
Muir Manders
0277b1e1b8 status: add failing test for watchman fresh instance bug
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
2023-02-28 16:44:15 -08:00
Muir Manders
d6d38a4d18 workingcopy: add new watchmanfs unit tests
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
2023-02-28 16:44:15 -08:00
Muir Manders
a1cef39240 workingcopy: simplify watchman clock propagation
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
2023-02-28 16:44:15 -08:00
Muir Manders
b02faa5be3 workingcopy: get rid of treestate abstraction
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
2023-02-28 16:44:15 -08:00
Muir Manders
153d42fe7e workingcopy: reduce usage of Arc<Mutex<TreeState>>
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
2023-02-28 16:44:15 -08:00
Muir Manders
0d7f453ef3 workingcopy: eliminate WatchmanState
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
2023-02-28 16:44:15 -08:00
Muir Manders
213d493d01 workingcopy: pull watchman warnings into separate function
Summary: And fix warnings to use stderr instead of stdout.

Reviewed By: evangrayk

Differential Revision: D43501753

fbshipit-source-id: ba44fd2aa872f1077a22dce0bf8a22d56f22ef1a
2023-02-28 16:44:15 -08:00
Muir Manders
6e59087375 workingcopy: further pull logic out of WatchmanState
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
2023-02-28 16:44:15 -08:00
Muir Manders
1688dc397c workingcopy: pull config out of WatchmanState struct
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
2023-02-28 16:44:15 -08:00
Muir Manders
5190f19c02 status: fix fsmonitor.timeout to be seconds
Summary: Apparently 600ms is typically sufficient because no one complained!

Reviewed By: zzl0

Differential Revision: D43501746

fbshipit-source-id: e22cc2650fc0ca84a42090a863b924ac7a6b595e
2023-02-28 16:44:15 -08:00
Liubov Dmitrieva
cc44f80905 remove unused import
Summary: remove unused import

Reviewed By: quark-zju

Differential Revision: D43659296

fbshipit-source-id: 04016e223acd925bcaa46870e739105da23144b5
2023-02-28 12:17:33 -08:00
Liubov Dmitrieva
2bc81b614e tidy up the logic for updating backup state
Summary:
tidy up the logic for updating backup state

this is to fix that we call the update twice for cloud joins, also fixing

devel-warn: excess usage of repo.__contains__ at: /opt/fb/mercurial/edenscm/ext/commitcloud/sync.py:518 (<listcomp>)

warning

Reviewed By: quark-zju

Differential Revision: D43659249

fbshipit-source-id: 927e53b0c9f8640446a2a2173450e42ce5947e4c
2023-02-28 12:12:31 -08:00
Jun Wu
147558b5dc mutation: add parameters to getdag
Summary: The Rust `getdag` supports some options. Expose them in the Python `getdag`.

Reviewed By: evangrayk

Differential Revision: D43196294

fbshipit-source-id: b78153b8fd1b65f935aefd1608f7ec90891a4bc5
2023-02-28 11:45:31 -08:00
Muir Manders
a6d6d99e52 commit: add progress bar committing files
Summary:
Add a progress bar as we are committing files. This can take a long time with a large amount of files.

Also add a per-file progress bar to addremove (only for the "add" part).

Reviewed By: quark-zju

Differential Revision: D43664269

fbshipit-source-id: 7de3f82f142e3053c39ba1abd02bfdcab1a736ef
2023-02-28 11:29:25 -08:00
Muir Manders
1c83391f6e manifest-tree: reimplement BfsIter
Summary:
Re-implement the BfsIter using a thread pool. This fixes two important problems with the async stream version:

1. With the old BfsIter, each level of search would wait 1+1=2ms if there wasn't enough data to fill the chunks (see chunks_timeout). This meant using an ExactMatcher to bulk fetch a short list of paths would have unavoidable overhead of 20ms+, depending on the depth of the paths.
2. The old BfsIter stream pipeline was not being torn down correctly. It was leaking threads that were keeping references to the store alive, which in turn caused the TreeStore to not flush its caches since it never got dropped. I also think it is responsible for some of the file descriptor leaks.

The new implementation seems to also be faster for big walks. I tested using mf.walk() with a large sparse profile matcher. The old BfsIter was ~27s, and the new is ~21s. Both take around 4s with caches hot.

For the ExactMatcher case, in my repo w/ caches hot the old BfsIter took ~25ms and the new takes ~1ms. This will shave off a good chunk from the native status time, which hits the BfsIter for files not found in the dirstate.

Reviewed By: quark-zju

Differential Revision: D43622477

fbshipit-source-id: 5abde6025405d06170b31ed65ccef4990d9f5474
2023-02-28 09:34:42 -08:00
Muir Manders
785ed6cb74 fold: don't restack unrelated predecessors
Summary: Previously fold would do a full restack, rebasing all descendants of all predecessors. A full "fix everything" restack doesn't really make sense when the command itself just created the successor. Instead, now fold only rebases descendants of direct predecessors.

Reviewed By: zzl0

Differential Revision: D43660708

fbshipit-source-id: 6802343712ec6e8b2bebd587d7545a6667778947
2023-02-28 09:22:50 -08:00
Saul Gutierrez
b671ca71f4 ci: bump homebrew release dependencies (#540)
Summary:
In order to create a new release we need to make the specific Python version (e.g., 3.11.1) match with whatever GitHub actions has. This is necessary it's not seemingly possible to downgrade the Python version used in GitHub actions.

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

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

Test Plan:
Tested that the "Prepare build environment" step completed successfully.

Before:
https://github.com/sggutier/sapling/actions/runs/4287166710/jobs/7467689953

After:
https://github.com/sggutier/sapling/actions/runs/4287626954/jobs/7468705930

Reviewed By: evangrayk

Differential Revision: D43640261

Pulled By: sggutier

fbshipit-source-id: 0e50d8171c261ea5a6691ca52f012780a67ae88a
2023-02-27 17:28:12 -08:00
generatedunixname89002005307016
a91985ee63 Add annotations to eden/scm/edenscm/ext/conflictinfo.py
Reviewed By: sggutier

Differential Revision: D43622583

fbshipit-source-id: 5a1c45532ae987d8956ab24833f1919796e5795a
2023-02-27 15:41:51 -08:00
generatedunixname89002005307016
d60be1a5d5 Add annotations to eden/scm/edenscm/pure/parsers.py
Reviewed By: sggutier

Differential Revision: D43605075

fbshipit-source-id: 678e8124798190f91a7d6428c4b631cc13ad9201
2023-02-27 15:41:08 -08:00
Zhaolong Zhu
b75037a4f5 progress: filter out empty string
Summary:
Currently, the `render` function always return a non empty Vector, even for an empty string (shown as below), this behavior triggered a deadlock bug in `hg continue` (potentially other places as well when trying to lock a Rust mutex while holding the GIL), D43605596 fixed the bug.

```
lib/hgcommans/src/run.rs:458] &changes = [
    Text(
        "",
    ),
]
lib/hgcommands/src/run.rs:459] &last_changes = []
```
The non-empty vector makes many comparison checks fail, for example, [this logic](https://fburl.com/code/75u6gvuj) will never be executed, since `changes.is_empty()` is always `true`.

```
// Fast path: empty progress, unchanged.
if changes.is_empty() && !inner.progress_has_content {
    return Ok(());
}
```

This diff filters out empty strings from the Vector.

Reviewed By: sggutier

Differential Revision: D43611776

fbshipit-source-id: 67c07570dcd2176f05b8ab787a9f4860ea40a8c0
2023-02-27 13:36:02 -08:00
Zhaolong Zhu
e424f00ee6 continue: fix deadlock in hg continue
Summary:
The current `hg continue` works like below:

* `hg continue` call flow is like: Rust (`hg continue`) -> Python (convert to `hg rebase --continue`) -> Rust (`dispatch`) -> Python.
* when Python calling Rust with `hg rebase --continue`, it wraps `stdin`, `stdout`, `stderr` in `WrappedIO` as Python object. https://fburl.com/code/iq3rwndu
* `WrappedIO`'s methods require Python's GIL lock. https://fburl.com/code/zzbxffgg

We have two threads:

* Thread 1: background progress thread
* Thread 2: normal command execution thread

Deadlock happens when trying to lock a Rust mutex while holding the GIL:

* Thread 2 acquires the GIL
* Thread 1 locks a mutex (iostate)
* Thread 1 acquires the GIL, blocks (Thread 2 has the GIL lock)
* Thread 2 tries to locks the mutex, blocks (Thread 1 has the mutex)

This diff removes the reuse of Python object and reuses Rust's main io.

Reviewed By: quark-zju

Differential Revision: D43605596

fbshipit-source-id: ce9d8672a42635c57d00fe2b4e5eb9f50c885ec0
2023-02-27 13:36:02 -08:00
generatedunixname89002005307016
131234e5a9 Add annotations to eden/scm/edenscm/discovery.py
Reviewed By: quark-zju

Differential Revision: D43596957

fbshipit-source-id: cac357e465497f9e3de05f5b660866d6a1f411c3
2023-02-27 12:40:11 -08:00
Liubov Dmitrieva
785bbbebdf remove redundant code
Summary:
remove redundant code

heart beats are now processed inside the library and the removed code is never
called

Reviewed By: zzl0

Differential Revision: D43624385

fbshipit-source-id: 15b5881a4ac0d35fbfbbb7bc3a3a3099d2f950cb
2023-02-27 12:20:41 -08:00
Liubov Dmitrieva
f9d35b55ae fix error handling in tcp reciever introduced by D43153574
Summary:
fix error handling in tcp reciever introduced by D43153574 (eefeafe420)

after D43153574 (eefeafe420) every incorrect input would terminate the tcp receiver and ? in
main function would terminate the CommitCloud WorkspaceSubscriberService.

As a result, we see the errors like these:

(https://streaming-graph.facebook.com/stream/commitcloud_live_updates?workspace=user%2Fliubovd%2Fdefault&repo_name=configerator%3D%3D&token_type=cat): error trying to connect: dns error: task 80 was cancelled. Continue...

#shipit

Reviewed By: sggutier

Differential Revision: D43623506

fbshipit-source-id: 8afc88b865b7346804eabec581cf833c148a9062
2023-02-27 12:20:41 -08:00
Muir Manders
8158d3d7da clone: reconcile rust and Python URL scheme handling
Summary:
Previously the Rust clone was disabled in Sapling mode since the Rust clone thought it could handle any URL scheme other than "file" and "ssh", but that wasn't true for https Git URLs, among others.

Invert Rust's logic to a supported list of schemes instead of unsupported schemes. In particular, support "mononoke" and eagerpo schemes "eager" and "test".

Reviewed By: quark-zju

Differential Revision: D43291978

fbshipit-source-id: 78656e0584c362aa9ae693535376f1026307e9ee
2023-02-27 10:32:57 -08:00
Muir Manders
bbfdcf24cb schemes: basic support for custom schemes in Rust
Summary:
Support resolving a given URL based on presence of custom "schemes" in config.

Kill special "fb" handling repo_name_from_url in favor of proper scheme support.

Reviewed By: quark-zju

Differential Revision: D43329356

fbshipit-source-id: 8f8cddcf2f77fdc9382e0d031ecb8d6cf4518d12
2023-02-27 10:32:57 -08:00
Liubov Dmitrieva
83e03754e3 use batch text fetching for fetching dates
Summary:
use batch text fetching for fetching dates rather than single revlog
edenapi requests in a loop

follow up for D43572943 (008e88081a)

#shipit

Reviewed By: RajivTS

Differential Revision: D43619158

fbshipit-source-id: b22df9df2fb298ff6e4113a81c6b3e163cd88175
2023-02-27 09:48:30 -08:00
Zhaolong Zhu
adeadd4793 copytrace: add CopyTrace trait
Summary: Add `CopyTrace` trait, these are the core APIs.

Reviewed By: quark-zju

Differential Revision: D43554313

fbshipit-source-id: d067650482151ae8073f030709ab0b929b0fd823
2023-02-27 07:42:35 -08:00
Zhaolong Zhu
da44cd90cd pathhisotry: add RenameTracer API
Summary: Added `RenameTracer` API, this will be similar to `PathHistory` excerpt that we will only care about file path (not the content id) when searching segmented changelog.

Reviewed By: quark-zju

Differential Revision: D43554314

fbshipit-source-id: ee4e7eb480750b982770631fc8d19e14c94d4c5b
2023-02-27 07:42:35 -08:00
generatedunixname89002005307016
7b32c8fbe7 Add annotations to eden/scm/edenscm/ext/drop.py
Reviewed By: quark-zju

Differential Revision: D43568485

fbshipit-source-id: a93b28fee6aa3a0b7b274ff0615727b3068839aa
2023-02-24 11:48:41 -08:00
Zhaolong Zhu
86e63feb16 pathhistory: update outdated doc
Summary: there is no `first` parameter in the API, deleted the corresponding comment.

Reviewed By: quark-zju

Differential Revision: D43554315

fbshipit-source-id: 62b6de2a885705bef3e1d410bc98c42792dcd7f3
2023-02-24 10:51:47 -08:00
Liubov Dmitrieva
008e88081a reduce number of revlog requests
Summary:
reduce number of revlog requests as much as possible

basically, make it no more than number of commit cloud bookmarks that point to
the known public nodes in the repo

the idea behind this diff is to check phases before calling any ctx = unfi[cloudnode], where the revlog request is made

Reviewed By: markbt

Differential Revision: D43572943

fbshipit-source-id: 6e3a30d651b6de3ff83a335bc203ba1206ab27d1
2023-02-24 10:18:05 -08:00
Saul Gutierrez
fe0db11be9 phrevset: support configerator
Summary: As title mentions

Reviewed By: quark-zju

Differential Revision: D43556258

fbshipit-source-id: 192f8dac6e32f0b1e57cad4f1dbb011ca8f76fb9
2023-02-24 09:46:26 -08:00
generatedunixname89002005367269
fb2d24a961 Daily arc lint --take BLACK
Reviewed By: zsol

Differential Revision: D43566530

fbshipit-source-id: 1398be613ae1533642de31d8b4ed34958005b08e
2023-02-24 09:23:00 -08:00
Liubov Dmitrieva
73599e28aa change order in revset
Summary:
change order in revset

in my repo the current version takes 167.76 sec (missing head len is 1 commit)
vs almost instant if I reoder

it is not only extremely slow but also does some remote requests

I checked other places and it seems draft() goes first in several other places,
so reorder here as well

Reviewed By: mzr

Differential Revision: D43568675

fbshipit-source-id: 2397f90f9cb8156250fb951d948ce710071349b2
2023-02-24 07:11:20 -08:00
Liubov Dmitrieva
4b6f3b77aa fix double calculation
Summary:
this line gets evaluated twice

```
<here in len>
    skipknowncheck = len(draftrevs) == len(missingheads)
<inside the function calculated again from scratch>
    newuploaded, failed = edenapi_upload.uploadhgchangesets(
        repo, draftrevs, force, skipknowncheck
    )
```

Reviewed By: markbt, mzr

Differential Revision: D43568570

fbshipit-source-id: 98bbad4c77a15da445fbde58b056ba86453568af
2023-02-24 07:11:20 -08:00
Liubov Dmitrieva
1282bded39 log from what version to what version the local state has been changed
Summary:
log from what version to what version the local state has been changed

this is nice for debugging, currently we don't log what the previous local
version was

Reviewed By: markbt

Differential Revision: D43568053

fbshipit-source-id: fee2baf6c2c47bb01b3185a91a983cedd367c990
2023-02-24 05:37:40 -08:00
Igor Makaruks
8060c8b86e - Restart Subscriptions Fix
Summary: This diff adds a timeot to `reqwest-eventsource` `poll` so that we could exit running tasks when `interrupt` has been set to `true`.

Reviewed By: liubov-dmitrieva

Differential Revision: D43534730

fbshipit-source-id: 0f924a5c669f31540acab29d549f55091cd02485
2023-02-24 00:42:32 -08:00
generatedunixname89002005307016
41541a3cc8 Add annotations to eden/scm/edenscm/commands/debugdirs.py
Reviewed By: quark-zju

Differential Revision: D43534378

fbshipit-source-id: 4ddcdb323ff6c7b87ce76e65895ed625a3cd3c9d
2023-02-23 19:15:34 -08:00
Jun Wu
6c19d99424 tests: add a way to track legacy repo formats in tests
Summary: This allows us to track how many tests are using legacy formats.

Reviewed By: sggutier

Differential Revision: D43546411

fbshipit-source-id: df0d711205ebc1d223c8f70cdbd65803bda4b3b9
2023-02-23 19:02:58 -08:00
Saul Gutierrez
b573755c02 make sl web work on dev mode
Summary:
[Some OSS users](https://github.com/facebook/sapling/issues/521) had some issues launching `hg web` after following the instructions we provide in the website.

This was caused by the command trying to launch the `../../edenscm-isl/isl` script, which only exists if `sl` is installed. If one compiled sl using something like `make oss`, it would instead be located at `../../../addons/isl`. This commit changes the prefix based on whether `sl` was compiled in dev mode or not.

Additionally, this makes `sl web` launch `isl` directly via node instead of using some of the two wrapper scripts created when building ISL.

Reviewed By: evangrayk

Differential Revision: D43288130

fbshipit-source-id: 2ff5e6f25fefe80213e2315bea5676bd55f93dcf
2023-02-23 17:31:01 -08:00
Mark Shroyer
33ba7d3fac Remove Cargo.lock on make clean (#534)
Summary:
[sapling] Remove Cargo.lock on `make clean`
The help text for `make clean` says:

> remove files created by other targets
> (except installed files or dist source tarball)

So I'd expect it to remove any non-installed built state like Cargo.toml.

Concretely, I was surprised by this behavior when the build failed after
pulling in updates, even after running `gmake clean`.  My Cargo.lock from a
previous build had pinned the watchman_client crate to an old version, but the
updated workingcopy crate relied on the addition of `BytesNameField` to
watchman_client@main.

I think it would be better if autocargo generated a Cargo.lock for us from the
Buck versions of dependencies, but as long as it's being generated as a build
artifact it should be removed by `make clean`.

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

Test Plan:
```
% cd eden/scm
% gmake oss
% ls Cargo.lock
Cargo.lock
% gmake clean
% ls Cargo.lock
% ls: Cargo.lock: No such file or directory
```

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

Reviewed By: quark-zju

Differential Revision: D43478239

Pulled By: mshroyer

fbshipit-source-id: 2c472a0e1d86c85994191e242337dab8249bafaa
2023-02-23 11:19:12 -08:00
Jeremy Fitzhardinge
8dc7582f4b third-party/rust: remove memmap and migrate to memmap2
Summary:
`memmap` is unmaintained and hasn't been changed in over 4 years. `memmap2` is
a fork, which is regularly maintained.

Also bump dependency on `grep` as it removes the last third-party internal
reference to memmap.

Reviewed By: dtolnay

Differential Revision: D43486158

fbshipit-source-id: f763848bd295facf60ec601620afd68dfc655bea
2023-02-23 09:28:19 -08:00
Jeremy Fitzhardinge
262ebf7e40 third-party/rust: add experimental feature to zstd
Summary: Exposes useful bits.

Reviewed By: zertosh

Differential Revision: D43415046

fbshipit-source-id: 28b5ef3dacc34a39d195569b4661dcf60277b589
2023-02-23 09:28:19 -08:00
Liubov Dmitrieva
26e675b61a fix the unbatched location to hash/ hash to location calls
Summary:
fix the unbatched location to hash/ hash to location calls within the cloud bookmarks loop

total number of bookmarks in the workspace can be large

Reviewed By: quark-zju

Differential Revision: D43356959

fbshipit-source-id: 4f01bf14fd42d31dcb51fa9a2f48603cc2b64736
2023-02-23 07:49:47 -08:00
Jun Wu
20e6d019b6 eagerpeer: construct eagerpeer on EagerRepo paths
Summary:
Partially restore D43263811 (21303b73c8). While `repo.edenapi` now goes through the Rust
code path. The Python code path relies on the extra handling to construct
`eagerpeer`. Restore the logic.

Reviewed By: sggutier

Differential Revision: D43516089

fbshipit-source-id: 9cabca67b1698bffbd51fb741408c2bd236653f6
2023-02-22 20:59:29 -08:00
Jun Wu
b3462a2d61 exchange: support pull EagerRepo for non-lazy changelog
Summary:
Previously, EagerRepo can only be used as a server for lazy/lazytext client
repos. This diff extends it to also support non-lazy changelogs so EagerRepo
can be used more widely.

Reviewed By: sggutier

Differential Revision: D43516090

fbshipit-source-id: 2adc43b1205b111393c53bfbf57f75dcc9ff8775
2023-02-22 20:59:29 -08:00
Jun Wu
3a01cba6ff treemanifest: add sanity check about eagerepo tree store type
Summary:
Check that the eager repo store is used for eager repo. This prevents
mysterious errors like cannot convert filescmstore to Arc<dyn TreeStore>.

Reviewed By: muirdm

Differential Revision: D43516091

fbshipit-source-id: 7204177b48c8f6cab078d42f0092a45a3618e2f4
2023-02-22 20:59:29 -08:00
Jun Wu
e299433573 localrepo: detect conflicting repo requirements early
Summary:
So far we don't have a supported way to create a "remotefilelog" repo on
"init". They are done in a hacky way by appending "remotefilelog" to
"requires". That would cause issues with other requires, like eagerepo.

Detect them.

Reviewed By: muirdm

Differential Revision: D43516088

fbshipit-source-id: 8be0888f0742e310c7c2fc1e5d28fe4051c8056a
2023-02-22 20:59:29 -08:00
David Tolnay
45686a5e3b Fix doc tests of all eden targets
Summary: The ones which involve using `named_deps` are explained in D43511516. Rustdoc doesn't support libraries that have the same crate name as one of their dependencies.

Reviewed By: quark-zju

Differential Revision: D43517770

fbshipit-source-id: 4e543f8dd58aa8a1c5f3d73b92db12134661625e
2023-02-22 17:53:55 -08:00
Saul Gutierrez
07c82481ec tests: fix error in test-fb-ext-errorredirect
Summary: This test broke recently due to some changes in the test headers and the way it outputs to a file, which this commit fixes.

Reviewed By: quark-zju

Differential Revision: D43515941

fbshipit-source-id: fdcbf0b890b28f9e868fe8cdc02e99d8331ed863
2023-02-22 16:54:38 -08:00
Saul Gutierrez
c260b5a853 tests: fix CI issues caused by missing internationalization
Summary: `test-check-code.t` was failing due to missing internationalization for `_("EXC\n")`. This diff fixes the issue.

Reviewed By: quark-zju

Differential Revision: D43512577

fbshipit-source-id: cdc6c0dc49d131f9a860bb110f47d5a411e6de41
2023-02-22 16:54:38 -08:00
Jun Wu
4f872e7623 github: make MockRequestNotFound easier to debug
Summary:
Sometimes the mock key has changed and MockRequestNotFound crashed with a very
long message and a stacktrace. Make it easier to debug by diffing against all
available keys and showing the most similar key.

After:

  % lrt test-ext-github-pr-submit-overlap.t
  test-ext-github-pr-submit-overlap.t ---------------------------------------------------------
    24 $ sl pr submit --config extensions.pr_submit=$TESTDIR/github/mock_create_prs.py
       pushing 2 to https://github.com/facebook/test_github_repo.git
       created new pull request: https://github.com/facebook/test_github_repo/pull/42
       created new pull request: https://github.com/facebook/test_github_repo/pull/43
      -updated body for https://github.com/facebook/test_github_repo/pull/43
      -updated body for https://github.com/facebook/test_github_repo/pull/42
      +abort: Mock key has changed:
      +| @@ -3,8 +3,7 @@
      +|  ---
      +|  Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/facebook/test_github_repo/pull/43).
      +|  * __->__ #43
      +| -* #42
      +| -,pullRequestId=PR_id_43,query=
      +| +* #42,pullRequestId=PR_id_43,query=
      +|  mutation ($pullRequestId: ID!, $title: String!, $body: String!, $base: String!) {
      +|    updatePullRequest(
      +|      input: {pullRequestId: $pullRequestId, title: $title, body: $body, baseRefName: $base}
      +
      +[255]

Before:

  % lrt test-ext-github-pr-submit-overlap.t
  test-ext-github-pr-submit-overlap.t ---------------------------------------------------------
    24 $ sl pr submit --config extensions.pr_submit=$TESTDIR/github/mock_create_prs.py
       pushing 2 to https://github.com/facebook/test_github_repo.git
       created new pull request: https://github.com/facebook/test_github_repo/pull/42
       created new pull request: https://github.com/facebook/test_github_repo/pull/43
      -updated body for https://github.com/facebook/test_github_repo/pull/43
      -updated body for https://github.com/facebook/test_github_repo/pull/42
      +** Sapling SCM (version 4.4.2_20230221_142505_54c9ccb1b298) has crashed:
      +Traceback (most recent call last):
      +  File "eden/scm/edenscm/ext/github/mock_utils.py", line 100, in make_request
      +    return self.requests[key].get_response()
      +KeyError: 'github.com|graphql|None|base=main,body=two\n\n---\nStack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/facebook/test_github_repo/pull/43).\n* __->__ #43\n* #42,pullRequestId=PR_id_43,query=\nmutation ($pullRequestId: ID!, $title: String!, $body: String!, $base: String!) {\n  updatePullRequest(\n    input: {pullRequestId: $pullRequestId, title: $title, body: $body, baseRefName: $base}\n  ) {\n    pullRequest {\n      id\n    }\n  }\n}\n,title=two'
      +
      +During handling of the above exception, another exception occurred:
      +
      +Traceback (most recent call last):
      +  File "eden/scm/edenscm/__init__.py", line 106, in run
      +    dispatch.run(args, fin, fout, ferr, config)
      +  File "eden/scm/edenscm/dispatch.py", line 161, in run
      +    status = (dispatch(req) or 0) & 255
      +  File "eden/scm/edenscm/dispatch.py", line 499, in dispatch
      +    ret = _runcatch(req)
      +  File "eden/scm/edenscm/dispatch.py", line 687, in _runcatch
      +    return _callcatch(ui, req, _runcatchfunc)
      +  File "eden/scm/edenscm/dispatch.py", line 696, in _callcatch
      +    return scmutil.callcatch(ui, req, func)
      +  File "eden/scm/edenscm/scmutil.py", line 143, in callcatch
      +    return func()
      +  File "eden/scm/edenscm/dispatch.py", line 670, in _runcatchfunc
      +    return _dispatch(req)
      +  File "eden/scm/edenscm/dispatch.py", line 1197, in _dispatch
      +    ret = runcommand(
      +  File "eden/scm/edenscm/dispatch.py", line 886, in runcommand
      +    ret = _runcommand(ui, options, cmd, d)
      +  File "eden/scm/edenscm/dispatch.py", line 1238, in _runcommand
      +    return cmdfunc()
      +  File "eden/scm/edenscm/dispatch.py", line 1196, in <lambda>
      +    d = lambda: util.checksignature(func)(ui, *args, **strcmdopt)
      +  File "eden/scm/edenscm/util.py", line 1298, in check
      +    return func(*args, **kwargs)
      +  File "eden/scm/edenscm/ext/github/__init__.py", line 113, in submit_cmd
      +    return submit.submit(ui, repo, *args, **opts)
      +  File "eden/scm/edenscm/ext/github/submit.py", line 33, in submit
      +    return asyncio.run(
      +  File "/usr/lib64/python3.8/asyncio/runners.py", line 44, in run
      +    return loop.run_until_complete(main)
      +  File "/usr/lib64/python3.8/asyncio/base_events.py", line 616, in run_until_complete
      +    return future.result()
      +  File "eden/scm/edenscm/ext/github/submit.py", line 243, in update_commits_in_stack
      +    await asyncio.gather(*rewrite_and_archive_requests)
      +  File "eden/scm/edenscm/ext/github/submit.py", line 281, in rewrite_pull_request_body
      +    result = await gh_submit.update_pull_request(
      +  File "eden/scm/edenscm/ext/github/gh_submit.py", line 349, in update_pull_request
      +    result = await gh_cli.make_request(params, hostname=hostname)
      +  File "eden/scm/ghstack/github_gh_cli.py", line 29, in make_request
      +    return await _make_request(params, hostname, endpoint, method)
      +  File "eden/scm/edenscm/ext/github/mock_utils.py", line 102, in make_request
      +    raise MockRequestNotFound(key, self.requests)
      +edenscm.ext.github.mock_utils.MockRequestNotFound: key not found: github.com|graphql|None|base=main,body=two
      +
      +---
      +Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/facebook/test_github_repo/pull/43).
      +* __->__ #43
      +* #42,pullRequestId=PR_id_43,query=
      +mutation ($pullRequestId: ID!, $title: String!, $body: String!, $base: String!) {
      +  updatePullRequest(
      +    input: {pullRequestId: $pullRequestId, title: $title, body: $body, baseRefName: $base}
      +  ) {
      +    pullRequest {
      +      id
      +    }
      +  }
      +}
      +,title=two
      +Available keys:
      +github.com|graphql|None|name=test_github_repo,owner=facebook,query=
      +query ($owner: String!, $name: String!) {
      +  repository(name: $name, owner: $owner) {
      +    id
      +    owner {
      +      id
      +      login
      +    }
      +    name
      +    isFork
      +    defaultBranchRef {
      +      name
      +    }
      +    parent {
      +      id
      +      owner {
      +        id
      +        login
      +      }
      +      name
      +      isFork
      +      defaultBranchRef {
      +        name
      +      }
      +    }
      +  }
      +}
      +
      +
      +github.com|graphql|None|name=test_github_repo,owner=facebook,query=
      +query ($owner: String!, $name: String!) {
      +  repository(owner: $owner, name: $name) {
      +    issues(orderBy: {field: CREATED_AT, direction: ASC}, last: 1) {
      +      nodes {
      +        number
      +      }
      +    }
      +    pullRequests(orderBy: {field: CREATED_AT, direction: ASC}, last: 1) {
      +      nodes {
      +        number
      +      }
      +    }
      +  }
      +}
      +
      +
      +github.com|repos/facebook/test_github_repo/pulls|None|base=main,body=one
      +,draft=False,head=pr42,title=one
      +
      +github.com|graphql|None|name=test_github_repo,number=42,owner=facebook,query=
      +query ($owner: String!, $name: String!, $number: Int!) {
      +  repository(name: $name, owner: $owner) {
      +    pullRequest(number: $number) {
      +      id
      +      url
      +      state
      +      baseRefOid
      +      baseRefName
      +      headRefOid
      +      headRefName
      +      body
      +    }
      +  }
      +}
      +
      +
      +github.com|graphql|None|base=main,body=one
      +
      +---
      +Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/facebook/test_github_repo/pull/42).
      +* #43
      +* __->__ #42
      +,pullRequestId=PR_id_42,query=
      +mutation ($pullRequestId: ID!, $title: String!, $body: String!, $base: String!) {
      +  updatePullRequest(
      +    input: {pullRequestId: $pullRequestId, title: $title, body: $body, baseRefName: $base}
      +  ) {
      +    pullRequest {
      +      id
      +    }
      +  }
      +}
      +,title=one
      +
      +github.com|repos/facebook/test_github_repo/pulls|None|base=main,body=two
      +,draft=False,head=pr43,title=two
      +
      +github.com|graphql|None|name=test_github_repo,number=43,owner=facebook,query=
      +query ($owner: String!, $name: String!, $number: Int!) {
      +  repository(name: $name, owner: $owner) {
      +    pullRequest(number: $number) {
      +      id
      +      url
      +      state
      +      baseRefOid
      +      baseRefName
      +      headRefOid
      +      headRefName
      +      body
      +    }
      +  }
      +}
      +
      +
      +github.com|graphql|None|base=main,body=two
      +
      +---
      +Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/facebook/test_github_repo/pull/43).
      +* __->__ #43
      +* #42
      +,pullRequestId=PR_id_43,query=
      +mutation ($pullRequestId: ID!, $title: String!, $body: String!, $base: String!) {
      +  updatePullRequest(
      +    input: {pullRequestId: $pullRequestId, title: $title, body: $body, baseRefName: $base}
      +  ) {
      +    pullRequest {
      +      id
      +    }
      +  }
      +}
      +,title=two
      +
      +github.com|graphql|None|query=
      +query {
      +  viewer {
      +    login
      +  }
      +}
      +
      +
      +github.com|graphql|None|base=sapling-pr-archive-facebook_username,head=1a67244b0a776bfcc3be6bf811e98c993d78ce47,query=
      +mutation ($repositoryId: ID!, $base: String!, $head: String!) {
      +  mergeBranch(input: {repositoryId: $repositoryId, base: $base, head: $head}) {
      +    mergeCommit {
      +      oid
      +    }
      +  }
      +}
      +,repositoryId=R_test_github_repo
      +[1]

Reviewed By: muirdm

Differential Revision: D43486928

fbshipit-source-id: 4c1321dfab0e4f86db60a38bfd04e6abeba2f215
2023-02-22 15:51:13 -08:00
Saul Gutierrez
2a31a60996 workingcopy: fix typo in invocation
Summary: `_rsrepo` is an object and not invocable. For some reason, our linters and pyre never caught this typo.

Reviewed By: quark-zju

Differential Revision: D43503666

fbshipit-source-id: 703cacfd3d881ee39f8b9909a7170afef321097b
2023-02-22 15:46:35 -08:00
Andres Suarez
85f5fdb23d Unfork deltae
Summary: Use `.gitignore` to achieve the same effect of slimming down the dep.

Reviewed By: diliop

Differential Revision: D43489210

fbshipit-source-id: de518882ed0bad26bbcefb2ffc8bd782e95af6bd
2023-02-22 08:50:27 -08:00
Jun Wu
c61a633caf test-formatter: fix debugruntest compat
Summary:
The default hgrc has a different path (`.hgrc` vs `hgrc`).
Update the test to not require `.`.

Reviewed By: zzl0

Differential Revision: D43012614

fbshipit-source-id: 5e33c2dcdcba053c8540ae7ebc16d74e2a540a61
2023-02-21 19:49:20 -08:00
Jun Wu
4905632365 test-ext-stablerev: fix debugruntest compat
Summary:
The test wants to shell out to real bash scripts. Let's ensure that the bash is
ready for that.

Reviewed By: zzl0

Differential Revision: D42826350

fbshipit-source-id: 301d27fba98e72b8bb459946b15c322cfaf1f658
2023-02-21 19:48:34 -08:00
Jun Wu
652f0584e3 test-ext-logginghelper: fix debugruntest compat
Summary:
It uses `tr` which is missing in `debugruntest` stdlib.
Let's just replace both `tr` and `jq` with a Python function to make it
debugruntest compatible.

Reviewed By: zzl0

Differential Revision: D42826353

fbshipit-source-id: e9e7d2da6d7bbf256d83050abb0ca2b58f5516f1
2023-02-21 19:48:34 -08:00
kurtz.brandon@gmail.com
1f9ed2ec93 add config option to disable mention of ReviewStack in PR bodies (#427)
Summary:
add config option to disable mention of ReviewStack in PR bodies

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

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

Reviewed By: sggutier

Differential Revision: D43326767

Pulled By: quark-zju

fbshipit-source-id: c678ec7c629aa2a27685416822a46e351edbc499
2023-02-21 18:32:58 -08:00
Jun Wu
420f1dd9f1 github: skip reviewstack and PR stack message for single-commit stack
Summary:
If the commit is not a stack, the regular GitHub PR workflow works fine.
Skip reviewstack and stack boilerplate.

Reviewed By: sggutier

Differential Revision: D43481900

fbshipit-source-id: a7b6f93e1b6ac4de16469980b85c0c8261d5efee
2023-02-21 18:32:58 -08:00
Jun Wu
957933cd1b github: update pr template doctest to test actual output
Summary: This makes it auto-fix friendly.

Reviewed By: sggutier

Differential Revision: D43481899

fbshipit-source-id: e7c54980f1aac667f7e4cebb04ec420045db1655
2023-02-21 18:32:58 -08:00
generatedunixname89002005307016
339bca4f4d Lint failure adding annotations to eden/scm/edenscm/changegroup.py
Reviewed By: quark-zju

Differential Revision: D43436458

fbshipit-source-id: d0ab6f8fc85b33e86727e24115b8fa35c10a7a59
2023-02-21 15:05:05 -08:00
generatedunixname89002005307016
f03a659d22 Add annotations to eden/scm/edenscm/ext/snapshot/show.py
Reviewed By: quark-zju

Differential Revision: D43455964

fbshipit-source-id: 836b33c3359d4b0cd4216488be50d74dd6f860b4
2023-02-21 14:38:44 -08:00
Xavier Deguillard
3ce4c47400 backingstore: expose file size/sha1 to EdenFS
Summary:
This is the last step in exposing aux data to EdenFS in trees. EdenFS still
doesn't do caching of these just yet, but that's coming in a subsequent diff.

Reviewed By: muirdm

Differential Revision: D43132762

fbshipit-source-id: 86488d0f071448e6e78d30e85e2963e001b1d67c
2023-02-21 12:05:13 -08:00
Xavier Deguillard
78e23aacf4 backingstore: remove unused hash field
Summary:
This is unused, but we still allocate a Vec for it, remove it to save on the
allocation.

Reviewed By: genevievehelsel

Differential Revision: D43132767

fbshipit-source-id: 715e4b3e030887ccad464a2d881acf11802b1b45
2023-02-21 12:05:13 -08:00
Xavier Deguillard
5493f4a590 backingstore: collect aux data when fetching tree batches
Summary:
Now that aux data can be collected from tree fetches, let's move it closer to
EdenFS by having the backingstore collect them.

Reviewed By: muirdm

Differential Revision: D43132764

fbshipit-source-id: c74898a7886e927ed9ef81a28fead1ce6fca1df3
2023-02-21 12:05:13 -08:00
Xavier Deguillard
952820d87d revisionstore: add an API to get aux data from StoreTree
Summary:
On EdenFS, it is very common to get a Tree and then immediately after read its
aux data. This is so common that the lock on the aux data IndexedLog is
extremely contended, leading to most of the time being spent waiting on taking
it. To avoid this, we should expose the aux data already present in the EdenAPI
result and return it to EdenFS immediately.

For now, this merely introduce the API, future diffs will plug it deeper into
EdenFS.

Reviewed By: muirdm

Differential Revision: D43132763

fbshipit-source-id: 13d2158e6f2b6d52905ce684bc0f12096a95920c
2023-02-21 12:05:13 -08:00
Jun Wu
e0e765edb1 eagerepo: handle null id read
Summary:
Hg specifies the "null" id to be empty context. Respect that.
This makes `debugexportrevlog` work in `debugdrawdag --no-files` repos.

Reviewed By: zzl0

Differential Revision: D43373719

fbshipit-source-id: 13bdcbc03480482eee812dc8c485debdeac43dc3
2023-02-21 10:37:13 -08:00
Jun Wu
21303b73c8 ui: drop logic normalizing path url to eager: url
Summary:
This is now done in a lower layer in Rust. So it's no longer necessary in
Python.

Reviewed By: muirdm

Differential Revision: D43263811

fbshipit-source-id: db69a4da749a6b7a405ff388af0ed533721c3ec1
2023-02-21 10:37:13 -08:00