Commit Graph

64935 Commits

Author SHA1 Message Date
Andrey Chursin
efcc5d91a7 checkout: create CheckoutPlan from ActionMap
Summary:
This and following diff will refactor CheckoutPlan creation.

Right now we create CheckoutPlan from manifest diff and then manipulate it with methods like `with_sparse_profile` to adjust plan for different cases.
Those 'adjustment' do not work great with the structure of CheckoutPlan, for example `with_sparse_profile` has to create temporary HashSet just to index files in CheckoutPlan
We are going to add more adjustments in the future (for example, checkout --clean), and will run into same issues with current structure of CheckoutPlan

To avoid those issues, we are going to refactor this code, so that instead of Diff -> CheckoutPlan -> adjustments, we are going to have Diff -> ActionMap -> adjustments -> CheckoutPlan

The structure of CheckoutPlan is still good for it's direct purpose (execution), but all the 'changes' to the plan will be done in ActionMap instead.

Reviewed By: DurhamG

Differential Revision: D27980390

fbshipit-source-id: 403f371fd2fe7760984925a38429e1bfb88d8e3f
2021-04-27 13:33:25 -07:00
Andrey Chursin
3d01cbc5d9 checkout: use native checkout on dirty copy
Summary: For now this does not work with --clean flag(fallback to regular checkout in that case)

Reviewed By: quark-zju

Differential Revision: D27953967

fbshipit-source-id: 71c097cf1e395ff2cba2f4ee528145d3b2c83c23
2021-04-27 13:33:25 -07:00
Andrey Chursin
4d87e066ce checkout: add bindings for checking status conflicts
Reviewed By: quark-zju

Differential Revision: D27953966

fbshipit-source-id: 549796c0aa85c604d0b0d404929da4e371471e49
2021-04-27 13:33:25 -07:00
Andrey Chursin
3a0ed3f7ab checkout: separate native checkout code in merge.py into separate function
Reviewed By: quark-zju

Differential Revision: D27953968

fbshipit-source-id: 0bc80f0851d02795a02cc24344d878e4d4a6400c
2021-04-27 13:33:25 -07:00
Andrey Chursin
052685b356 status: introduce hg status bindings
Summary: This crate does not calculate status, but allows to convert python status into rust status, that can later be used by python code

Reviewed By: quark-zju

Differential Revision: D27953962

fbshipit-source-id: ab91d9d035140e43d8b17988b24bd030af77c96d
2021-04-27 13:33:24 -07:00
Andrey Chursin
cb550463d9 checkout: check status conflicts in native checkout
Summary: When checking out on dirty copy without --clean this function can be used to check if checkout operation conflicts with currently modified files

Reviewed By: quark-zju

Differential Revision: D27953965

fbshipit-source-id: 4096506e4cbf8b102e0afa1a929c066dfa474825
2021-04-27 13:33:24 -07:00
Andrey Chursin
9c1d0266af status: introduce status crate
Summary:
This crate introduces consumer API for status in rust
Currently the implementation will just take status from Python and convert it into this struct
But in the future we can get pure Rust implementation to get status

Reviewed By: quark-zju

Differential Revision: D27953963

fbshipit-source-id: 29c876400c82056eaf81fffa4adc814473853c1e
2021-04-27 13:33:24 -07:00
Andrey Chursin
2b781b75f9 types: introduce RepoPath:to_lowercase
Summary: This method can be used to 'normalize' path for case insentive use cases

Reviewed By: quark-zju

Differential Revision: D27953964

fbshipit-source-id: 421832af22af9a3b56eec0d045b9f983592ed192
2021-04-27 13:33:24 -07:00
svcscm svcscm
4fad2642ac Updating submodules
Summary:
GitHub commits:

a1f7eb3f51
2979dad951
cfea4897bb
f8fb198623
3a0dfb3c9b
4e65bc2b1b
592602c965
1688870298
37dbe99653
ca638bbfc3
d95cf7af38

Reviewed By: jurajh-fb

fbshipit-source-id: 07871b9bcdd57e8b09f0ac8d66cccc7f0a219519
2021-04-27 13:11:03 -07:00
svcscm svcscm
bed167d0a7 Updating submodules
Summary:
GitHub commits:

89a51b51b1
ab5d1a0b5b
796507d39f
81b6e4b8f9
65abb0cf71
b589bc0148
cbb5c79b9c
0a6578d072

Reviewed By: jurajh-fb

fbshipit-source-id: 2a93e2ff30541b9f1598f996f859b1aa2cbfffe0
2021-04-27 11:42:24 -07:00
Stefan Filip
bf14b9d5c7 edenapi_service: fix stats for bookmarks endpoint
Summary:
Fix missing stats for the bookmarks endpoint because we have the wrong name in
code.

Reviewed By: quark-zju

Differential Revision: D28008091

fbshipit-source-id: 128fe00e00a06ebe9b65fb11512cd03a042d55fe
2021-04-27 11:16:40 -07:00
Thomas Orozco
eb3f97b858 mononoke/gotham_ext: remove ForwardErr
Summary: This is not used anymore.

Reviewed By: sfilipco

Differential Revision: D27998038

fbshipit-source-id: 7f8de56897931d72e6bc3405b463a2302d5da6a3
2021-04-27 11:00:16 -07:00
Thomas Orozco
f8e523e74d mononoke/edenapi_service: stop using forward_err
Summary:
This doesn't link the errors into Scuba, which makes it not very useful for
debugging, since we're not routinely looking at stderr on our tasks, and makes
it impossible to e.g. look anywhere and find a count of failed requests.

Instead, update this to use `capture_first_err`, which will report both the
first error and the total error count to Scuba.

Reviewed By: sfilipco

Differential Revision: D27998037

fbshipit-source-id: b941d44a2ac21bbf640b9bc977de749207f12d9a
2021-04-27 11:00:16 -07:00
Thomas Orozco
f1a4c3e615 mononoke/gotham_ext: introduce CaptureFirstError
Summary:
In EdenAPI, most endpoints don't raise errors when they fail, and instead just take items out of the response stream (though there are some exceptions: D24315399 (0ccae1cef9).

Right now, this just gets logged to stderr, which isn't great. This diff introduces a CaptureFirstError wrapper we can use to capture those errors and expose them in post-response callbacks (i.e. Scuba).

Reviewed By: sfilipco

Differential Revision: D27998036

fbshipit-source-id: 960d0e09a82ca79adfafe22e2eeef2e0294d27dc
2021-04-27 11:00:16 -07:00
Jun Wu
c85640bfef distutils_rust: prefer lld as the linker
Summary:
`lld` is faster than `ld.gold`.

To compare, `make local3`, then add a blank line in `hgmain`, then run `make
local3` again.

Using `lld`:

  building 'hgmain' binary
     Compiling hgmain v0.1.0 (/home/quark/fbsource-lazy/fbcode/eden/scm/exec/hgmain)
      Finished release [optimized + debuginfo] target(s) in 3.73s
  building 'mkscratch' binary
      Finished release [optimized] target(s) in 0.37s
  building 'scm_daemon' binary
      Finished release [optimized] target(s) in 0.42s

Using `ld.gold`:

  building 'hgmain' binary
     Compiling hgmain v0.1.0 (/home/quark/fbsource-lazy/fbcode/eden/scm/exec/hgmain)
      Finished release [optimized + debuginfo] target(s) in 10.15s
  building 'mkscratch' binary
      Finished release [optimized] target(s) in 0.39s
  building 'scm_daemon' binary
      Finished release [optimized] target(s) in 0.46s

Reviewed By: ikostia

Differential Revision: D28006551

fbshipit-source-id: 55b19be93d8152634d79ed92c9cd53237f91b820
2021-04-27 10:30:48 -07:00
Aida Getoeva
eeb7c00c7f mononoke/mysql: move raw xdb API to shed/sql:sql_facebook
Summary:
This raw XDB connections API is not used in Mononoke although there are projects depending on it.

The API creates connection objects based on shed/sql crate.
This diff moves `SqlConnections` into `shed/sql:sql_common`, closer to the `Connection` definition, and moves `create_raw_xdb_connections` API into the `shed/sql:sql_facebook::raw`.

Reviewed By: krallin

Differential Revision: D28003638

fbshipit-source-id: ea4a29b6e239a89c97237877e2dfde4c7c7ff89b
2021-04-27 10:20:33 -07:00
Jun Wu
ad6b424474 config: enable selectivepull by default
Summary:
It turns out during the initial clone, we're not using selectivepull for some
tiers that do not have the non-repo selectivepull config.

We've been using selectivepull for devservers and corp (and it's effective
during clone) for a long time. Let's just enable it by default so even if
dynamicconfig does not set it properly, we can still use selectivepull clone
to avoid pulling 10k+ remote bookmarks (which triggers auto bookmark cleanups
as logged in hgfeatures).

There are too many incompatible tests so I'm not migrating them for now.

Reviewed By: DurhamG

Differential Revision: D28006488

fbshipit-source-id: f0dc000156abde530fd8881bd26b4642a36167be
2021-04-27 10:10:07 -07:00
Ilia Medianikov
2df2d3c678 mononoke/pushrebase: remove re-exporting of hook definitions from the crate
Summary:
As I split the pushrebase crate in D27968029 (93b8cf116b) it makes sense to stop re-exporting hook definitions from it.
This change will also make dependencies more accurate.

Reviewed By: krallin

Differential Revision: D28028045

fbshipit-source-id: 622ef5d7db737e19153109f4d2dcefe54fba2bb4
2021-04-27 09:53:36 -07:00
Stanislau Hlebik
c35a78c649 mononoke: add a tool to copy blobs from one repo to another
Reviewed By: krallin

Differential Revision: D28024373

fbshipit-source-id: 4954f6d322f924b9291326ef5a948a1c52230955
2021-04-27 08:54:34 -07:00
Thomas Orozco
006932c7bc mononoke/gotham_ext: remove DefaultScubaHandler
Summary: It's not used.

Reviewed By: mitrandir77

Differential Revision: D27967990

fbshipit-source-id: 0c332e6ef44af369fdd943a759342210f2e65e4a
2021-04-27 08:10:34 -07:00
Thomas Orozco
d68e8343e6 mononoke/gotham_ext: capture errors from EndOnErr
Summary:
Finally! This is basically the end goal of this stack (though we still need to
do the same thing with the "ForwardErr" combinator used by EdenAPI next).

With this, we can now capture errors that occur while sending the response
stream, instead of just errors that occur while producing the response (which
is usually a little piece of the work we have to do).

Reviewed By: mitrandir77

Differential Revision: D27967991

fbshipit-source-id: a5483c58f0550a19e711e712cf860d9328a0eb9e
2021-04-27 08:10:34 -07:00
Thomas Orozco
79d06afa5d mononoke/gotham_ext: rename ContentMeta trait
Summary:
`ContentMeta` sounds a lot like a struct containing content metadata, so let's
rename this to something less ambiguous (`ContentMetaProvider`).

The reaosn I'm doing this now is because I'd like to introduce a similar
trait for errors that occur on our response streams and there I'll need
both a struct and a trait.

Reviewed By: mitrandir77

Differential Revision: D27998039

fbshipit-source-id: f0372c62d13167ef4bd07cb9e9e9fb75ea105b9a
2021-04-27 08:10:34 -07:00
Thomas Orozco
2319315b16 mononoke/gotham_ext: report errors via PostResponseInfo
Summary:
Like it says in the title. The goal here is to make it not matter where the
error came from. In this diff, we capture the same errors as before, but we
do it via PostResponseInfo instead of via ad-hoc things in our `State`.

Reviewed By: mitrandir77

Differential Revision: D27967994

fbshipit-source-id: dbbb1a8f5ea1a439089c41b4a08cd6088476ae33
2021-04-27 08:10:34 -07:00
Thomas Orozco
1268f3221d mononoke/gotham_ext: deduplicate a bit of code
Summary: Like it says in the title.

Reviewed By: mitrandir77

Differential Revision: D27967992

fbshipit-source-id: 0deb4d90538a6889bee6b41de4c5d1533b29519b
2021-04-27 08:10:34 -07:00
Thomas Orozco
c3b1479215 mononoke/gotham_ext: move error formatting out of HttpError
Summary:
Very small refactor. I want this stuff to all be in the same module instead
of spread across `response` and `error`.

Reviewed By: mitrandir77

Differential Revision: D27967993

fbshipit-source-id: aca22f952d756d298e5e342f0c4f8ebd31f108bf
2021-04-27 08:10:34 -07:00
Thomas Orozco
fe3419ff98 mononoke/gotham_ext: unify response meta for deferred vs. immediate responses
Summary:
This is a bit of an abstract change, but the goal of this change is to make
post-response handlers oblivious to the distinction between sending a response
(or failing to send one) and returning a response that actually contains a
(fallible) stream.

The underlying / ultimate goal here is to move our error reporting out of
ad-hoc router wrappers where we call `set_error_message` on some context
entity, and to instead move it into post-response callbacks.

The upshot of that is that if we fail to send a response even though we sent a
200 from the handler, we'll be able to log it! Indeed, remember that when
sending a streaming response, we have to send a 200 to start streaming but we
might hit an error producing later parts of the response!

Reviewed By: mitrandir77

Differential Revision: D27966422

fbshipit-source-id: ab49639bfcc4af23ddc2e84181278f105ebb28b9
2021-04-27 08:10:34 -07:00
Thomas Orozco
8315a7c0a9 mononoke/gotham_ext: rename PostRequest to PostResponse
Summary:
This stuff runs after we sent the response, so PostResponse is a more
appropriate name than PostRequest.

Reviewed By: ikostia

Differential Revision: D27966420

fbshipit-source-id: 1f7b7a55490f731eb512793024bcfafb0ea4ef79
2021-04-27 08:10:34 -07:00
Thomas Orozco
0205634fe1 mononoke: unify lfs & edenapi response factories
Summary:
Those two have historically used different (but largely copy pasted) code to
produce their responses. Let's unify them by

While in there, let's also modernize the formatting a little bit by letting
anyhow do the formatting for us (we used to use `failure` when this code was
written, and it didn't do it).

There's a bit of ugliness here in the sense that out formatting is injecting
the error into the state so it can be logger later. This is equivalent to what
we had, but it's kinda clonwy. That said, I'm working on refactoring our error
handling in this stack, so the plan is to clean this up (i.e. it won't stay
very long).

Finally, note that this diff removes the `ResponseCreationFailure` error kind
in LFS. This is replaced by a `.context()` in `gotham_ext`. That said, we never
really use this stuff: creations are fallible in Hyper but you only run into
an error if you e.g. forget to add a status code, so we don't expect them to
actually occur outside of development.

Reviewed By: mitrandir77

Differential Revision: D27966421

fbshipit-source-id: 097f3b69f25fe39f8fbef925a272e88199896b39
2021-04-27 08:10:34 -07:00
Thomas Orozco
22e5458127 mononoke/gotham_ext: split up & rename content stream module
Summary:
Like it says in the title, I'd like to use names that reflect that this isn't
just *any* content stream: it's specifically for responses.

Reviewed By: ahornby

Differential Revision: D27964045

fbshipit-source-id: 50530cf85ba7840a2baa14151351d0b288d9ae70
2021-04-27 08:10:34 -07:00
Thomas Orozco
5c830dd5e1 mononoke/gotham_ext: move response-related things into a response module
Summary:
We have a set of things that are meant to be used together that are spread
across 3-4 different modules. Let's move them together. This also allows us to
make some things (e.g. the `ContentMeta` trait) private as they're no longer
needed.

Note: this diff only move stuff around & renames things a bit. I'll also split
some of those modules in the next diff.

Reviewed By: HarveyHunt

Differential Revision: D27964047

fbshipit-source-id: 02528d84adfd70ec346c32163cb185d89266a53e
2021-04-27 08:10:34 -07:00
Thomas Orozco
47654a9d51 mononoke/gotham_ext: move content_encoding to its own top level module
Summary:
We have a module called "content" that contains two completely unrelated
things: some enums for content encodings (+ associated parsing), and our output
streams.

I'd like to add more of said output streams, so let's clean this up.

Reviewed By: HarveyHunt

Differential Revision: D27964046

fbshipit-source-id: b42e56aa3fadaf9b93a44216977da19d950a16b9
2021-04-27 08:10:34 -07:00
Thomas Orozco
e5cc9a1f3d mononoke: remove now-unnecessary stream spawning
Summary:
We used to have to do this because of overly strict trait bounds in Hyper, but
we no longer do, so let's get rid of it. Note that we have one Tokio task per
request, and polling the response stream is basically the only thing that task
does, so this should make little difference as far as task scheduling is
concerned besides avoiding unnecessary context switches.

Reviewed By: ahornby

Differential Revision: D27963458

fbshipit-source-id: 24e762eb173156dab909fefe11dcf2d58272048a
2021-04-27 08:10:34 -07:00
Thomas Orozco
9e36520024 mononoke/gotham_ext: remove FuseOnErr
Summary: We don't use this anymore. Might as well remove it.

Reviewed By: ahornby

Differential Revision: D27963411

fbshipit-source-id: a6ac337936e8b2bd788dd79a835eef11b19dde70
2021-04-27 08:10:33 -07:00
Kostia Balytskyi
29c95d2b38 blobstore: fix confusing comment about an exported macro
Reviewed By: StanislavGlebik

Differential Revision: D28026865

fbshipit-source-id: 57701d59fe6048e78ceebd32ed7e0437e052c305
2021-04-27 07:57:21 -07:00
Jan Mazur
e99d51877b cacerts for lfs no longer needed on OSX
Summary: It has been fixed and we now set auth config with higher priority anyway.

Reviewed By: johansglock

Differential Revision: D28026081

fbshipit-source-id: 7086b48139bb05ffadd782898a1758ae06236aca
2021-04-27 07:43:08 -07:00
Kostia Balytskyi
8a273fbd9d mononoke_api: use TestMononokeMegarepoConfigs depending on cli
Summary:
This change makes it so that our binaries do not instantiate a real configo
client in integration test setup.

Reviewed By: ahornby

Differential Revision: D28026790

fbshipit-source-id: 0fb9ce66a1324e845f4b8a80d4479263ec6e4ee1
2021-04-27 06:37:34 -07:00
Alex Hornby
923c6c6b52 mononoke: introduce WrappedPathHash to walker
Summary:
First, some background on the existing WrappedPath type:   In Mononoke the MPath type is such that  None==Root and Some(MPath)==NonRoot. This means that where a path may be present one needs to use double-Option with Option<Option<MPath>>, so that Root is Some(None).

To reduce the need for double Option, and subsequently to allow for newtype features like memoization, the walker has WrappedPath, so we can use Option<WrappedPath> instead.

This change introduces a similar type WrappedPathHash for MPathHash, which means that the sample_fingerprint for WrappedPath can be now be non-optional as even root paths/manifests can now have a sample_fingerprint.

Reviewed By: mitrandir77

Differential Revision: D27995143

fbshipit-source-id: b674abd4ec94749f4f5797c697ae7381e1a08d02
2021-04-27 06:00:02 -07:00
Alex Hornby
3f56e43575 mononoke: collect walker logging for packer
Summary:
This adds the first part of new logging from the walker that can be used to gather details on what keys might make sense to pack together.

Unlike the corpus command that dumps file content by path (which was useful for analysis on compression approaches), this adds logging to the scrub command that includes the path hash rather than the full path.  This should keep memory usage down during the run,  hopefully mean we log from existing scrub jobs and and mean the logs are more compact.

Reviewed By: mitrandir77

Differential Revision: D27974448

fbshipit-source-id: 47b55112b47e9b022f16fbb473cf233a7d46bcf3
2021-04-27 06:00:02 -07:00
svcscm svcscm
5d0136b009 Updating submodules
Summary:
GitHub commits:

a3f497c0cf
11b12c571a
536ead4854
ffaf2e92f5

Reviewed By: jurajh-fb

fbshipit-source-id: 07aab8494e7751a33eb47a9c301214da6c1971b8
2021-04-27 05:09:36 -07:00
CodemodService Bot
da5ae9e8f4 Daily arc lint --take BLACK
Reviewed By: zertosh

Differential Revision: D28024201

fbshipit-source-id: 8b9d7978c82f8a6c39eb7d9875ab86d0d9404793
2021-04-27 03:58:23 -07:00
CodemodService FBSourceClangFormatLinterBot
f5fd3ab02e Daily arc lint --take CLANGFORMAT
Reviewed By: zertosh

Differential Revision: D28023983

fbshipit-source-id: 338cef4bbe87e39d1cc200f3ff3d90f03af329d2
2021-04-27 03:55:25 -07:00
Ilia Medianikov
449fd2fd02 mononoke/pushrebase_hooks: add a hook that saves prepushrebase changeset id
Summary:
Knowing the prepushrebase changeset id is required for retroactive_review.
retroactive_review checks landed commits, but verify_integrity hook runs on a commit before landing. This way the landed commit has no straightforward connection with the original one and retroactive_review can't acknowledge if verify_integrity have seen it.

Reviewed By: krallin

Differential Revision: D27911317

fbshipit-source-id: f7bb0cfbd54fa6ad2ed27fb9d4d67b9f087879f1
2021-04-27 03:52:50 -07:00
Ilia Medianikov
93b8cf116b mononoke/pushrebase: split pushrebase crate
Summary:
Split pushrebase crate into pushrebase hook definition and pushrebase implementation.
Before this change it was impossible to store an attribute in BlobRepo that would depend on PushrebaseHook as it would create a circular dependency `pushrebase -> blobrepo -> pushrebase`.

Reviewed By: krallin

Differential Revision: D27968029

fbshipit-source-id: 030ef1b02216546cd3658de1f417bc52b8dd9843
2021-04-27 03:52:50 -07:00
svcscm svcscm
dc21d219b0 Updating submodules
Summary:
GitHub commits:

4a651c7987

Reviewed By: jurajh-fb

fbshipit-source-id: 218457d5ec58403b1f7bf0e2d40d18eb175b70d6
2021-04-27 03:43:21 -07:00
svcscm svcscm
1cbdb94376 Updating submodules
Summary:
GitHub commits:

a3f673ef84
dfb89f4f76
ce96ec6e72
3ba34cbfca

Reviewed By: jurajh-fb

fbshipit-source-id: 0f3da28060e45cf51f0c6ef2f7d6cc1709ffa047
2021-04-27 01:02:44 -07:00
svcscm svcscm
b43f699610 Updating submodules
Summary:
GitHub commits:

302b9b6173
943e678957
3a6e9364b1
d400ed60aa
fc3e68cf8d
d6b4d51b24

Reviewed By: jurajh-fb

fbshipit-source-id: 2f781c3b0bf54ef913d84d36a19472313daad30f
2021-04-26 23:32:08 -07:00
svcscm svcscm
b1b824e9a0 Updating submodules
Summary:
GitHub commits:

b50e23d91c
eb743843aa
682afcb671
b81618087c
7d6384f4c7
67c6502359
8eaea9c444
db3bbc3360
42763981d1

Reviewed By: jurajh-fb

fbshipit-source-id: edb1f63f14aa2db9da464cd96ceff3418443b661
2021-04-26 22:14:46 -07:00
svcscm svcscm
1080fb5ce3 Updating submodules
Summary:
GitHub commits:

9e0240aeb0
8496ee5d57
5a030c3c68
c5d18e3488
9b7882af74
2ca3999e75
f4ae7472ea
eca3055ddf
c0a62a4448
a8f96f0dce
00cd3c4bd5
6f1e2e94a1

Reviewed By: jurajh-fb

fbshipit-source-id: 7242f9ca73dd1ebe369cd35659325fdd28e2fa33
2021-04-26 21:01:31 -07:00
svcscm svcscm
31ee5060ea Updating submodules
Summary:
GitHub commits:

bbf19a1d15
b4763d9487
56f1e7f88c
e5cb25c200
eebbd21e12
5076068850
02d3764834
16a9555643
daad7a0a0c
acd176a750
5ed7cdc2f8
5a0451760a

Reviewed By: jurajh-fb

fbshipit-source-id: b9309523a2d93283530f76372eab47afcaee2a23
2021-04-26 18:03:40 -07:00
Jun Wu
f09500ec1f scmutil: handle int in revrange correctly
Summary:
It's rare (only seem to be used by chistedit) but if revrange got an int, the
expected behavior is to treat it as a revision number.

Reviewed By: kulshrax

Differential Revision: D27983989

fbshipit-source-id: f9f8d9cb39af4ec1de7ed8ca69f7f1879b4a4614
2021-04-26 17:42:43 -07:00