Commit Graph

65 Commits

Author SHA1 Message Date
Siddharth Agarwal
c652345586 blobrepo: optionally verify that provided and computed entry hashes are consistent
Summary:
We know that the hashes for non-root-tree-manifests and filenodes
should always be consistent. Verify that.

Reviewed By: farnz

Differential Revision: D7704087

fbshipit-source-id: 7f6207878c5cd372b272aa6970506dd63b5a3c7c
2018-04-20 08:40:54 -07:00
Siddharth Agarwal
9b5ee510cb blobrepo: use the incoming provided hash as the blobstore key instead of computing it
Summary:
As the comment explains, sometimes the hashes don't match the
contents. Accept such pushes.

Reviewed By: farnz

Differential Revision: D7699930

fbshipit-source-id: 376f01b6cf03f6cad84c2c878d192d55f8d81812
2018-04-20 08:40:54 -07:00
Siddharth Agarwal
9e49e6da1a blobrepo: make upload_entry arguments named, move to Hg domain
Summary:
We're going to keep this around for now as part of double-writing.
All the hashes here are definitely Mercurial hashes, so use them that way.

Reviewed By: lukaspiatkowski

Differential Revision: D7683890

fbshipit-source-id: 270091cd11f3cec7ef4cf565de5ef913fcf7adea
2018-04-20 08:40:54 -07:00
Siddharth Agarwal
3591b86b9f mercurial: switch file::File to HgNodeHash
Summary:
file::File works entirely in the Mercurial domain, so these
conversions are good.

Reviewed By: StanislavGlebik

Differential Revision: D7665973

fbshipit-source-id: 8a192c5d1886492ad21593693b080c8e5ddf8f7e
2018-04-20 08:40:54 -07:00
Siddharth Agarwal
ed1c842dcd blobrepo: rename BlobEntry to HgBlobEntry
Summary:
This is because these Mercurial entries are (at least currently) going
to be stored as they come in, and this data structure is entirely in the
Mercurial domain.

Reviewed By: lukaspiatkowski

Differential Revision: D7664972

fbshipit-source-id: 9de5475eed0d7ab7085c29fd0282f205043cfe5a
2018-04-20 08:40:54 -07:00
Siddharth Agarwal
65e4e05ed1 bundle2-resolver: also upload Thrift-encoded content blobs
Summary:
This is the first step to getting bonsai changesets into the blob store.

So far the code just waits for content blob uploads to be done. In future diffs Mononoke will synthesize this information into a bonsai changeset as well.

Reviewed By: lukaspiatkowski

Differential Revision: D7627784

fbshipit-source-id: da0c96772ce4d18aed579cecca6135137a8dbe18
2018-04-20 08:40:54 -07:00
Siddharth Agarwal
51d9316db8 bundle2-resolver: rename a couple of type aliases
Summary: In the next diff this code is going to start using `ContentBlob` instances. To avoid confusing Mononoke blobs with Mercurial ones, rename these types and add an `Hg` prefix.

Reviewed By: StanislavGlebik

Differential Revision: D7661571

fbshipit-source-id: 4985cc0c7934667966ca60b64bef349af853c2a0
2018-04-18 19:53:34 -07:00
Siddharth Agarwal
41824251b8 bundle2-resolver: add some comments around the use of Shared
Summary:
This confused me at first -- took me a while to figure out what's going on
here. Hopefully these comments will help the next person who stares at this
code.

Reviewed By: StanislavGlebik

Differential Revision: D7659993

fbshipit-source-id: a009041501f9108d2c01532e9df793cfcecb5496
2018-04-18 19:53:34 -07:00
Siddharth Agarwal
1cd28c2587 blobrepo: use named args for creating a changeset
Summary:
The list of arguments is becoming too long, and I need to add even
more here.

Reviewed By: StanislavGlebik, farnz

Differential Revision: D7652096

fbshipit-source-id: 62a4631e163e95cf5c950a949e72facab629ea54
2018-04-18 19:53:34 -07:00
Siddharth Agarwal
6546e61866 bundle2-resolver: encapsulate related blobs in a struct
Summary: Going to add more to this in upcoming diffs.

Reviewed By: StanislavGlebik

Differential Revision: D7652094

fbshipit-source-id: e52e248c64f5a754ad0c3abe54ca38a4a32514d5
2018-04-18 19:53:34 -07:00
Siddharth Agarwal
3925a39658 bundle2-resolver: pass around ChangegroupPush
Summary:
I'm going to add more stuff to this and I don't want to keep adding
parameters to `upload_changesets`

Reviewed By: StanislavGlebik

Differential Revision: D7648077

fbshipit-source-id: 9b0cbf3efe1bd8d43c0b3c5269c9119f0075428c
2018-04-18 19:53:33 -07:00
Siddharth Agarwal
4b607998bf mercurial: some improvements to File API
Summary:
Now that `BlobNode` no longer returns `None`:

* don't expose the `BlobNode` API outside the crate because it turns out to not be very useful (it should probably go away eventually?)
* make the `File` API not return `Option` types
* Add a new `file_contents` that returns a brand-new `FileContents` (this is the first time we're tying together Mercurial and Mononoke data structures!)

Also remove a `Symlink` API that isn't really correct honestly.

Reviewed By: StanislavGlebik

Differential Revision: D7624729

fbshipit-source-id: 38443093b8bfea91384c959f3425cf355fac9f65
2018-04-17 11:37:29 -07:00
Lukas Piatkowski
10857e6a37 CODEMOD: rename mercurial::BlobNode to HgBlobNode
Reviewed By: sid0

Differential Revision: D7620628

fbshipit-source-id: 8d616c3b9cd3342f71155f11bcef4feb760ddf0e
2018-04-16 03:40:25 -07:00
Lukas Piatkowski
2e0522f884 CODEMOD: rename mercurial::EntryId to HgEntryId
Reviewed By: sid0

Differential Revision: D7620299

fbshipit-source-id: 9bc1505473567528d1f174ae0f0f1312af187814
2018-04-16 03:40:25 -07:00
Lukas Piatkowski
4c4a06c4fe CODEMOD: replace mercurial::{HgChangesetId, HgManifestId, HgNodeHash} with {HgChangesetId, HgManifestId, HgNodeHash}
Summary: The Hg prefix is unique now so let's not use verbose mercurial::

Reviewed By: sid0

Differential Revision: D7620112

fbshipit-source-id: 0aece310ed817445fef4c94b32f78fda3a3b1c49
2018-04-16 03:40:25 -07:00
Lukas Piatkowski
03255529fa CODEMOD: rename mercurial::NodeHash to HgNodeHash
Reviewed By: sid0

Differential Revision: D7619973

fbshipit-source-id: 229fea891788c33eb1f45446ba2333e945ca5553
2018-04-16 03:40:25 -07:00
Lukas Piatkowski
f6c3f72745 CODEMOD: rename mercurial_types::HgChangesetId to DChangesetId
Summary: mercurial_types::DChangesetId should be replaced by types from mononoke_types in most cases and by mercurial::HgChangesetId in others. This rename should help with tracking this

Reviewed By: sid0

Differential Revision: D7618897

fbshipit-source-id: 78904f57376606be99b56662164e0c110e632c64
2018-04-16 03:40:24 -07:00
Siddharth Agarwal
497daaa17f bundle2-resolver: switch filelog from using HgBlob to Bytes
Summary:
I'm adding a non-`HgBlob` path separately, and using `HgBlob` here is
inconvenient.

Reviewed By: StanislavGlebik

Differential Revision: D7589854

fbshipit-source-id: 21e425e7d70691b982dbd66b1ea4996d1e0eef66
2018-04-13 11:34:14 -07:00
Corbin Hall
ba4c029396 Update Mononoke to use with_context on futures/streams
Summary: Migrates some uses of `.map_err()` and `.context(format!())` usage in Mononoke to `.with_context()`

Reviewed By: lukaspiatkowski

Differential Revision: D7607935

fbshipit-source-id: 551538c78a1755f7aa0716532ab437a1baf6dd89
2018-04-13 11:00:42 -07:00
Lukas Piatkowski
dd3c638c1d api cleanup: clean api of mercurial and mercurial_types NodeHash
Summary:
This is a cleanup of NodeHash API. There were few unused methods and few ways to convert between mercurial and mercurial_types hashes. With this diff it is very easy to identify the places where this converstion happens.
A followup of this diff will be to use this new API to easily replace the NodeHash convertions in places where it requires remapping.

Reviewed By: sid0

Differential Revision: D7592876

fbshipit-source-id: 6875aa6df1a3708ce54ca5724f6eb960d179192b
2018-04-13 10:00:03 -07:00
Siddharth Agarwal
fe4b00a6ce bundle2-resolver: rename UploadableBlob to UploadableHgBlob
Summary: Follows from D7565808.

Reviewed By: farnz

Differential Revision: D7578765

fbshipit-source-id: df472b121bf7a544a15ea191035799e9d3e1e07a
2018-04-11 13:42:31 -07:00
Siddharth Agarwal
361ae35558 mercurial: define a HgNodeKey key for node keys
Summary:
This is used in a bunch of places throughout bundle2-resolver, and is
the default key that should be used throughout Mercurial.

Reviewed By: farnz

Differential Revision: D7578081

fbshipit-source-id: 8f44b54189b22b0aba8f08853bbd2bbbaa3efc5c
2018-04-11 13:42:31 -07:00
Siddharth Agarwal
8e7a1acc0f mercurial-types: rename Blob to HgBlob
Summary:
This will probably go away soon, but for now I want to be able to
disambiguate the new Thrift-encoded blobs in Mononoke from these.

Reviewed By: StanislavGlebik

Differential Revision: D7565808

fbshipit-source-id: d61f3096fa368b934a923dee54a0ea1e3469ae0d
2018-04-11 13:42:31 -07:00
Siddharth Agarwal
7cb68c0c60 mercurial-types: make the Type enum use FileType
Summary:
Since `FileType` now exists, the `Type` enum can use it instead of
defining its own stuff.

Reviewed By: farnz

Differential Revision: D7526046

fbshipit-source-id: 3b8eb5502bee9bc410ced811dc019c1ce757633f
2018-04-06 13:16:55 -07:00
Stanislau Hlebik
fc3971aa62 mononoke: remove a few BlobRepo constructors
Summary:
They do not provide a lot of value, so let's not have them at all. It will make
adding filenodes easier.

Reviewed By: farnz

Differential Revision: D7428601

fbshipit-source-id: 647fa36d962cb6a8996f92246e4d900751040a52
2018-03-29 03:29:57 -07:00
Simon Farnsworth
8ed2d15d2a Serialize changeset and filelog handling in resolver
Summary:
It is explictly not permitted to ask for filelogs before you've handled changesets, as they are after changesets in stream order.

Force changeset evaluation to finish before filelog evaluation begins

Reviewed By: StanislavGlebik

Differential Revision: D7382355

fbshipit-source-id: 24decd7fe223f8acbc30d42b6c85d89d5ab9edcc
2018-03-26 05:36:18 -07:00
Dino Wernli
2022d7eb7e Port more usages of context to the new extension.
Summary: Port more uses of context to the new failure extensions library.

Reviewed By: lukaspiatkowski

Differential Revision: D7350923

fbshipit-source-id: 0a91f5dcc8ce6ad00de70535c5976c78107fe22f
2018-03-25 08:06:04 -07:00
Lukas Piatkowski
d0e66cc5f7 mercurial: distinguish between NodeHash used in mercurial Revlogs and in Mononoke Blobstore
Summary:
This codemod tries not to change the existing behavior of system, only introduce new types specific to Mercurial Revlogs.
It introduces a lot of copypasta intentionally and it will be cleaned in following diffs.

Reviewed By: farnz

Differential Revision: D7367191

fbshipit-source-id: 0a915f427dff431065e903b5f6fbd3cba6bc22a7
2018-03-22 12:24:35 -07:00
Siddharth Agarwal
1b9676778e bundle2-resolver: stop using empty MPaths
Summary:
In this case it's super convenient to just use `RepoPath` instances,
so just do that.

The next diff will remove the ability to create `MPath` instances entirely.

Reviewed By: StanislavGlebik

Differential Revision: D7358368

fbshipit-source-id: 8915e765d7e879ec35abac9dfe3ea9653520395d
2018-03-22 05:21:57 -07:00
Stanislau Hlebik
296fff8b60 mononoke: support bookmark deletion
Summary:
To do this we have to make changegroup part optional, because `hg push --delete
BOOK` doesn't actually send changegroup at all.

This also fixes the issue with `hg pushbackup` that sends only infinitepush
bookmarks part (see test for details)

Reviewed By: farnz

Differential Revision: D7271596

fbshipit-source-id: 77fa26e176fd4e31f62e0412249a934ee1176ee0
2018-03-21 14:25:08 -07:00
Stanislau Hlebik
6c2bb328aa mononoke: update bookmarks in pushkey part
Summary:
Actually update the bookmarks using pushkey part. Note that bookmark deletion
doesn't currently work. It will be fixed in the next diffs

Reviewed By: farnz

Differential Revision: D7271600

fbshipit-source-id: fd13d1adfd3ea490174c31e23289e8560dc2b737
2018-03-21 14:25:00 -07:00
Stanislau Hlebik
b35bd5dd9d mononoke: pushkey part parsing
Summary:
Pushkey part is used to send bookmark updates from hg client to the server.
This diff does all the wireproto parsing, but doesn't actually apply bookmark
updates on the server.

Also this diff "implements" branchmap method. We have no plans to support it,
but currently remotenames extension calls it. So this diff adds a fake
implementation that always returns empty response.

Reviewed By: farnz

Differential Revision: D7150973

fbshipit-source-id: 6889c02a1105127b1805ef1fafa6fbe9c2d57e7d
2018-03-16 04:21:32 -07:00
Siddharth Agarwal
b338897dc4 prefix ChangesetId, ManifestId and BlobHash with Hg
Summary:
Mononoke will introduce its own ChangesetId, ManifestId and BlobHash, and it
would be good to rename these before that lands.

Reviewed By: farnz

Differential Revision: D7293334

fbshipit-source-id: 7d9d5ddf1f1f45ad45f04194e4811b0f6decb3b0
2018-03-15 17:45:29 -07:00
Lukas Piatkowski
c4ede3aa71 blobrepo: wrap Error in Compat for SharedError<Compat<Error>>
Summary: SharedError has a default implementation for std Error, but the parameter must implement std Error, that is why I wrapped failure::Error in failure::Compat. Thanks to that we can use SharedError as any other normal std Error (including the fact that it implements failure::Fail)

Reviewed By: farnz

Differential Revision: D7213459

fbshipit-source-id: 54899c64c2627dfdba276630d986a3d6007ea59a
2018-03-09 08:44:32 -08:00
Simon Farnsworth
bb8c39183e Thread a logger into BlobRepo
Summary: I'm going to need a logger to log future-stats output to (and later trace output). Thread one through to BlobRepo

Reviewed By: StanislavGlebik

Differential Revision: D7167450

fbshipit-source-id: 4ed729e4d448b66e491cefa19380d3be9bc99091
2018-03-06 08:09:19 -08:00
Stanislau Hlebik
14031b91b6 mononoke: add helper ChangegroupPush struct
Summary:
Add a struct that helds parsed data from changegroup part. In the next diffs
we'll start parsing pushkey parts with bookmarks, and ChangegroupPush struct
knocks down the number of parameters that we need to pass from one function to
another.

Reviewed By: farnz

Differential Revision: D7150974

fbshipit-source-id: a8c0e260a4421168903894930befbab430a6418d
2018-03-06 04:47:34 -08:00
Dino Wernli
fa2b14cd8b Remove the generic types from Blob and BlobNode in favor of Bytes
Summary: Replace the generic types if `Blob` and `BlobNode` with `Bytes`.

Reviewed By: lukaspiatkowski

Differential Revision: D7115361

fbshipit-source-id: 924d347377569c6d1b3b4aed14d584510598da7b
2018-03-02 09:45:04 -08:00
Dino Wernli
36917d583a Address some leftover comments from D7106766.
Reviewed By: lukaspiatkowski

Differential Revision: D7123890

fbshipit-source-id: 73d2531413d34bff6db8baaf959e11084def616e
2018-03-02 09:02:59 -08:00
Stanislau Hlebik
04e471e453 mononoke: handle infinitepushscratchbookmarks part
Summary:
This is the part that sends client bookmarks to the server. Quite likely we are
not going to process it, so we are just reading the part and ignoring it.

Reviewed By: farnz

Differential Revision: D7123758

fbshipit-source-id: 7ad39bde77b6f77cf6e440e726ac3bdb9f340cea
2018-03-01 08:21:10 -08:00
Stanislau Hlebik
0c4f5bf3f8 mononoke: basic infinitepush implementation
Summary:
Support b2x:infinitepush part. It contains changegroup v2, so just reuse the
normal push path for it.
Note that pushbackup still fails because we don't support
b2x:infinitepushscratchbookmarks part. Also all wireproto params are ignored
for b2x:infinitepush.

Reviewed By: farnz

Differential Revision: D7086120

fbshipit-source-id: 2f98e5d59059ca3c2b82842c98e6dc771c70c6f0
2018-03-01 03:23:46 -08:00
Dino Wernli
5c84d1d8de Return file contents as Bytes in blobrepo.
Summary: This starts porting uses of Vec<u8> for file contents to the Bytes type.

Reviewed By: jsgf

Differential Revision: D7106766

fbshipit-source-id: 15d531836132317cede7a6f9d6b047a423deb5bb
2018-02-28 17:59:12 -08:00
Lukas Piatkowski
22a7f7e523 bundle2-resolver: use BlobRepo::create_changeset to upload changesets
Reviewed By: farnz

Differential Revision: D7035844

fbshipit-source-id: a0bc89f717bf878ada981bc04ae6fea0ac0b5660
2018-02-28 11:15:01 -08:00
Lukas Piatkowski
995e15697e bundle2-resolver: use (NodeHash, RepoPath) as id for uploaded blobs
Summary:
From upload_entry perspective NodeHash is not unique for uploaded entry, but when combined with RepoPath it is. An example are two files with the same content, but different paths.

Additionally in this diff the requirement for uploaded blobs to be unique is loosened for Manifests, because the b2xtreegroup might contain duplicates of Manifests

Reviewed By: farnz

Differential Revision: D7087863

fbshipit-source-id: 7e9c2438db037fa171f1e65b6882b445e8c09f7a
2018-02-28 11:15:01 -08:00
Lukas Piatkowski
0ceab4951c bundle2-resolver: accept more than one Filelog chunk with the same path
Summary: It seems that my assumtion that Filelog End section follow every Filelog Chunk section was wrong, because there might be multiple Filelog Chunk sections being different version of the same file from different commits.

Reviewed By: farnz

Differential Revision: D7073007

fbshipit-source-id: 3baee3fd29c77aabf4173a618509de7ff88e4de6
2018-02-27 11:14:52 -08:00
Lukas Piatkowski
37aedb6a7c bundle2-resolver: fetch missing file content from BlobRepo in DeltaCache
Summary: The assumption that deltas can be decoded using only bundle2 was wrong, we need to be able to fetch content of other files from the BlobRepo for delta application.

Reviewed By: StanislavGlebik

Differential Revision: D7085957

fbshipit-source-id: 2f6803d7f61389c5ba38b1207ede42579b9cf2e6
2018-02-27 11:14:52 -08:00
Lukas Piatkowski
6bba67fc5e bundle2-resolver: add context to errors returned from this crate
Summary: This will make it easy to track down an error without looking at stacktraces

Reviewed By: StanislavGlebik

Differential Revision: D7087301

fbshipit-source-id: c5460dae9c5c9ab43713e5db1457f5d9155b5e8e
2018-02-27 11:14:52 -08:00
Lukas Piatkowski
9ce40b36f5 bundle2-resolver: refactor resolver to be more readable
Reviewed By: farnz

Differential Revision: D7067227

fbshipit-source-id: 42384d04f4035e0fd955f450fc2a3ab0f575beba
2018-02-23 11:22:58 -08:00
Lukas Piatkowski
358fd89ff4 bundle2-resolver: use future::Shared to store futures of uploaded blobs
Summary: This is required in further diffs where a single blob can be referenced by multiple Changesets and thus must be Sharable

Reviewed By: farnz

Differential Revision: D7056227

fbshipit-source-id: 81de95fbd933d7888347ffdfbab392b1f0398e89
2018-02-23 11:22:58 -08:00
Lukas Piatkowski
b0d73fac92 bundle2-resolver: uploading Manifest as type::Tree instead of type::File
Reviewed By: farnz

Differential Revision: D7055923

fbshipit-source-id: 3c3f3d47a418b51ccd2eedbf42ddd7b66cb0fdab
2018-02-22 10:06:07 -08:00
Lukas Piatkowski
d25ca34c0f bundle2-resolver: reorganize resolver for easier handling of BlobRepo::create_changeset
Reviewed By: farnz

Differential Revision: D7032695

fbshipit-source-id: 66a4d75004236536e5dca6da38f71e4662cda0c8
2018-02-22 04:53:56 -08:00