Summary:
Now it is as it should be: mercurial_types have the types, mercurial has revlog related structures
burnbridge
Reviewed By: farnz
Differential Revision: D8319906
fbshipit-source-id: 256e73cdd1b1a304c957b812b227abfc142fd725
Summary:
Some wireproto methods may have huge argument lists. They just print too much
data to stderr, and make stderr basically useless. Let's limit it
Reviewed By: jsgf
Differential Revision: D8076949
fbshipit-source-id: 58e760f25a7d4fdc9fc7bd95635f916a08e15ed2
Summary:
Rust 1.26 adds many new language features. In particular `impl Trait` is now
stable, so we no longer need `conservative_impl_trait`.
There also seems to have been changed in the (unstable) TryFrom with respect to
usize, and the behaviour of the never type `!`.
There are still a few deprecation warnings, but they don't cause the build to
fail.
Path remapping is now stable, so the buck config needs to change to use it
rather than the unstable command line option.
TODO:
- get aarch64 rust-crates-io build (can defer to a later update)
Reviewed By: Imxset21
Differential Revision: D7966091
fbshipit-source-id: 2e61e262c21eb01c852a36f49c6a6369cdaddcdb
Summary:
We want to be able to identify "interesting" sessions - add a Scuba
sample that tells us what wireprotocol commands were sent, and how long the
session lasted.
Reviewed By: jsgf
Differential Revision: D7813906
fbshipit-source-id: a9bd48996a60b41098243f6c815465cd33d1429c
Summary:
mercurial::NodeHash is the representation of Mercurial's Sha1 hash, so it should be used to parse and generate hgproto.
This diff doesn't not change two crucial places that are required for full coverage of NodeHash remapping in future:
- Bundle2's tree manifest generation code
- Bundle2's resolver code
Those will be added in dependent diffs
Reviewed By: sid0
Differential Revision: D7600471
fbshipit-source-id: 40e05d5cce6c454200169f6f0049e57d427e9403
Summary:
This wireproto method is used by remotenames to update the list of
remotebookmarks. Implementation is the same as for listkeys bundle2 part.
Reviewed By: farnz
Differential Revision: D7271597
fbshipit-source-id: 8a75a93cae0e571d86d657e1c1d718a7fa0ab4ea
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
Summary:
Return a reply to a client so that it doesn't fail.
Reply consists of just one replychangegroup that tells a client that the push
has succeeded (even though currently it wasn't).
resolve() function returns future of Bytes instead of a stream. It may be
suboptimal, but should be fine for now, and it's already used by a few
wireproto methods.
Reviewed By: lukaspiatkowski
Differential Revision: D7010578
fbshipit-source-id: 9b5425b912c640d4e2bac957a02e9881813b8871
Summary:
Now resolve() function accepts stream of Bundle2Item and it doesn't return
remainder. Remainder is parsed in hgproto. This makes unbundle() similar to
other hgproto methods.
Note that resolve() returns future of () - this is temporary and it'll be
changed in the next diff.
Reviewed By: jsgf
Differential Revision: D7010577
fbshipit-source-id: f4bde495d0ab8785476559f65b0165dbd09e4ba5
Summary: The only real use case of Bundle2Stream requires it to be 'static, so the is no real point of preserving 'a.
Reviewed By: StanislavGlebik
Differential Revision: D6965528
fbshipit-source-id: 3d5c9c74c1d17980befd3742c54cdde9279aa62c
Summary:
Wireproto method to lookup if a revision/bookmark exists.
Currently supports only full hashes, later we'll add support for bookmarks and
node prefixes.
Reviewed By: farnz
Differential Revision: D6948358
fbshipit-source-id: af92a892eae8f787053447e601ebf95dfd638fa4
Summary:
getfiles is a remotefilelog method to fetch file content. Mercurial client
calls it on-demand, usually during `hg update` command. So normal `hg pull`
with remotefilelog doesn't send filelogs back to the client.
This diff implements getfiles arguments parsing. The code is tricky, so I've
added lots of comments to explain what's going on.
Reviewed By: farnz
Differential Revision: D6913178
fbshipit-source-id: 0248993c3ac487956e0ff547996d51b75cdaee96
Summary:
Everything needed for gettreepack method to work except for the gettreepack
implementation
Reviewed By: lukaspiatkowski
Differential Revision: D6845034
fbshipit-source-id: b675a2c38c7f6204fac5a6a0885caef246ba7987
Summary: This change let's the handler return multiple responses to the client that is required for commands like `unbundle` to work
Reviewed By: jsgf
Differential Revision: D6820845
fbshipit-source-id: 5f17c2a6100aa989f35d468c188322da4a921059
Summary: Dechunker parses a hgproto stream of bytes by taking the chunks and letting the code to read them via BufRead API
Reviewed By: jsgf
Differential Revision: D6619521
fbshipit-source-id: 26dfab554a8e4c79079f4c4666c272ec2924c7d2
Summary: This is what the client expexts to receive before streaming can happen
Reviewed By: farnz
Differential Revision: D6833721
fbshipit-source-id: 04a66415638187108366109b0d9062bd8481a628
Summary:
The client sends us a request that we parse and return response for it. As simple as that.
When the client sends `unbundle` request we need to return an acknowledgment that we are ready to read a bundle2 stream from it.
This means that we first parse the request, then send the response, then parse the stream.
This will be changed in future diffs so that we might:
Parse request from client -> [send acknowledgments -> parse data from client]* -> send response;
Reviewed By: farnz
Differential Revision: D6833723
fbshipit-source-id: 0c13b1e3253bd664bc565eacb5b58a9fc53d4efa
Summary:
Previously parsing code assumed that lookup param is an ident string. This is
incorrect, because ident string accepts only strings that consist only of
digits and small letters and start with a letter. Since a hash can be a lookup
param, this param may start with non-letter. More importantly, any bookmark can
be a lookup parameter. That means that this param can have spaces and
punctuation marks.
Let's use simpler parsing that just parses the whole string.
Reviewed By: jsgf
Differential Revision: D6758916
fbshipit-source-id: de2dd144cebfe88c751e8110ef6e3a71d3769800
Summary:
`complete!` had to be wrapped around both the separator and the input parser.
`separated_list_complete!` does that automatically, which is nice.
Reviewed By: jsgf
Differential Revision: D6758479
fbshipit-source-id: a2fe94a422a1b4a1c09bbfa915cde19d968d3273
Summary: The Framed and FramedParts duet fits following diffs a bit better than FramedStream and ReadLeadingBuffer.
Reviewed By: jsgf
Differential Revision: D6567554
fbshipit-source-id: 88d117ad9e8227f9de278037b333da7ffc4fdf1f
Summary:
- Added test for checking if decompressing isn't overreading it's input
- As a result removed ZSTD decompression which is overreading input
- Changes in decompression code propagated usage of BufRead in bundle2 parsing code
- As a result a bug in OuterDecoder was found where the buf was not consumed if the header value is "0"
Reviewed By: jsgf
Differential Revision: D6557440
fbshipit-source-id: 89a9f4c8790017c5b86d28d467e45f687d7323f6
Summary:
We're never going to serve RevlogRepo in production, and we're down to
a single BlobRepo type that will have different backing stores. Remove the
unused trait, and use BlobRepo everywhere bar blobimport and repo_config
(because we previously hardcoded revlog here - we want to change to a BlobRepo
once blobimport is full-fidelity).
Reviewed By: jsgf
Differential Revision: D6596164
fbshipit-source-id: ba6e76e78c495720792cbe77ae6037f7802ec126
Summary:
Don't use failure's bail!() and ensure!() macros.
Instead, failure_ext provides:
- bail_err!(err) - Converts its single parameter to the expected error and returns; ie `return Err(From::from(err));`
- bail_msg!(fmt, ...) - takes format string parameters and returns a `failure::err_msg()` error
- ensure_err!(), ensure_msg!() - corresponding changes
Also:
- remove all stray references to error-chain
- remove direct references to failure_derive (it's reexported via failure and failure_ext)
- replace uses of `Err(foo)?;` with `bail_err!()` (since `bail_err` unconditionally returns, but `Err(x)?` does not in principle, which can affect type inference)
Reviewed By: kulshrax
Differential Revision: D6507717
fbshipit-source-id: 635fb6f8c96d185b195dff171ea9c8db9e83af10
Summary: This diff also moves parsing of Batch subcommands inside sshproto where it belongs
Reviewed By: farnz
Differential Revision: D6492001
fbshipit-source-id: a31864f50e9468f360f9a30fc75fc2cfdee56169
Summary:
Convert scm/mononoke to use failure, and update common/rust crates it depends on as well.
What it looks like is a lot of deleted code...
General strategy:
- common/rust/failure_ext adds some things that are in git failure that aren't yet in crates.io (`bail!` and `ensure!`, `Result<T, Error>`)
- everything returns `Result<T, failure::Error>`
- crates with real error get an error type, with a derived Fail implementation
- replicate error-chain by defining an `enum ErrorKind` where the fields match the declared errors in the error! macro
- crates with dummy error-chain (no local errors) lose it
- `.chain_err()` -> `.context()` or `.with_context()`
So far the only place I've needed to extract an error is in a unit test.
Having a single unified error type has simplified a lot of things, and removed a lot of error type parameters, error conversion, etc, etc.
Reviewed By: sid0
Differential Revision: D6446584
fbshipit-source-id: 744640ca2997d4a85513c4519017f2e2e78a73f5
Summary: `changeset_exists` only checks that the changeset is in the blob store. Once we start accepting pushes, we'll also want to check that the changeset is reachable from a head. Use revsets to check this. Once we have a notion of "completeness" for changesets, we'll switch `known` to use that instead - this code is still useful as a way to go from `changeset_exists` to `changeset_complete` in bulk.
Reviewed By: jsgf
Differential Revision: D6205695
fbshipit-source-id: 7e3b5c30bc5e459feb95a20913d8a04f3fda7469
Summary: This is the first step that establishes a stream based API, later diffs will propagate this idea downstream, so that we fully support streaming in f.e. unbundle bundle2
Reviewed By: jsgf
Differential Revision: D6239508
fbshipit-source-id: 43afba4f640586b728cb4cb85d14226a677ee58b
Summary:
Parse the unbundle command as an `unbundle` command with its `heads`
parameter, followed by a bundle2 stream which is parsed in order to capture it
as bytes, as a simulation of an actual stream.
Reviewed By: sid0
Differential Revision: D6209818
fbshipit-source-id: 9bc454319350e2047160347964740f3a3d2f592f
Summary:
Even though the parameter is called `heads`, it's not necessarily heads.
It can be:
1) hex-encoded word "force" - "666f726365"
2) Hex-encoded list of heads
3) hex encoded word "hashed" and a hash of heads' hashes.
Proof: https://www.mercurial-scm.org/repo/hg/file/tip/mercurial/wireproto.py#l362
Previously we just parsed list of hashes, and it wasn't correct. This diff fixes it
Reviewed By: jsgf
Differential Revision: D6110315
fbshipit-source-id: 57ca12d13e3b719803b20ae1718d5f4309b806f5
Summary:
Removes usage of BoxFuture and BoxStream from futures crate and instead use
it from internal futures_ext lib.
Reviewed By: sid0
Differential Revision: D6018186
fbshipit-source-id: 4d4b17fad1d9adc8c9de93ce731f6dfebd66e3b5
Summary:
Finally got an update working by removing the `mysql_async` crate.
Some notes:
* The `mysql_async` crate was responsible in this case: see https://github.com/rust-lang/cargo/issues/4066#issuecomment-328210204 for why.
* tokio/futures deprecated a bunch of stuff. I've filed a TODO for now.
* We finally pulled in error-chain 0.11, which has a bunch of nice improvements.
Reviewed By: kulshrax
Differential Revision: D5798282
fbshipit-source-id: a38a7b17ee0205428e2ea63334722aa408582493
Summary: Add placeholder error in hgproto for errors from Repo operations. This is intended to be chained onto the real error.
Reviewed By: sid0
Differential Revision: D5540669
fbshipit-source-id: dedf12c9c749c40ba77444fb0adb30c8ddc868ed