Commit Graph

20295 Commits

Author SHA1 Message Date
Jun Wu
f4dfef01d0 testing: make AssertionError fail tests
Summary:
In tests, `assert False` should be considered failure even if the output
"AssertionError" matches. This avoid blindly `-i` test update that silently
breaks test intention.

Reviewed By: sggutier

Differential Revision: D47524273

fbshipit-source-id: fb96d59ef46f0986265ca0b1d6c1a42017f4ae6f
2023-07-17 14:46:20 -07:00
Jun Wu
8d4e5b20ef fileset: AssertionError -> ProgrammingError
Summary:
In the next change we'll make AssertionError fail tests.
Update the fileset test to not use AssertionError.

Reviewed By: sggutier

Differential Revision: D47524272

fbshipit-source-id: 7698badc5dad0367997c4eb151036e5ac5239ffa
2023-07-17 14:46:20 -07:00
Zeyi (Rice) Fan
0d61ab668c fix test_file_locked_change_content
Summary:
In D47099273, we changed the behavior when it comes handling conflicts, breaking this test.

The desired behavior is changed with that. The update is aborted when there is a conflict (by extension, when files are locked).

This diff fixes the test to test the new desired behavior

Reviewed By: quark-zju

Differential Revision: D47489412

fbshipit-source-id: 733f51d485b81ba135c880182bd0c3ebfad5ef73
2023-07-17 11:57:25 -07:00
Jun Wu
9462d4e7df dag: log slow paths caused by incompatible VerLinks
Summary:
Add logging under `dag::algo` prefix about when slow paths are used due to
incompatible `VerLink`s. Bump slow paths to `warn` level. This would provide
insights about why slow paths are used.

Reviewed By: zzl0

Differential Revision: D47490348

fbshipit-source-id: 08b42ae2578906ddf39506715ce81b5121ec5578
2023-07-17 11:51:18 -07:00
Jun Wu
9b060a3c6e dag: preserve VerLink on open or persist
Summary:
On IdDag/IdMap open, try to reuse previously assigned VerLink.
On IdDag/IdMap persist/flush, cache the storage version with the current VerLink.

This should reduce "compatibility" issues when the Python world invalidates and
re-creates the changelog, as in `dbsh`:

  In [4]: v1=repo.changelog.dag.version()
  In [5]: repo.invalidatechangelog()
  In [6]: v2=repo.changelog.dag.version()
  In [7]: v1.cmp(v2)
  Out[7]: 0

For example, take the example in D47383634 summary, now

  r1.cmp(r2)

evaluates to `-1` instead of `None` meaning that r2 has
"append-only" changes on top of r1. Although we cannot
yet get rid of D47376881.

Reviewed By: zzl0

Differential Revision: D47488534

fbshipit-source-id: 33e9ec6294ce77f85b04d5d3af02d81a1a6c9282
2023-07-17 11:51:18 -07:00
Jun Wu
069dfdebf5 dag: remove remove_non_master API and tests
Summary: They are no longer needed as we now have more flexible "strip" APIs.

Reviewed By: zzl0

Differential Revision: D47488532

fbshipit-source-id: 932c1ff8b041aa663c7006cec3b572a91bee6647
2023-07-17 11:51:18 -07:00
Jun Wu
be9bf235ee indexedlog: expose Log::version like MultiLog::version
Summary: We have `MultiLog::version`. This diff adds `Log::version` to match the API.

Reviewed By: zzl0

Differential Revision: D47488531

fbshipit-source-id: 0be841c3f4c2263a9d88693ce44d63d904a199af
2023-07-17 11:51:18 -07:00
Jun Wu
ac42bea23b dag: add APIs to cache storage_version to VerLink mapping
Summary:
Today we recreate new `VerLink`s when loading `Dag` from disk. However, if the
on-disk content is not changed, we can actually reuse the old `VerLink` to enable
more fast paths. This diff adds APIs on `VerLink` to support that.

Reviewed By: zzl0

Differential Revision: D47488533

fbshipit-source-id: 1ffb1bd7ba84f1099506af829df7e6a4fc589ff4
2023-07-17 11:51:18 -07:00
Jun Wu
89c23bb9fb localrepo: revert no longer necessary D46590498
Summary:
D47482810 makes the Rust NameDag invalidate the "missing" cache. So D46590498
is no longer necessary.

Reviewed By: zzl0

Differential Revision: D47483597

fbshipit-source-id: f2d1fed0f26ae090f0b6981606e083f3d6dc0dbd
2023-07-17 11:51:18 -07:00
Jun Wu
78ad946636 dag: invalidate caches after importing (lazy) pull data
Summary:
Changing the graph require invalidating caches. `NameDag::import_pull_data`
forgot that. This diff adds the cache implementation.

This could be an alternative fix to D46590498.

Reviewed By: zzl0

Differential Revision: D47482810

fbshipit-source-id: e7091cd90c8e7e7228c51ffe60db18e27f983ecf
2023-07-17 11:51:18 -07:00
Jun Wu
76cd92ead7 dag: int_version -> storage_version
Summary:
Document that the "version" comes from the storage layer, and the storage
"append-only" concept is different from the commit graph "append-only".

Reviewed By: zzl0

Differential Revision: D47482811

fbshipit-source-id: 89cd2df5ee3a786d060d258505c965dcdc9f655a
2023-07-17 11:51:18 -07:00
Xavier Deguillard
9c55aea43d doctor: slightly change wording of "Blocked" VSCode extensions
Summary:
These aren't blocked so the wording is a bit misleading. The word "harmful"
better reflect their behavior, thus changing the name to be more explicit.

Reviewed By: genevievehelsel

Differential Revision: D47422985

fbshipit-source-id: 20f4fdaf7901449bb7a4864b757835b36a3e50d2
2023-07-17 08:24:53 -07:00
Jun Wu
8e62088a23 smartset: in fileteredset 'xs - ys', preserve prefetch fields of ys
Summary:
For revsets like:

  reverse(master~20::master) & not(file(r're:.*'))

the `file(...)` part sets the "text" prefetch field correctly, however the `xs & not(ys)`
(which is optimized to `xs - ys`) part loses the "text" prefetch field, causing
suboptimal 1-by-1 fetches.

This diff fixes the suboptimal fetches by copying prefetch fields from `ys` to
the `filteredset` returned by `xs - ys`.

Reviewed By: zzl0

Differential Revision: D47419750

fbshipit-source-id: 8925b9c8fab1a269c342d656692ff20c9167bf3f
2023-07-15 13:18:31 -07:00
Jun Wu
161349ac99 smartset: delegate filteredset.prefetch to its "subset"
Summary:
The fitleredset iteration happens on its "subset". Prefetch settings should
apply to the set that is iterated. So let's redirect prefetch APIs to the
subset.

The old `smartset.clone` implementation does not seem to preserve ordering.
The `prefetch` is updated to change prefetch fields of the `self` set directly
instead.

Reviewed By: zzl0

Differential Revision: D47419749

fbshipit-source-id: 26f6b927db5b4e7169f0d3f7e3766d5f7b696be3
2023-07-15 13:18:31 -07:00
Chad Austin
ac1434cbfe replace off_t file offsets with a new FileOffset type compatible with Windows
Summary:
off_t is not suitable on Windows because it is a 32-bit signed
type. Introduce a new FileOffset type for use in EdenFS.

Reviewed By: kmancini

Differential Revision: D47406784

fbshipit-source-id: 9cc9585b4b118c54a1ca148c2ba7e7ccfb6f278c
2023-07-14 16:23:19 -07:00
Michael Cuevas
ed903733db fix typo in comment
Summary: it bothered me

Reviewed By: fanzeyi

Differential Revision: D47480229

fbshipit-source-id: b7c63986fd4ac95b074b5673456ce5458d1cb62e
2023-07-14 13:47:43 -07:00
Chad Austin
f317c5ac30 add a getpid benchmark and have ProcessId::current use get_cached_pid on unix
Summary:
getpid() is an unconditional syscall on Linux/glibc. Therefore, it
costs about 250 nanoseconds. There are a couple places in EdenFS where
getpid() is an inner-ish loop so use folly::get_cached_pid() instead.

Reviewed By: kmancini

Differential Revision: D42044221

fbshipit-source-id: e9c8f8a00febeaf6c9a0a3481879040d739038f5
2023-07-14 12:14:40 -07:00
Jun Wu
0e058a36e4 Back out "phases: recalculate when the associated dag becomes incompatible"
Summary:
While the `public()` revset is updated, there could be other "stale" revsets
that are using incompatible versions that triggers slow paths.

Original commit changeset: c8a5c9e0d5dd

Original Phabricator Diff: D47384752

Reviewed By: fanzeyi

Differential Revision: D47478975

fbshipit-source-id: f4eca716bf4268e5ac1e750430f31de2c9751cb1
2023-07-14 12:02:13 -07:00
Jun Wu
018277adc2 changelog: skip commit hash verification for readfiles
Summary:
liubov-dmitrieva reported in P788939965 that commands like:

  hg log -r " reverse(master~1000::master) & not(file(r're:.*'))"

causes lots of 1-by-1 location -> hash lookups. This diff resolves it by
skipping the problematic code path:

  File "edenscm/revset.py", line 1456, in matches
    files = getfiles(x)
  File "edenscm/changelog2.py", line 382, in readfiles
    text = self.revision(node)
  File "edenscm/changelog2.py", line 495, in revision
    p1, p2 = self.parents(node)[:2]
  File "edenscm/changelog2.py", line 648, in parents
    parents = list(self.dag.parentnames(node))
  error.UncategorizedNativeError: Resolving id exceeds threshold 10 set by EDENSCM_REMOTE_ID_THRESHOLD

The troublesome code path was found by setting
`EDENSCM_REMOTE_ID_THRESHOLD=10`.

Reviewed By: zzl0

Differential Revision: D47417522

fbshipit-source-id: 2830e825a362c6a1ea26f2627fef65dd5b7dcf4b
2023-07-14 09:59:47 -07:00
Jun Wu
ec426ff2fe sshpeer: update bash script detection
Summary:
Now `#!/usr/bin/env bash` is used for bash scripts (by D47269779) we need to
update the bash detection for test compatibility.

Reviewed By: evangrayk

Differential Revision: D47457479

fbshipit-source-id: c6a449f53fb265f8a01d6368fe807e0b8bae03aa
2023-07-14 09:56:10 -07:00
Saul Gutierrez
200ff484a7 symlinks: make symlinks appear on Windows on checkout
Summary:
Partially enables symlink support on Windows by making symlinks appear on Windows as actual symlinks as opposed as regular files containing only the place where the symlink would point in other systems.

Creating new commits with symlinks also works (after editing `fscap.py` on hg's side as well as the requirements file for the current directory for enabling symlinks on Windows EdenFS) when the symlinks are in the same directory.

Reviewed By: xavierd

Differential Revision: D44218035

fbshipit-source-id: 0e3094dc5a13cabef1cd24f8fe18cc73ca40d4a8
2023-07-14 08:42:03 -07:00
Saul Gutierrez
26b1e9eb41 symlinks: add gating for TreeEntry:: getType and TreeEntry:: getDtype
Summary:
The methods mentioned in the title changed a bit on Windows, now allowing them to respond that a TreeEntry can be a symlink.

In order to gate this change, on Windows now there is a helper method that is used for reverting the changes for `TreeEntry:: getType` to its previous behavior, in order to be able to tell whether symlinks are enabled for the current Eden checkout or not. Where possible, (which is in most places) the config for whether symlinks are enabled or not on the Eden checkout is passed down.

The non-gated changes are kept since in those cases we actually want to register that a TreeEntry is actually a symlink, even when symlinks are "not enabled".

Originally this was intended to be part of D44218035, but was split for clarity.

Reviewed By: xavierd

Differential Revision: D47326228

fbshipit-source-id: be6cfae6626bf3a32aa119d25bf8b5fe6a549898
2023-07-14 08:42:03 -07:00
Daniel Mueller
9e296d8e9d Update num_cpus to 1.16.0
Summary:
Update num_cpus to version 1.16.0. We need this version as it is a requirement
of libbpf-sys v1.2.1+v1.2.0, which is to be imported subsequently.

Reviewed By: zertosh

Differential Revision: D47380958

fbshipit-source-id: d1fa12a1c8a974686d70d47876e990da4a73b839
2023-07-13 19:19:42 -07:00
Chad Austin
6c8c2ed747 clang-tidy advice
Summary:
clang-tidy had some automated suggestions for our code. Apply the ones
that make sense.

Some of them didn't, like removal of all uses of `volatile`. I
manually reverted those changes.

Reviewed By: genevievehelsel

Differential Revision: D41051052

fbshipit-source-id: 3fe22a91e929d3bb8e6346126c2c7bf9f027eb32
2023-07-13 16:30:55 -07:00
Chad Austin
cff6d95f19 break XAttr's dependency on folly/Range
Summary: We should prefer string_view over folly::StringPiece..

Reviewed By: xavierd

Differential Revision: D47406695

fbshipit-source-id: 0c557c1d933a8196f4c5b7fbe97c3ca8bda06bda
2023-07-13 11:52:33 -07:00
Chad Austin
1f36519be9 remove some unnecessary FOLLY_MAYBE_UNUSED
Reviewed By: genevievehelsel

Differential Revision: D47387429

fbshipit-source-id: 7d514560a40384384595a2849875f24ee3d16529
2023-07-13 11:47:00 -07:00
Chad Austin
4b3e01c644 gracefully handle getPeerEffectiveCreds returning nullopt
Summary:
I'm not sure when or how this is possible, but EdenFS should handle
the possibility that getPeerEffectiveCreds returns nullopt.

Reviewed By: genevievehelsel

Differential Revision: D47421072

fbshipit-source-id: c77746b5d9476e131fcb0173e13d63e36e4a61d9
2023-07-13 11:39:35 -07:00
James Gill
da30da5ee8 Add cookies and native-tls feature to reqwest
Summary: As title.

Reviewed By: Imxset21

Differential Revision: D47439588

fbshipit-source-id: 8c624c28e2e9987ed8050c1f7a3260b17a52b243
2023-07-13 10:31:30 -07:00
Chad Austin
4478dc3d1b print process ID and name in eden trace hg
Summary:
We have seen reports of people seeing unexpected fetch activity. This
diff plumbs process ID through HgImportRequest so it can be streamed
to `eden trace hg` output.

Reviewed By: kmancini

Differential Revision: D42040798

fbshipit-source-id: 0a18fba6a55e584a4334088efde761a7c1d8fe6e
2023-07-13 09:43:19 -07:00
Chad Austin
a71c8f532b replace some getpid calls with ProcessId::current()
Summary: Add an infallible ProcessId::current() to replace uses of gitpid() and GetCurrentProcessId().

Reviewed By: kmancini

Differential Revision: D42037244

fbshipit-source-id: b5b7dced241d0a70e9d43b40827d741d7049345d
2023-07-13 09:43:19 -07:00
Chad Austin
1ad34b0d2a migrate ObjectFetchContext to ProcessId
Summary:
Now that ProcessId exists, we should use it instead of pid_t in
ObjectFetchContext.

Reviewed By: genevievehelsel

Differential Revision: D42037216

fbshipit-source-id: 34cd89f78be35a15d73b26edc840e917fd642723
2023-07-13 09:43:19 -07:00
Rajiv Sharma
ea18dfc343 Fix clippy lints
Summary: As in title

Reviewed By: markbt

Differential Revision: D47365557

fbshipit-source-id: 103e5245a4f5fe486113c18fa7f54babe0cfea68
2023-07-13 01:14:52 -07:00
Zhaolong Zhu
cb2f6e0520 copytrace: add commit info to the rebase prompt message
Summary: Add additional context (commit and new file name) to the rebase prompt message, this will help avoid conflict resolution errors.

Reviewed By: quark-zju

Differential Revision: D47312287

fbshipit-source-id: 2ed162ae44eb518a33d23aa17f6720ad137d4a04
2023-07-12 19:17:32 -07:00
Zhaolong Zhu
e34b9eea27 pycopytrace: expose the commit info to Python world
Summary: expose the commit info to Python world, it will be used in the following diff to add more context to the rebase prompt messages

Reviewed By: quark-zju

Differential Revision: D47312286

fbshipit-source-id: c896d913660cabffc4c654ba83b8fa9a1e2b24ef
2023-07-12 19:17:32 -07:00
Zhaolong Zhu
a709d050dc copytrace: add the new path to the TraceResult::Deleted/Added
Summary: this will be useful to users as well

Reviewed By: quark-zju

Differential Revision: D47389984

fbshipit-source-id: 05a13e1085820a6dd779e230f9ae98df38243354
2023-07-12 19:17:32 -07:00
Chad Austin
fb91276d18 return SemiFuture from EdenServer::unmount and friends
Summary:
In preparation for unifying unmount() in FsChannel, return SemiFuture
from EdenMount::unmount.

Reviewed By: kmancini

Differential Revision: D45300725

fbshipit-source-id: 4eeb7a19d4140f9985c8a46dd357f7631ff9d490
2023-07-12 15:46:52 -07:00
Astrid Yu
8ba7f03849 third-party/rust: bump tokio v1.25.0 -> v1.29.1
Summary: Needed for reqwest QUIC support (requirement of ^1.28)

Reviewed By: zertosh

Differential Revision: D47304356

fbshipit-source-id: d39999373ae51f79123927a073f3073e21a10078
2023-07-12 15:32:56 -07:00
Jun Wu
8a3e58c6db test-debugstack: add assertions about status output
Summary:
This makes the test intention more explicit. Auto fix won't break the test
intention.

Reviewed By: sggutier

Differential Revision: D47412807

fbshipit-source-id: 1a8a12c7604753b4eb30a158460c17a237234799
2023-07-12 14:02:41 -07:00
Jun Wu
8ef5b1394d testing: use _ in Python >>> block as reference to last output
Summary: Similar to IPython, use `_` to refer to the previous output.

Reviewed By: sggutier

Differential Revision: D47412808

fbshipit-source-id: d3a72293fc2ae90f0326c1152a352fdf35a438ff
2023-07-12 14:02:41 -07:00
Jun Wu
fac766c79e tests: re-enable test-debugruntest
Summary:
The conch_parser is now part of bindings and no longer have import issues.
So let's enable the test.

Reviewed By: sggutier

Differential Revision: D47412806

fbshipit-source-id: 7392ec7fa0664dfe7d9d0c9d3878b59addcc9703
2023-07-12 14:02:41 -07:00
Chad Austin
1aaa69c3c2 remove some _WIN32 ifdefs
Summary: Now that Windows has an actual PrivHelper, we can remove some ifdefs.

Reviewed By: mshroyer

Differential Revision: D45300700

fbshipit-source-id: e5e59fafd95c1a44a51f5caa04331fb8d887d426
2023-07-12 13:55:55 -07:00
Chad Austin
765c5ec257 let Nfsd3 unmount itself
Summary:
Aiming towards moving unmount() into FsChannel, move the knowledge of
how to unmount an NFS mount into Nfsd3.

To support unmounting on Windows, we can eventually add an invocation
of unmount.exe to the Windows PrivHelper implementation.

Reviewed By: kmancini

Differential Revision: D45296963

fbshipit-source-id: 55fa7fe0f6190d3708caa21a0cd4b3868f464f8b
2023-07-12 13:55:55 -07:00
Chad Austin
599f9ce71f let FuseChannel unmount itself
Summary:
Aiming towards moving unmount() into FsChannel, move the knowledge of
how to unmount a FUSE mount into FuseChannel.

Reviewed By: kmancini

Differential Revision: D45296899

fbshipit-source-id: 3f270bcc21386224cf7472eb88c851ca1f718e8a
2023-07-12 13:55:55 -07:00
Mark Juggurnauth-Thomas
1d97be025b derived_data_manager: log remote derivation requests to request context scuba
Summary: Additionally log remote derivation requests to the main request context scuba table, so that they are visible in that table as well as the derived data table.

Reviewed By: mitrandir77

Differential Revision: D47340735

fbshipit-source-id: 6a538c9a69bc832561cd2dbb3870a2654934119c
2023-07-12 11:59:11 -07:00
Mark Juggurnauth-Thomas
84d4a2ebf1 derived_data_manager: add methods for logging remote derivation
Summary: Extract the logging of remote derivation requests to new methods on `DerivedDataScuba`.  Their behaviour should be the same.

Reviewed By: RajivTS

Differential Revision: D47340734

fbshipit-source-id: 106785cde002a763d3988366aefa8c51742fb49c
2023-07-12 11:59:11 -07:00
Mark Juggurnauth-Thomas
591bc103c1 derived_data_manager: extract scuba logging methods to a custom type
Summary: The scuba logging methods on derived data manager require the caller to carry around the scuba sample builder.  Simplify this by extracting it to a custom type that holds the sample builder, along with type information about the derived data type.

Reviewed By: RajivTS

Differential Revision: D47340736

fbshipit-source-id: 6372335acd5375a67ca9814add2721e2d96ffda1
2023-07-12 11:59:11 -07:00
Jun Wu
8d33cfc187 debugstack: support write files to working parent version
Summary: This is useful for "Discard" (revert -i).

Reviewed By: evangrayk

Differential Revision: D47284286

fbshipit-source-id: 13a79d73e8ef3c298fdc9b0fbde666ca587c61cf
2023-07-12 10:51:11 -07:00
Jun Wu
dff2f975dc debugstack: support amend
Summary:
While technically one can use debugexportstack to export a commit, then
debugimportstack repeating the commit's content to achieve amend. The ISL
"Operation" is abstracted around one instead of two commands. We need
one-command amend. This diff updates debugimportstack to support one-command
amend.

Reviewed By: zzl0

Differential Revision: D47282370

fbshipit-source-id: 54026766d91cc0e073b9e76b27ea98b9809bcedb
2023-07-12 10:51:11 -07:00
Liubov Dmitrieva
0caae481fb fix routing keys
Summary:
fix routing keys

the original keys contain both hg id and path making them long

we don't need to take into account the path part of the key for routing purposes

Reviewed By: clara-9

Differential Revision: D47395901

fbshipit-source-id: c5b18e437490c14b810c555cd10a68000e52d088
2023-07-12 10:03:24 -07:00
Jun Wu
778f83b9aa phases: recalculate when the associated dag becomes incompatible
Summary:
An alternative to D47376881. Instead of invalidating `public()` manually, let's
detect potential slow paths and invalidate them on access automatically.

The `draft()` set is considered small and skips this check for now.

Reviewed By: zzl0

Differential Revision: D47384752

fbshipit-source-id: c8a5c9e0d5ddd131a86890550a67141a1ddb6d65
2023-07-12 08:49:15 -07:00