Commit Graph

119 Commits

Author SHA1 Message Date
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
Stanislau Hlebik
c474b57a9e blobimport: add an option to postpone compaction
Summary: Compaction can slow down blobimporting a lot. Let's add an option to postpone it till the end

Reviewed By: farnz

Differential Revision: D5882003

fbshipit-source-id: 0611a8e94b3d7331bdacf909d820526f547414a0
2017-09-22 08:33:25 -07:00
Lukas Piatkowski
58badc5de4 server: add ThriftServer with ServiceFramework for fb303
Reviewed By: StanislavGlebik

Differential Revision: D5871327

fbshipit-source-id: e0f516c8767d4934155a67e82a5840a51b16a255
2017-09-22 03:35:38 -07:00
Shreya Jain
de9037ebd2 removed use of deprecated Tokio APIs from fbcode/scm/mononoke/heads/fileheads
Summary: Removed use of deprecated Tokio APIs. Firstly, removed usage of BoxFuture and BoxStream from futures crate and instead used it from futures_ext crate. Also, replaced stream::iter() with stream::iter_ok().

Reviewed By: sid0

Differential Revision: D5882902

fbshipit-source-id: 329231cca798371701e8966251a43a78db6e4ee1
2017-09-21 21:21:10 -07:00
Jeremy Fitzhardinge
944e008289 mononoke: repoinfo: use u64 for Generation type
Summary: Generation has nothing to do with machine words or pointer sizes, so it shouldn't be using usize. Use u64 instead.

Reviewed By: wez

Differential Revision: D5885943

fbshipit-source-id: 49b748cf592e270f78d85fe3c39b8d1a2a3e1671
2017-09-21 16:52:35 -07:00
Simon Farnsworth
9013d80b99 Add tests to confirm that NotReady doesn't panic
Summary:
lukaspiatkowski pointed out that I don't test that an input that's NotReady doesn't hit
the panic cases. Add tests to check that this works.

Reviewed By: jsgf

Differential Revision: D5881789

fbshipit-source-id: 6357262c070c8c6a524d7bedeb1966843bd7612b
2017-09-21 16:25:46 -07:00
Simon Farnsworth
c362649352 Add set intersection to revsets
Summary: Teach the revsets code to do set intersection.

Reviewed By: jsgf

Differential Revision: D5881788

fbshipit-source-id: 972fd85a47ee29a1037f5e4072c03e25189b8300
2017-09-21 14:14:18 -07:00
Simon Farnsworth
b263ff8307 Use error_chain! instead of manual error handling
Summary:
Switch from hand-rolled errors that eat the underlying cause to
`error_chain!` errors that allow you to extract what happened.

Reviewed By: StanislavGlebik, lukaspiatkowski

Differential Revision: D5862059

fbshipit-source-id: 4f7e849249b124cc6f48498045de1d01a717619b
2017-09-21 11:53:09 -07:00
Stanislau Hlebik
ab14a6f6c9 mononoke: support rocksdb blobstore in eden server
Reviewed By: lukaspiatkowski

Differential Revision: D5861654

fbshipit-source-id: 036249899910c7aa1acda0632e6a3dcd15bf8f72
2017-09-21 08:25:23 -07:00
Stanislau Hlebik
62bf1ee5b5 mononoke: add simple utility to generate dependencies in TARGETS files
Summary:
Manually adding all the dependencies in the TARGETS file is quite annoying. This simple tool does it for you!
It queries buck to get list of files for the target, and also queries all the rust_library mononoke dependencies.
Then it parses source files and generates TARGETS list.

Tool is super-simple and that's why it's not always correct (for example, it fails to find a deps if hasn't been used in mononoke before), but it works good enough for many use-cases (see test plan).

Reviewed By: lukaspiatkowski

Differential Revision: D5861828

fbshipit-source-id: ab8cc96d8bc394af172ee09da3aceb0ffb7493e8
2017-09-20 04:19:45 -07:00
Lukas Piatkowski
ce481174a6 server: remove the --dry option
Summary: This diffs reverts D5842977 and adds fetching mononoke-config inside tupperware, so that it can be served by mononoke server

Reviewed By: StanislavGlebik

Differential Revision: D5866239

fbshipit-source-id: 6f3fd794e5274c8bab0c50efc9c95e31f88be688
2017-09-20 02:57:12 -07:00
Jeremy Fitzhardinge
4497750c7d mononoke: heads: use ! for memheads errors
Summary: memheads can't fail, so use `!` for its `Error` type

Reviewed By: sid0

Differential Revision: D5849874

fbshipit-source-id: fbefb3cdaa11d9c10cbfc988e43978751c807472
2017-09-19 16:11:54 -07:00
Jeremy Fitzhardinge
faa58a1052 mononoke: bookmarks: use ! for membookmarks errors
Summary: membookmarks can't fail, so use `!` for its `Error` type

Reviewed By: sid0

Differential Revision: D5849875

fbshipit-source-id: 5dbb4edf9bb57dde55877d2c90936b51dcc5d7ff
2017-09-19 16:11:54 -07:00
Jeremy Fitzhardinge
78756211f9 mononoke: blobstore: use ! for memblob errors
Summary: memblob can't fail, so use `!` for its error type

Reviewed By: sid0

Differential Revision: D5849876

fbshipit-source-id: 48ca1c345d788a5f6e632d73f55bc485c036a0e3
2017-09-19 16:11:54 -07:00
Jeremy Fitzhardinge
64c19dcf5e rust: futures-ext: use ! for errors that can't happen
Summary:
We can use the "never_type" feature to enable more general use
of the `!` type, which indicates that the type state is impossible (ie,
`!` has no values). Not only is this more expressive than using - say -
`()`, it also allows irrefutable matching against a result (`let Ok(x)
= ...`), since the compiler knows that `Err(!)` can never happen.

Reviewed By: sid0

Differential Revision: D5849877

fbshipit-source-id: 48c14f9c2042fb8168eb1dd308fd3a79c9ed0fc2
2017-09-19 16:11:54 -07:00
Stanislau Hlebik
295f67ee93 mononoke: rustfmt on eden server
Reviewed By: lukaspiatkowski

Differential Revision: D5861647

fbshipit-source-id: 4570517a62eb7e91da367a1943801f3e7eca9220
2017-09-19 10:10:03 -07:00
Simon Farnsworth
9fb6a9c322 Introduce union and single node revsets
Summary:
We want a mechanism to quickly and easily find sets of revisions in
Mononoke. As a first step, introduce a mechanism to find single nodes, and a
mechanism to union two streams of nodes.

Later diffs will add the other 2 set operations, plus range (`a::b` in
Mercurial terminology).

Reviewed By: jsgf

Differential Revision: D5778925

fbshipit-source-id: 9e320ccab21c9b7b9c0fab8fbbc5c7389d2b7da0
2017-09-19 06:58:03 -07:00
Stanislau Hlebik
a22f886276 mononoke: fix test
Summary: file blobstore was read data from incorrect folders. This diff fixes it.

Reviewed By: farnz

Differential Revision: D5852736

fbshipit-source-id: 1bc08788023ff2cc9d631985d70329475afc589f
2017-09-19 04:22:42 -07:00
Arun Kulshreshtha
9b10b1fa9f Add indicatif crate to rust-crates-io
Summary:
`indicatif` is a command-line progress bar crate for Rust. It seems
pretty generally useful, and I plan to use it in the Dewey client replacement.

As a side note, it was written by Armin Ronacher (of Flask fame), so it should
hopefully be solid. See https://github.com/mitsuhiko/indicatif.

As part of this update, the `bitflags` crate went from `0.9.1` to `1.0.0`, which adds
a breaking change wherein bitflag constants are now namespaced by their
containing struct. This diff includes the appropriate fixes for revlog and zeus,
which seem to be the only things affected.

Reviewed By: jsgf

Differential Revision: D5855753

fbshipit-source-id: 38d88335126e787f3acd92189a1ed17f55138799
2017-09-18 14:21:21 -07:00
Jonathan Gray
b4e04cfb29 remove BoxFuture and BoxStream from mercurial-types-mocks
Summary: Switch to implementations in futures-ext

Reviewed By: sid0

Differential Revision: D5846396

fbshipit-source-id: dc42526a9c9052bcbde9cf9418d303eee973a998
2017-09-18 12:07:49 -07:00
Pai-Wei Lai
419ef4893a remove uses of deprecated Tokio APIs from fbcode/scm/mononoke/eden-server
Summary: remove uses of deprecated Tokio APIs from fbcode/scm/mononoke/eden-server

Reviewed By: sid0

Differential Revision: D5853387

fbshipit-source-id: 3f1d153c823fe56df603c1c1fc5488b7dac65bed
2017-09-18 11:10:48 -07:00
Siddharth Agarwal
e5315a765b config for rustfmt-nightly 0.2.6
Summary:
Without this, any lines that are too long would cause `rustfmt` to
error out. That seems not very useful.

Reviewed By: kulshrax

Differential Revision: D5853676

fbshipit-source-id: b7335a14079ebf6245da0c028039d88745b32785
2017-09-18 10:50:27 -07:00
Siddharth Agarwal
da22546d74 move state into a trait
Summary:
We're going to add more stores like obsmarkers and linknodes very
soon. Stuffing all of them into type parameters is going to get ugly very soon.

Instead, add a trait which represents all the state, and make `BlobRepo`
generic on that trait. Add a few implementations for common use cases like
files and RocksDB-based stores.

This allows the dependency lists for the Mononoke and Eden servers to be more
straightforward.

Reviewed By: jsgf

Differential Revision: D5850372

fbshipit-source-id: 37a0687611687b9616ebbddce70f53e1e5d3267b
2017-09-18 00:35:52 -07:00
Siddharth Agarwal
d24cf40483 make eden-server and mononoke server bookmarks be in the same dirs
Summary: I'm going to move this to a common location very soon.

Reviewed By: jsgf

Differential Revision: D5850319

fbshipit-source-id: 09937659330de93cf74bf827f225418dd413865d
2017-09-18 00:35:52 -07:00
Siddharth Agarwal
482153dff8 ensure blobstore's ValueOut implements AsRef<[u8]>
Summary:
Just like the previous diff with bookmarks, every user needs this and it makes
sense anyway.

Reviewed By: jsgf

Differential Revision: D5847877

fbshipit-source-id: b91a49e94da2d7e207061b6c52b78c55a2229dec
2017-09-18 00:35:52 -07:00
Siddharth Agarwal
81f2ac473b make bookmark error type implement std::error::Error
Summary: All its users need this, and it makes sense.

Reviewed By: jsgf

Differential Revision: D5847753

fbshipit-source-id: 042c7b5637e5f83918fa9bc5d131c8745d7bbc3e
2017-09-18 00:35:52 -07:00
Siddharth Agarwal
de4b1f6c93 use BlobHash in RawNodeBlob
Summary: Also ensure that `blobimport` doesn't use its own copy.

Reviewed By: jsgf

Differential Revision: D5847604

fbshipit-source-id: 5390848cd5fab8abd967ef9701720491d703c0f1
2017-09-18 00:35:52 -07:00
Stanislau Hlebik
1d54db8218 mononoke: add hashencode to fsencode
Summary:
Finally use hashencode to hash long path.
This is basically a translation of core mercurial python code to rust.
Tests are also copied from core mercurial

Reviewed By: jsgf

Differential Revision: D5719573

fbshipit-source-id: a53bdeafe22cc9f492b8c08d4ae302a393f9b8fb
2017-09-17 12:15:08 -07:00
Stanislau Hlebik
c6cfba9cc5 mononoke: encode datapath too
Summary: Encoding only index path is not enough. It works fine for now because we don't use hash encoding. Next diff adds hash encoding, so we need to encode datapath too.

Reviewed By: jsgf

Differential Revision: D5719574

fbshipit-source-id: 4f2a4a75baad73313e80ffb81031166d4bab3e29
2017-09-17 12:15:07 -07:00
Stanislau Hlebik
6372225acf mononoke: add separate fsencode function instead of fsencode_dir and fsencode_file
Summary:
Let's use separate function fsencode instead of two methods fsencode_dir and fsencode_file.

There are a few reasons for that:
1) This is similar to upsteram mercurial code - it also uses separate function, not a method of the class.
2) Path is supposed to represent a file in the mercurial vfs. Previously we joined this file with "00manifest.i" - it creates a file that doesn't exist in mercurial vfs. This point is debatable though, so I'm fine with making it a method of the class. But probably it doesn't matter that much.
2) We never actually need to encode directory - even in tree manifest case we use fsencode to find location of`00manifest.*` files. That means, that we don't really need to have separate fsencode_dir function, so I was wrong when I added them in the first place.
3) Special hash encoding is used to encode paths that are longer than 120 chars (will be added in the next diff). `00manifest.i` and `00manifest.d` are used in the hash digest, and that means that one fsencode_dir() method is not enough - we'd need to add separate methods to fsencode idx file and separate method to fsencode data file.

Reviewed By: jsgf

Differential Revision: D5719576

fbshipit-source-id: ca6b38dd7d0c6c0c5a345d8fcbe1b0d6fa10a062
2017-09-17 12:15:07 -07:00
Simon Farnsworth
3d267f64f6 mononoke: compile test fixtures into in-memory repos
Summary:
We want to be able to test against repo fixtures. Turn repo fixtures
that have been created by blobimport into in-memory BlobRepos for testing.

Reviewed By: jsgf

Differential Revision: D5834109

fbshipit-source-id: d6fc01f19986b5a6951f25c7c8bda8aa7c9dee56
2017-09-16 02:50:00 -07:00
Justin Uy
73a7b58d58 Use futures-ext BoxFuture and BoxStream in blobrepo
Summary:
Removes usage of BoxFuture and BoxStream from futures crate and instead use
it from internal futures_ext lib.

Reviewed By: sid0

Differential Revision: D5847771

fbshipit-source-id: 01823513176add37caa73c0ea2810e80d7fae955
2017-09-15 17:50:24 -07:00
Jeremy Fitzhardinge
e18043ac54 mononoke: impl Repo for Arc<R> where R: Repo
Summary:
Allow Arc<R> where R: Repo to be used more generally. Also Box for
completeness.

Reviewed By: farnz

Differential Revision: D5846659

fbshipit-source-id: e101647badfb18a4a59d595ee9b21814b332fe34
2017-09-15 16:06:59 -07:00
Jeremy Fitzhardinge
2f72747e85 mononoke: blobimport: more use of impl Future
Summary:
This seemed to run up against a compiler issue
(https://users.rust-lang.org/t/impl-future-lost-fact-that-a-closure-is-fnonce/12870/16)
that can be worked around by adding an apparently unnecessary `.boxed()`.

Reviewed By: sid0

Differential Revision: D5843292

fbshipit-source-id: 0a82760bf6afbf7ba5f04541ca57bedcc935d411
2017-09-15 15:58:33 -07:00
Jeremy Fitzhardinge
8f701222aa mononoke: blobimport: first use of impl Future
Summary: Use `impl Future` rather than a boxed future.

Reviewed By: sid0

Differential Revision: D5829773

fbshipit-source-id: 40c4339e96f7194544f416534952b78a23d93fa6
2017-09-15 15:24:05 -07:00
Jeremy Fitzhardinge
d584bc31b3 mononoke: blobimport: rustfmt
Reviewed By: sid0

Differential Revision: D5831880

fbshipit-source-id: 9d9d7b18214241336e97219c48bf281dd08b5ab9
2017-09-15 15:24:05 -07:00
Lukas Piatkowski
4462d9de59 server: add a temporary --dry option just for the initial deployment in tupperware
Summary: The idea is to deploy a no-op mononoke server to tupperware and slowly add more parts like fb303 page, proper args for startup etc.

Reviewed By: farnz

Differential Revision: D5842977

fbshipit-source-id: 227d144b71132e73b76ce7067ac998b1945cb5e1
2017-09-15 09:49:59 -07:00
Siddharth Agarwal
2511835a09 add a small script to regenerate test fixtures
Summary: Makes a formerly manual process automatic.

Reviewed By: jsgf

Differential Revision: D5832456

fbshipit-source-id: 0bfa01aaf08f0794a3b98ab7290d163a65650a7e
2017-09-14 13:52:23 -07:00
Siddharth Agarwal
2525c1ed46 move tar_utils.py from update_rust into an open sourceable location
Summary:
This is going to be useful for a small regenerate script I want to
write and open source.

Reviewed By: yfeldblum

Differential Revision: D5831942

fbshipit-source-id: c1610ba1aa93061662e8cca3052f842b74fa4838
2017-09-14 13:52:23 -07:00
Siddharth Agarwal
5eea41d9d8 rustfmt blobrepo
Summary: Going to make significant changes here.

Reviewed By: jsgf

Differential Revision: D5831943

fbshipit-source-id: 923c22bc38f89846df61c75e20eb156fc5feddd6
2017-09-14 13:35:12 -07:00
Siddharth Agarwal
e1570669d4 remove BoxFuture and BoxStream from mercurial-types
Summary: Switch to the implementations in `futures-ext` added in the previous diff.

Reviewed By: jsgf

Differential Revision: D5799732

fbshipit-source-id: f5d54afe5847bb09f0231d5b3c58c0e2e54c391f
2017-09-13 21:52:37 -07:00
Siddharth Agarwal
911164a107 add helpers to box up futures and streams
Summary:
This was deprecated upstream, but is still useful to us.

Also add `nonsend` versions since those are still required in a couple of
places.

Reviewed By: jsgf

Differential Revision: D5817016

fbshipit-source-id: 3753fadcae666099a96b3b849e438c5c16c7232f
2017-09-13 21:52:37 -07:00
Siddharth Agarwal
380bd861be for RevlogManifest, ensure public API always has repo set
Summary: Remove the unused `empty()` constructor, and make the `parse` APIs private.

Reviewed By: lukaspiatkowski

Differential Revision: D5796734

fbshipit-source-id: 84e7b146ca89334fbdfda917d5d8eebf04a3e474
2017-09-12 11:50:20 -07:00
Siddharth Agarwal
e5b075b8ec rustfmt mercurial and mercurial-types
Summary: Going to be making significant changes to these files soon.

Reviewed By: kulshrax

Differential Revision: D5796735

fbshipit-source-id: 879fbca3fc936a538c95e50a3333fc2c312de15b
2017-09-12 11:50:20 -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
Lukas Piatkowski
0a86d53090 vfs: add Virtual File System for manifest
Reviewed By: jsgf

Differential Revision: D5755499

fbshipit-source-id: 5942c73698df54be28d2d601d062c238bb789f90
2017-09-12 04:05:14 -07:00
Lukas Piatkowski
772fcd590d vfs: add Tree for storing directory tree
Reviewed By: jsgf

Differential Revision: D5754498

fbshipit-source-id: 547482637459ad560f15d94bdc766759c26d9052
2017-09-12 04:05:14 -07:00
Jeremy Fitzhardinge
43d88961a9 mononoke: linear history blobrepo fixture
Summary: Simple linear history with 10 changesets as a file blob repo.

Reviewed By: sid0

Differential Revision: D5731223

fbshipit-source-id: bc479304d13f7a2299d3ecc382e052ad5600c46c
2017-09-11 13:08:36 -07:00
Jeremy Fitzhardinge
235771adc1 mononoke: fileheads: use ToString/FromStr rather than serde
Summary:
Serde is overkill for this, and the types we care about for heads can
already convert to/from strings without making bad pathnames.

Reviewed By: lukaspiatkowski

Differential Revision: D5784229

fbshipit-source-id: 28ee55f8c5c34ecd28cd1a7e465436892eb6fee2
2017-09-11 13:08:36 -07:00