gix_revision/spec/parse/
mod.rs1use bstr::BString;
2
3use crate::spec;
4
5#[derive(Debug, thiserror::Error)]
7#[allow(missing_docs)]
8pub enum Error {
9 #[error("'~' needs to follow an anchor, like '@~'.")]
10 MissingTildeAnchor,
11 #[error("':' needs to be followed by either '/' and regex or the path to lookup in the HEAD tree.")]
12 MissingColonSuffix,
13 #[error("':/' must be followed by a regular expression.")]
14 EmptyTopLevelRegex,
15 #[error("Need one character after '/!', typically '-', but got {:?}", .regex)]
16 UnspecifiedRegexModifier { regex: BString },
17 #[error("Cannot peel to {:?} - unknown target.", .input)]
18 InvalidObject { input: BString },
19 #[error("Could not parse time {:?} for revlog lookup.", .input)]
20 Time {
21 input: BString,
22 source: Option<gix_date::parse::Error>,
23 },
24 #[error("Sibling branches like 'upstream' or 'push' require a branch name with remote configuration, got {:?}", .name)]
25 SiblingBranchNeedsBranchName { name: BString },
26 #[error("Reflog entries require a ref name, got {:?}", .name)]
27 ReflogLookupNeedsRefName { name: BString },
28 #[error("A reference name must be followed by positive numbers in '@{{n}}', got {:?}", .nav)]
29 RefnameNeedsPositiveReflogEntries { nav: BString },
30 #[error("Negative or explicitly positive numbers are invalid here: {:?}", .input)]
31 SignedNumber { input: BString },
32 #[error("Could not parse number from {input:?}")]
33 InvalidNumber { input: BString },
34 #[error("Negative zeroes are invalid: {:?} - remove the '-'", .input)]
35 NegativeZero { input: BString },
36 #[error("The opening brace in {:?} was not matched", .input)]
37 UnclosedBracePair { input: BString },
38 #[error("Cannot set spec kind more than once. Previous value was {:?}, now it is {:?}", .prev_kind, .kind)]
39 KindSetTwice { prev_kind: spec::Kind, kind: spec::Kind },
40 #[error("The @ character is either standing alone or followed by `{{<content>}}`, got {:?}", .input)]
41 AtNeedsCurlyBrackets { input: BString },
42 #[error("A portion of the input could not be parsed: {:?}", .input)]
43 UnconsumedInput { input: BString },
44 #[error("The delegate didn't indicate success - check delegate for more information")]
45 Delegate,
46}
47
48pub mod delegate;
50
51pub trait Delegate: delegate::Revision + delegate::Navigate + delegate::Kind {
57 fn done(&mut self);
62}
63
64pub(crate) mod function;