Show More
@@ -1,38 +1,38 b'' | |||
|
1 | 1 | // Copyright 2018-2020 Georges Racinet <georges.racinet@octobus.net> |
|
2 | 2 | // and Mercurial contributors |
|
3 | 3 | // |
|
4 | 4 | // This software may be used and distributed according to the terms of the |
|
5 | 5 | // GNU General Public License version 2 or any later version. |
|
6 | 6 | //! Mercurial concepts for handling revision history |
|
7 | 7 | |
|
8 | 8 | /// Mercurial revision numbers |
|
9 | 9 | /// |
|
10 | 10 | /// As noted in revlog.c, revision numbers are actually encoded in |
|
11 | 11 | /// 4 bytes, and are liberally converted to ints, whence the i32 |
|
12 | 12 | pub type Revision = i32; |
|
13 | 13 | |
|
14 | 14 | /// Marker expressing the absence of a parent |
|
15 | 15 | /// |
|
16 | 16 | /// Independently of the actual representation, `NULL_REVISION` is guaranteed |
|
17 |
/// to be smaller tha |
|
|
17 | /// to be smaller than all existing revisions. | |
|
18 | 18 | pub const NULL_REVISION: Revision = -1; |
|
19 | 19 | |
|
20 | 20 | /// Same as `mercurial.node.wdirrev` |
|
21 | 21 | /// |
|
22 | 22 | /// This is also equal to `i32::max_value()`, but it's better to spell |
|
23 | 23 | /// it out explicitely, same as in `mercurial.node` |
|
24 | 24 | pub const WORKING_DIRECTORY_REVISION: Revision = 0x7fffffff; |
|
25 | 25 | |
|
26 | 26 | /// The simplest expression of what we need of Mercurial DAGs. |
|
27 | 27 | pub trait Graph { |
|
28 | 28 | /// Return the two parents of the given `Revision`. |
|
29 | 29 | /// |
|
30 | 30 | /// Each of the parents can be independently `NULL_REVISION` |
|
31 | 31 | fn parents(&self, rev: Revision) -> Result<[Revision; 2], GraphError>; |
|
32 | 32 | } |
|
33 | 33 | |
|
34 | 34 | #[derive(Clone, Debug, PartialEq)] |
|
35 | 35 | pub enum GraphError { |
|
36 | 36 | ParentOutOfRange(Revision), |
|
37 | 37 | WorkingDirectoryUnsupported, |
|
38 | 38 | } |
General Comments 0
You need to be logged in to leave comments.
Login now