Commit Graph

8 Commits

Author SHA1 Message Date
Jeremy Fitzhardinge
dc5e78c1c1 rust: mass convert scm/mononoke/... to use failure
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
2017-12-05 18:11:13 -08:00
Simon Farnsworth
b38dd81782 Make known protocol check that the commit is fully present
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
2017-12-04 11:54:53 -08:00
Lukas Piatkowski
ee8cf02e54 server: refactor the main function for future diffs
Summary:
There are few changes here:
- split main into more smaller functions
- add panic hook that exits the process if one of the threads paniced
- use never_type feature to better type functions that should never return
- few panics to error returning changes here and there

Reviewed By: farnz

Differential Revision: D5942238

fbshipit-source-id: 7407d95b61f64f3909c5bb14dd3aa1ddee452f3c
2017-10-04 14:06:00 -07:00
Stanislau Hlebik
5961c7558a mononoke: filelog metadata problem fix
Summary:
Mercurial filelog entries may have metadata fields in the beginning, usually used to track copies/renames. Previously mononoke eden server returned this metadata as part of the file blob.
This diff changes it. Now `get_content()` method returns file content without metadata, and to make it consistent, both `get_content()` of the blobrepo and revlog repo do the same.

This decision certainly has it's tradeoffs, because now it's more difficult to get metadata (`get_raw_content` needs to be used).
But we'll probably change how metadata is stored anyway, that's why I think changing `get_content` method is fine.

This diff also cleans up server/src/main.rs file, because previously it had to strip metadata itself.
Also diff fixes problem in metadata parsing - it previously failed if file is less than 2 bytes

Reviewed By: farnz

Differential Revision: D5901476

fbshipit-source-id: f3ade0179710352590068c238e6a733aab68a512
2017-09-26 00:36:55 -07:00
Siddharth Agarwal
a79b8267ae rename Path to MPath
Summary:
`Path` has the potential to be confused with `std::path::Path`.
`MPath` is nice, concise, and clearly different from `Path`.

Reviewed By: jsgf

Differential Revision: D5895665

fbshipit-source-id: dc5ed5c3866b227d753c6d904d3c6d213c882cd7
2017-09-22 17:27:03 -07:00
Lukas Piatkowski
4fbc0213a3 server: read config repo instead of command line arguments to start the server
Reviewed By: StanislavGlebik

Differential Revision: D5833380

fbshipit-source-id: bad649592a2aa15ad5bc1448266986bed4c6f989
2017-09-22 09:22:18 -07:00
Lukas Piatkowski
58a94a73fa metaconfig: add simple parsing of content of a repo config using Serde and Toml
Summary: This parsing is only to check that the modules work together. The metaconfig module still needs to have some proper parsing implemented, Error handling and tests

Reviewed By: jsgf

Differential Revision: D5698544

fbshipit-source-id: 8cd3254c10f977a17ddc31ac2199ee4c9fa98355
2017-09-12 04:05:14 -07:00
Lukas Piatkowski
c5695a71a3 metaconfig: use Vfs to parse metaconfig repo into RepoConfigs
Summary:
Example metarconfig repo:

  .
  ├── hooks
  │   ├── a
  │   ├── b
  │   └── c
  ├── metaconfig
  └── repos
      ├── fbsource
      │   └── hooks --> ../../hooks
      └── www
          └── hooks
              └── my_hook
  $ cat repos/www/hooks/my_hooks
  [hooks]
  my_hook_a = metaconfig::hooks/a

Reviewed By: jsgf

Differential Revision: D5483642

fbshipit-source-id: 2aaeaa4dbd29862ad7c2668a6f4fd1dad6ac0311
2017-09-12 04:05:14 -07:00