Show More
@@ -1,30 +1,36 b'' | |||
|
1 | 1 | // Copyright 2018 Georges Racinet <gracinet@anybox.fr> |
|
2 | 2 | // |
|
3 | 3 | // This software may be used and distributed according to the terms of the |
|
4 | 4 | // GNU General Public License version 2 or any later version. |
|
5 | 5 | mod ancestors; |
|
6 | 6 | pub mod dagops; |
|
7 | 7 | pub use ancestors::{AncestorsIterator, LazyAncestors, MissingAncestors}; |
|
8 | 8 | #[cfg(test)] |
|
9 | 9 | pub mod testing; |
|
10 | 10 | |
|
11 | 11 | /// Mercurial revision numbers |
|
12 | 12 | /// |
|
13 | 13 | /// As noted in revlog.c, revision numbers are actually encoded in |
|
14 | 14 | /// 4 bytes, and are liberally converted to ints, whence the i32 |
|
15 | 15 | pub type Revision = i32; |
|
16 | 16 | |
|
17 | 17 | pub const NULL_REVISION: Revision = -1; |
|
18 | 18 | |
|
19 | /// Same as `mercurial.node.wdirrev` | |
|
20 | /// | |
|
21 | /// This is also equal to `i32::max_value()`, but it's better to spell | |
|
22 | /// it out explicitely, same as in `mercurial.node` | |
|
23 | pub const WORKING_DIRECTORY_REVISION: Revision = 0x7fffffff; | |
|
24 | ||
|
19 | 25 | /// The simplest expression of what we need of Mercurial DAGs. |
|
20 | 26 | pub trait Graph { |
|
21 | 27 | /// Return the two parents of the given `Revision`. |
|
22 | 28 | /// |
|
23 | 29 | /// Each of the parents can be independently `NULL_REVISION` |
|
24 | 30 | fn parents(&self, Revision) -> Result<[Revision; 2], GraphError>; |
|
25 | 31 | } |
|
26 | 32 | |
|
27 | 33 | #[derive(Clone, Debug, PartialEq)] |
|
28 | 34 | pub enum GraphError { |
|
29 | 35 | ParentOutOfRange(Revision), |
|
30 | 36 | } |
General Comments 0
You need to be logged in to leave comments.
Login now