Commit Graph

8 Commits

Author SHA1 Message Date
Jun Wu
12b98e1e96 indexedlog: use failure for error handling
Summary:
Failure makes it easier to chain errors, and backtraces. Use it.

There is probably still room for improvement, by chainning errors and avoiding
exposing low-level errors for APIs, and/or provide more context in error
messages. But it should be already much better than before.

Differential Revision: D14759305

fbshipit-source-id: b1d3a8ec959dde575f06533ea9e4cd0757057051
2019-04-05 12:17:28 -07:00
Jun Wu
cd1750f06b indexedlog: make Log::flush return the new file size
Summary:
The file size will be used to decide whether the Log needs "rotate" in upcoming
changes.

Reviewed By: kulshrax

Differential Revision: D14688169

fbshipit-source-id: b273abcc870b96650d2c76e6e742a3141ce48f13
2019-04-01 17:16:15 -07:00
Jun Wu
1348cf45f5 indexedlog: make fields in IndexDef private
Summary:
Change fields in IndexDef to private. Provide a public constructor method and
switch users to use that instead. This makes it possible to change the IndexDef
struct in the future (ex. having extra optional fields about whether the index
is backed by radix tree or something different).

Differential Revision: D14608955

fbshipit-source-id: 62a413268d97ba96b2c4efd2ce67cd4fa0ff4293
2019-03-26 21:19:46 -07:00
Haozhun Jin
461dabad96 bookmark: Turn BookmarkStore into indexed-log backed
Summary:
Turn BookmarkStore rust implementation into indexed-log backed.
Note that this no longer matches existing mercurial bookmark store
disk representation.

Reviewed By: DurhamG

Differential Revision: D13133605

fbshipit-source-id: 2e0a27738bcec607892b0edab6f759116929c8e1
2018-11-28 10:21:26 -08:00
Jun Wu
616306543b codemod: use explicit versions in Cargo.toml
Summary:
This is done by running `fix-code.py`. Note that those strings are
semvers so they do not pin down the exact version. An API-compatiable upgrade
is still possible.

Reviewed By: ikostia

Differential Revision: D10213073

fbshipit-source-id: 82f90766fb7e02cdeb6615ae3cb7212d928ed48d
2018-11-15 18:54:06 -08:00
Jun Wu
3adc813687 codemod: add copyright headers
Summary: This is just the result of running `./contrib/fix-code.py $(hg files .)`

Reviewed By: ikostia

Differential Revision: D10213075

fbshipit-source-id: 88577c9b9588a5b44fcf1fe6f0082815dfeb363a
2018-10-26 15:09:12 -07:00
Jun Wu
7752e9e81f rustlib: move Node to a separate "types" crate
Summary:
The `Node` type will be used in multiple places. Let's move it to a standalone
crate so new libraries depending on it won't need to pull in all of
revisionstore's dependencies.

Note: I'd also like the `types` create to only define clean types. Given the
fact NULL_ID is not a great design in Mercurial (`Option<Node>` is a better
choice in Rust), it probably does not belong to the formal Rust `Node` type.
This diff is merely about moving things with minimal changes. NULL_ID will
be decoupled from `Node` in a follow-up.

Reviewed By: markbt

Differential Revision: D10132047

fbshipit-source-id: 5d05c5e0ac06a2d58556c4db11775503f9495626
2018-10-03 18:19:27 -07:00
Harvey Hunt
70a0c74d3b Implement a bookmark store for managing mercurial bookmarks
Summary:
Create a storage object that can be used to load bookmarks from a
mercurial file, modify and query the bookmarks in memory and then write back
to a mercurial bookmark file.

Reviewed By: quark-zju

Differential Revision: D9768564

fbshipit-source-id: ed469d0e588ae2200d614bf62a5a0b577e7c6f74
2018-09-20 05:05:08 -07:00