Commit Graph

7835 Commits

Author SHA1 Message Date
Jun Wu
bc80499084 git: avoid deadlock with nested submodules of same URL
Summary:
Some submodules (ex. gflags) have submodules (ex. gflags/doc) that share the same
URL with the parent repo. Previously those 2 repos would deadlock on the
backing repo wlock on checkout, and the git reference would conflict.

Fix them by:
- Skip the submodule backing repo wlock, since nobody uses the backing repo's
  working copy.
- Escape `/` to `_` in the git reference name to avoid conflict.

Reviewed By: muirdm

Differential Revision: D42949672

fbshipit-source-id: fc471f9c6aeec05212911e3ffeb8f53f0427fa38
2023-02-02 11:32:30 -08:00
Jun Wu
76f184b45a posix: track lock creation stacktrace in deadlock detection
Summary:
This is used to investigate a deadlock pulling submodules when cloning the
pytorch repo.

Note the deadlock checking only works for Python locks and requires
`--config devel.lockmode=python` to activate.

Reviewed By: muirdm

Differential Revision: D42949671

fbshipit-source-id: bfd01e7564bf10f64875a411e7d74c961e240425
2023-02-02 11:32:30 -08:00
Jun Wu
59fce58b2c test-repo-leak: use modern configs
Summary: Test modern code paths.

Reviewed By: muirdm

Differential Revision: D42940458

fbshipit-source-id: e1a0def90e1eca37cfac9d338452098730b171fa
2023-02-02 11:32:30 -08:00
Jun Wu
8387790c17 test-repo-leak: migrate to debugruntest
Summary: Enabling `#inprocess-hg-incompatible` makes the test compatible.

Reviewed By: muirdm

Differential Revision: D42940329

fbshipit-source-id: 0779b4ed4790d087958aee97b54f8e085dd09b28
2023-02-02 11:32:30 -08:00
generatedunixname89002005307016
98b90b65b3 Add annotations to eden/scm/edenscm/ext/remotefilelog/cacheclient.py
Reviewed By: quark-zju

Differential Revision: D42843733

fbshipit-source-id: 82928c2833d9563b648662de74db7743cb408ac1
2023-02-02 08:56:53 -08:00
generatedunixname89002005307016
e44a6a88ce Add annotations to eden/scm/edenscm/localrepo.py
Reviewed By: quark-zju

Differential Revision: D42961124

fbshipit-source-id: 59c6fd5a91b2c8b9f784e1ed3f4803a639373624
2023-02-02 08:53:04 -08:00
generatedunixname89002005287564
8074589d16 Reviewed By: zertosh
Differential Revision: D42955463

fbshipit-source-id: 803f9319b6873da7220af33d5619920b5d1efef0
2023-02-02 04:42:49 -08:00
generatedunixname89002005307016
7942a4e360 upgrade pyre version in fbcode/eden - batch 1
Reviewed By: genevievehelsel

Differential Revision: D42946315

fbshipit-source-id: 38eff0b796fbbd78ba842787c5887390ff698e36
2023-02-01 20:39:41 -08:00
Jun Wu
065cbf8e8e test-debugrevset: fix debugruntest compat
Summary:
The test requires the Rust implementation of `debugrevset`. However by setting
`workingcopy.use-rust` to False (default) the `clidispatch` would request
falling back to a Python implementation of `debugrevset`, which does not exist.

Fix it by setting `workingcopy.use-rust` to True. We should make sure
`run-tests.py` and `debugruntest` has a same view of default hgrc. But that
is a potentially breaking change and would be done separately.

Reviewed By: zzl0

Differential Revision: D42825820

fbshipit-source-id: db537c0226d205f9fc5d1a464a6ef4b4d8793185
2023-02-01 12:05:24 -08:00
Jun Wu
6f940d0d4c test-config-precedence: fix debugruntest compat
Summary:
The "regen-command" spwans a real subprocess in Rust that does not go through
the Python shinterp so it was not compatible with debugruntest.

Let's check the tracing message instead to ensure the spawn behavior happened.

Reviewed By: zzl0

Differential Revision: D42825821

fbshipit-source-id: d51c13e5b6d5ea776cfddd8f49db4913e826304d
2023-02-01 12:05:24 -08:00
Jun Wu
ef6072246b commitcloud: do not make LocalSerivce as a singleton
Summary:
If LocalSerivce is a singleton, it will capture an `ui` object that might be
stale in in-process hg tests. `LocalSerivce` is cheap to construct so let's
just avoid the singleton pattern for test compatibility.

This fixes `test-commitcloud-rename-workspace` debugruntest compatibility as
the following text is now printed properly using the up-to-date `ui.debugflag`:

  commitcloud local service: get_references for current version 2

Reviewed By: zzl0

Differential Revision: D42825822

fbshipit-source-id: 683dec345c4a36a6d79080e54a09050991c11dad
2023-02-01 12:05:24 -08:00
Jun Wu
dcbbb6be77 test-clone-resume: fix debugruntest compat
Summary:
`&>` is parsed by conch-parser as `&` (run in background) and `>` (redirect) so
it does not work properly in debugruntest.

In this case the test just want to silence the traceback of an uncaught error.
Let's make it explicit that we just disable that traceback without affecting
other logic.

Reviewed By: zzl0

Differential Revision: D42825819

fbshipit-source-id: 963f83ed25d22ace13982632e23cc86195a62a2f
2023-02-01 12:05:24 -08:00
Jun Wu
25aa52bc55 checkmessagehook: inline extension
Summary:
Inline the checkmessagehook extension so it works without using hooks.
Hooks have extra overhead (ex. flushing pending commits, files, metalog, etc so
changes are visible to subprocesses) that is unnecessary for just checking
a commit message.

Reviewed By: zzl0

Differential Revision: D42823936

fbshipit-source-id: 4ca951f4f555ea3b3227656539b4748b83692230
2023-02-01 12:05:24 -08:00
Jun Wu
27af34dea0 lib: vendor streampager
Summary:
This allows faster iteration on streampager features.

I made the file loading feature optional by adding the `loaded_file` feature.
This way the code is compatible with upstream and for internal build we can
avoid unnecessary dependency like `notify`.

Reviewed By: markbt

Differential Revision: D42873673

fbshipit-source-id: 7d3d0f07f4f5a30cfcc87ed6d02ea0886f88276b
2023-02-01 11:58:45 -08:00
Muir Manders
63c02b5aee rebase: disable inmemory rebase w/ --collapse
Summary: Conflicts weren't being handled properly with --collapse combined with rebase.experimental.inmemory=true. Work around by disabling in-memory rebase when collapsing.

Reviewed By: sggutier

Differential Revision: D42924842

fbshipit-source-id: 6d86ea1ad8c7b6852f0bd874d26041e42f0c2b10
2023-02-01 11:51:30 -08:00
Muir Manders
7f39eca2df rebase: add test for incorrect "--collapse" behavior
Summary: Add test showing incorrect collapse behavior when source commits merge.

Reviewed By: sggutier

Differential Revision: D42924841

fbshipit-source-id: f4c42af19d52b50a0023b2b44f50e5d264a915ce
2023-02-01 11:51:30 -08:00
Muir Manders
972ea94d27 revert test-merge-tools.t
Summary: This wasn't passing after my recent change to enable native status in more tests. Not sure why I committed or how it landed.

Reviewed By: sggutier

Differential Revision: D42926501

fbshipit-source-id: 2fb8179ba578e8ce61aca6ab2ea3c077dbfc158e
2023-02-01 10:08:38 -08:00
Muir Manders
dbdcd00856 fix test-ext-logginghelper.t
Summary: Switch from "status" to an arbitrary Python command "addremove" so the extension under test gets loaded.

Reviewed By: sggutier

Differential Revision: D42925551

fbshipit-source-id: 88a8a687a86016872eddca99041138df151bce3e
2023-02-01 09:07:15 -08:00
Muir Manders
1a0c6a9fbe fix test-basic.t
Summary: Fix some failing tests that were linux specific related to using native status.

Reviewed By: sggutier

Differential Revision: D42925560

fbshipit-source-id: 387c7cf141a0b6274f7127bca25d3c8c15be375c
2023-02-01 09:07:15 -08:00
Muir Manders
8f7d00dc6a sparse: ignore directory %includes
Summary:
Ingore %include directives that end in "/". It isn't valid to include a directory, and this was causing an error for the Rust status command when it went looking in the manifest for the path ending in "/".

We seem to sanitize the paths given to "hg sparse enable ...", so I'm not sure how the bad path got into a sparse config beyond hand editting.

Differential Revision: D42870518

fbshipit-source-id: d2162ca1180e06080c9bdf846f1715e389ea0fdd
2023-02-01 08:13:43 -08:00
Baojun Wang
286e032ce6 Upgrade uuid to 1.2
Summary:
Upgrade uuid crate from v0.8 to v1.2.

Fixed build errors due to API breakage:

1) `to_hyphenated()` -> `hyphenated()`.
2) `to_hyphenated_ref()` -> `as_hyphenated()`.
3) `to_simple()` -> `simple()`.
4) Update `Cargo.toml` (For some reason `arc autocargo` didn't work for some `Cargo.toml` files, likely due to autocargo config section in `TARGETS`).
5) `to_simple_ref()` -> `as_simple()`.
6) `use uuid::adapter::HyphenatedRef` -> `&` `uuid::fmt::Hyphenated`.

For 1), 2), 3) and 4) I ran below scripts to update the API call sites, respectively:

```
 5139  2023-01-27 13:20:58 for rs in `fbgs -f '.*\.rs' '.to_hyphenated()' | awk -F: '{print $1;}' | uniq`; do sed -i 's/\.to_hyphenated()/.hyphenated()/g' $rs && echo -e "processing $rs"; done
 5140  2023-01-27 13:22:12 for rs in `fbgs -f '.*\.rs' '.to_hyphenated_ref()' | awk -F: '{print $1;}' | uniq`; do sed -i 's/\.to_hyphenated_ref()/.as_hyphenated()/g' $rs && echo -e "processing $rs"; done
 5154  2023-01-27 13:37:19 for rs in `fbgs -f '.*\.rs' '.to_simple()' | awk -F: '{print $1;}' | uniq`; do sed -i 's/\.to_simple()/.simple()/g' $rs && echo -e "processing $rs"; done
 5216  2023-01-27 14:56:26 for toml in `fbgr -f 'Cargo\.toml' 'uuid = { version = "0[^"]*"' | awk -F: '{print $1;}' | uniq`; do sed -i 's/uuid = { version = "0[^"]*"/uuid = { version = "1.2"/g' $toml && echo -e "processing $toml"; done
```

For 5) and 6), There're only a few places need fixing (hermit-cli and linttool), so I fixed them manually.

== Exceptions
gpt crate v0.3 still uses uuid-0.8 as a dependency, hence [metalos/**/expand_paritiion.rs](https://www.internalfb.com/code/fbsource/[72f22c0ad63b64adbe88fa9213d60ce8f0320421]/fbcode/metalos/lib/expand_partition/src/expand_partition.rs?lines=138) should not apply above 'codemod' (or must be reverted).

NOTE: Because uuid crate v1 has breaking API changes, there's no easy way to split the diffs to multiple smaller *atomic* (where each diff wouldn't cause CI failures) diffs, unfortunately.

Reviewed By: edward-shen

Differential Revision: D42811369

fbshipit-source-id: 377fd1036c8a75bcb1982b03c720a3cea02421e5
2023-01-31 14:55:53 -08:00
Muir Manders
1caeb25d0a status: enable rust status in more tests
Summary:
These tests just needed to switch to a modern, non-revlog repo format.

Remaining tests using the old status have the same problem, but are trickier to migrate due more complicated client/server interactions.

Reviewed By: quark-zju

Differential Revision: D42748903

fbshipit-source-id: 979720cff4e72de586c90d922694d4d88c130b2f
2023-01-31 12:25:37 -08:00
Muir Manders
2ac1872674 tests: kill test-fb-ext-treemanifest-convertflat.t
Summary: We don't care about flat manifest anymore, and it would be work to update this test to use modern repo format.

Reviewed By: quark-zju

Differential Revision: D42748901

fbshipit-source-id: fd67adf9992b45264a100b5838866ea35d6ad7ff
2023-01-31 12:25:37 -08:00
Muir Manders
8daadd0716 status: enable rust status in test-fb-ext-tweakdefaults.t
Summary:
This test had a real failure where the new status wasn't respecting HGPLAIN to force root-relative paths in the output. It is safer to keep that behavior since we presume some automation would break if we changed to show cwd-relative paths unconditionally.

To use the native status I had to change this test to use modern repo format. That broke some use of revision numbers, so I tweaked tweakdefaults to respect the devel.default-date option to get stable commit hashes (so I could use those instead of revision numbers).

Reviewed By: quark-zju

Differential Revision: D42748900

fbshipit-source-id: 3358c659d5c67e781723720fcb2f760518d7d46f
2023-01-31 12:25:37 -08:00
Muir Manders
11f804ac3d hgcommands: enable "backtrace" feature for anyhow
Summary: This allows RUST_BACKTRACE=1 to work for "make local" builds. I believe buck uses nightly which should get backtrace enabled by default.

Reviewed By: quark-zju

Differential Revision: D42748902

fbshipit-source-id: fdd9473f1c0250a117c83b9637a6e23e0df26da4
2023-01-31 12:25:37 -08:00
Muir Manders
f360ac6b8c color: use "backslashreplace" instead of "replace" for invalid utf8
Summary: This way the user can see the original byte values.

Differential Revision: D42889478

fbshipit-source-id: 7876787180136cdd86839913eba77cad44115ce3
2023-01-31 11:31:48 -08:00
Muir Manders
eab63a2b60 color: don't crash styling non-utf8 strings
Summary: Make sure we only pass valid utf-8 strings to Rust's text styling.

Reviewed By: quark-zju

Differential Revision: D42886530

fbshipit-source-id: 2dc7f1ade57d3324997aa9c9a111016cfef51e07
2023-01-31 09:15:10 -08:00
Muir Manders
32018072c6 tests: fix test-import-git.t
Summary: Switch to modern repo config to resolve "hg status" errors. Somehow missed this one (I probably assumed it was a test using git instead of an hg test importing git diff format).

Reviewed By: sggutier

Differential Revision: D42863480

fbshipit-source-id: 9d595954fb7f7c9693b6d91ef9485acdc37ddc2d
2023-01-30 17:26:30 -08:00
Andres Suarez
00b1f93276 Update tokio-1.21.2 to tokio-1.25.0
Reviewed By: diliop

Differential Revision: D42837228

fbshipit-source-id: 5e891cf1ff8ab1beff6e3c845b913144655778ea
2023-01-30 14:49:36 -08:00
Jun Wu
d7d50df449 checkserverbookmark: remove extension and test
Summary:
`checkserverbookmark` was added by D15450801 (865b8b3a46) for early Mononoke migration.
It is no longer relevant.

Reviewed By: zzl0

Differential Revision: D42823312

fbshipit-source-id: f120255c4c33b919718e46052967d28e7ab772a4
2023-01-30 14:01:19 -08:00
Jun Wu
445af61f11 conch_parser: move Python bindings to bindings module
Summary:
Previously, `conch_parser` was built as a separate Python module (`.so`)
so it is not distributed with the main executable, for portability and
binary size considerations.

However, it's annoying to maintain a separate Python module, for example,
buck macOS build would have issues importing it. The binary size concern also
seems minor: stripped Linux binary increases from 43174872 to 43537624 bytes,
+363KB, less than 1%.

Therefore, let's just embed `conch_parser` directly for better macOS support.

`conch_parser` is kept in case someone wants to build a standalone Python extension.

Reviewed By: zzl0

Differential Revision: D42822105

fbshipit-source-id: 287f25aa1860836a3c7df913233b9cb92d6fd0e3
2023-01-30 10:56:17 -08:00
Jun Wu
e6f09028ba changelog: support migrating from lazy to lazytext
Summary:
Teach `debugchangelog --migrate lazytext` to fetch commit hashes and migrate
the repo to not using lazy commit hashes, which supports
`devel.segmented-changelog-rev-compat` for compatibility with legacy tests.

Reviewed By: muirdm

Differential Revision: D42788588

fbshipit-source-id: b95045bba48f4fbc5c10d94780656163f1335587
2023-01-30 10:55:11 -08:00
John Billings
7bbe6fbaf2 Upgrade indexmap
Summary: Upgrade indexmap from 1.9.1 to 1.9.2, enable new `arbitrary` feature.

Reviewed By: morphmeme

Differential Revision: D42780598

fbshipit-source-id: f8b5df50352824aa8fcf864090e53669faae7b8c
2023-01-29 11:17:39 -08:00
Zhaolong Zhu
29bf7a4cef copytrace: use gitcopytrace in Python code
Summary: integrate `gitcopytrace` with Python code to detect renames in for Git repo

Reviewed By: quark-zju

Differential Revision: D42790306

fbshipit-source-id: 396574641e4c09caf3db3f80c0a3622cc5bcfd12
2023-01-27 19:02:01 -08:00
Jun Wu
f865734583 test-dirstate-nonnormalset: remove the test
Summary:
The test was intended to check that the nonnormalset is a subset of files
tracked by dirstate. Previously the nonnormalset is tracked separately so
it can be buggy and include files not in the main dirstate map. But the
TreeState format enforces the nonnormalset to be a subset of files tracked
by TreeState (dirstate). Therefore the test is no longer relevant.

Reviewed By: sggutier

Differential Revision: D42818816

fbshipit-source-id: 24277f4cd16efc82ac803e1ff2b5b53941289abd
2023-01-27 15:10:14 -08:00
Mark Shroyer
88ddf0c403 Make hgmain depend on identity crate based on with_chg feature
Summary: This way we stop hardcoding platform-specific deps for individual unix-like operating systems. A step toward unblocking building on FreeBSD.

Reviewed By: muirdm, quark-zju

Differential Revision: D42685396

fbshipit-source-id: e8c2e08042ae3ca2ba7121947ff7604ee77212c0
2023-01-27 14:40:56 -08:00
Zhaolong Zhu
bdbcfa045b copytrace: bindings for GitCopyTrace
Summary:
Thin Wrapper around GitCopyTrace, it can be used in pathcopies
function for detecting Git file moves.

Reviewed By: quark-zju

Differential Revision: D42787243

fbshipit-source-id: ebbb5e092c0f162d42e66420e644b9488c6b6bec
2023-01-27 13:01:54 -08:00
Zhaolong Zhu
4ba25be7e1 copytrace: add GitCopyTrace Rust lib
Summary: This is a temporary solution to unblock hg-over-git use case, specifically detect renames

Reviewed By: quark-zju

Differential Revision: D42787244

fbshipit-source-id: 37edfc8efbb8a6229a3c2a5bdc3309cf2a89ae3c
2023-01-27 13:01:54 -08:00
Zhaolong Zhu
bb149840db copytrace: add test-git-rename.t
Summary:
add test for git rename, confirm it does not detect renames. After we
complete the feature, this test should fail and need to update.

Reviewed By: quark-zju

Differential Revision: D42787246

fbshipit-source-id: b65c454b3abf1cf7b25e5a501e3b4c652940a834
2023-01-27 13:01:54 -08:00
Matthew strager Glazar
731ba0459c oss: make 'make tests' run Python tests (#458)
Summary:
oss: make 'make tests' run Python tests
'make check' tries to run 'make tests', but despite being documented, the
'tests' target does not exist in the Makefile.

Create a 'tests' target which runs the Python test suite.

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

Test Plan:
$ make oss
    $ make check
    [bunch of failures]
    $ (cd tests && python run-tests.py test-debugcheckcasecollisions.t)
    ----------------------------------------------------------------------
    # Ran 1 tests, 0 skipped, 0 failed.

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

Reviewed By: muirdm

Differential Revision: D42742607

Pulled By: zzl0

fbshipit-source-id: 790624f28da629fe25846d1dde1fad2aa3382911
2023-01-27 10:44:33 -08:00
Thomas Orozco
cf3efd7672 third-party/rust: update cc
Summary:
If you ran autocargo right now on master it would fail because of this. I need
to run it later in this stack, so let's fix it.

Reviewed By: lmvasquezg

Differential Revision: D42776200

fbshipit-source-id: c95a8f0e5d34a99b11a069752fbfbde568fbecac
2023-01-27 05:07:50 -08:00
Jun Wu
b805766dd5 clidispatch: add a config option to set indexedlog checksum length
Summary: In case we want a different value, we can use this config option.

Reviewed By: muirdm

Differential Revision: D42783555

fbshipit-source-id: d3d7e1036db4635be45ecc61b0f521552dca6f75
2023-01-26 14:50:21 -08:00
Jun Wu
1492879b4e indexedlog: add a global config to set checksum chain length
Summary:
While D42626678 provides a way to set the max chain length per index, it's
annoying to update all users of indexedlog. Add a global option so we can
just update once for all.

Reviewed By: muirdm

Differential Revision: D42783554

fbshipit-source-id: 8bffe6de4225560c59da207f321fdaa2b65e25a1
2023-01-26 14:50:21 -08:00
Jun Wu
0a544add74 indexedlog: move config variables to a module
Summary: Move global configuration to a module to make it clear that those are configs.

Reviewed By: muirdm

Differential Revision: D42783055

fbshipit-source-id: d725946f1198199c9a40c612c435a60d62838e0d
2023-01-26 14:50:21 -08:00
Jun Wu
4b465a76df indexedlog: fix "race detected" during RotateLog::sync
Summary:
See the previous diff for context. This diff relaxes the metadata check to only
check the log length without checking indexes. This should resolve the race
condition.

The index uses persistent data structure with explicit pointers (offsets) so
data appended by another process would simply be ignored without causing
issues.

Reviewed By: muirdm

Differential Revision: D42627387

fbshipit-source-id: 5e776a8c6b34eeb6eefbb78f249fd99c7bd05b02
2023-01-26 14:50:21 -08:00
Jun Wu
8fc0ef156e indexedlog: add a test to reproduce "race detected" issue
Summary:
This reproduces the "race detected" error that sometimes happens.

Sample error:

  race detected, callsite responsible for preventing races
  (old meta: LogMetadata { primary_len: 500036164, indexes: {"2-node_and_path": 226025125}, epoch: 4118705755139574402 }
  ,new meta: LogMetadata { primary_len: 500036164, indexes: {"2-node_and_path": 235143143}, epoch: 4118705755139574402 })

Reviewed By: muirdm

Differential Revision: D38261693

fbshipit-source-id: c0b909531616bca9622afcf6d0541706a1056dd0
2023-01-26 14:50:21 -08:00
Jun Wu
ecfa1c154a indexedlog: optimize checksum linked list
Summary:
The checksum entry could form a long linked list that takes time to read from
disk. Add a way to "flatten" the chain so the linked list length could be reset
to 1 from time to time for optimized load time.

Reviewed By: muirdm

Differential Revision: D42626678

fbshipit-source-id: 57f13c235939ac416c6871eae7ec4e72b2c72f8e
2023-01-26 14:50:21 -08:00
Jun Wu
84d62aa7d4 runtests: support --time on Windows
Summary:
On Windows, `os.times()` does not provide a meaningful `elapsed`:

  In [1]: os.times()
  Out[1]: nt.times_result(user=1.921875, system=1.3125, children_user=0.0, children_system=0.0, elapsed=0.0)

Replace it with `time.monotonic()` so the wall clock time works on Windows.

Reviewed By: muirdm

Differential Revision: D42718496

fbshipit-source-id: dd1bfc313201cc6d321ee23397168d3981d03ffb
2023-01-26 13:30:19 -08:00
generatedunixname89002005307016
5f2af9ade3 Add annotations to eden/scm/edenscm/branchmap.py
Reviewed By: quark-zju

Differential Revision: D42773222

fbshipit-source-id: b3eecd913174dc6ea923f93019e6ff6769c49c1a
2023-01-26 10:32:25 -08:00
Muir Manders
99f069546b status: fix native status for git repos
Summary:
Teach Repo::file_store() and tree_store() to use the gitstore for git repos.

I also had to avoid a git store tree query for empty repos since git doesn't like our null ID.

Reviewed By: quark-zju

Differential Revision: D42711084

fbshipit-source-id: 399431d1478e9bcb1ffadb08e6bca0ed54f863a3
2023-01-26 09:17:43 -08:00