##// END OF EJS Templates
rhg: raise wdir specific error for `hg debugdata`...
Pulkit Goyal -
r47577:e8ae91b1 default
parent child Browse files
Show More
@@ -35,6 +35,9 b' pub const NULL_REVISION: Revision = -1;'
35 #[allow(clippy::unreadable_literal)]
35 #[allow(clippy::unreadable_literal)]
36 pub const WORKING_DIRECTORY_REVISION: Revision = 0x7fffffff;
36 pub const WORKING_DIRECTORY_REVISION: Revision = 0x7fffffff;
37
37
38 pub const WORKING_DIRECTORY_HEX: &str =
39 "ffffffffffffffffffffffffffffffffffffffff";
40
38 /// The simplest expression of what we need of Mercurial DAGs.
41 /// The simplest expression of what we need of Mercurial DAGs.
39 pub trait Graph {
42 pub trait Graph {
40 /// Return the two parents of the given `Revision`.
43 /// Return the two parents of the given `Revision`.
@@ -23,6 +23,8 b' use crate::revlog::Revision;'
23 #[derive(derive_more::From)]
23 #[derive(derive_more::From)]
24 pub enum RevlogError {
24 pub enum RevlogError {
25 InvalidRevision,
25 InvalidRevision,
26 /// Working directory is not supported
27 WDirUnsupported,
26 /// Found more than one entry whose ID match the requested prefix
28 /// Found more than one entry whose ID match the requested prefix
27 AmbiguousPrefix,
29 AmbiguousPrefix,
28 #[from]
30 #[from]
@@ -7,7 +7,8 b' use crate::repo::Repo;'
7 use crate::revlog::changelog::Changelog;
7 use crate::revlog::changelog::Changelog;
8 use crate::revlog::revlog::{Revlog, RevlogError};
8 use crate::revlog::revlog::{Revlog, RevlogError};
9 use crate::revlog::NodePrefix;
9 use crate::revlog::NodePrefix;
10 use crate::revlog::{Revision, NULL_REVISION};
10 use crate::revlog::{Revision, NULL_REVISION, WORKING_DIRECTORY_HEX};
11 use crate::Node;
11
12
12 /// Resolve a query string into a single revision.
13 /// Resolve a query string into a single revision.
13 ///
14 ///
@@ -51,6 +52,10 b' pub fn resolve_rev_number_or_hex_prefix('
51 }
52 }
52 }
53 }
53 if let Ok(prefix) = NodePrefix::from_hex(input) {
54 if let Ok(prefix) = NodePrefix::from_hex(input) {
55 if prefix.is_prefix_of(&Node::from_hex(WORKING_DIRECTORY_HEX).unwrap())
56 {
57 return Err(RevlogError::WDirUnsupported);
58 }
54 return revlog.get_node_rev(prefix);
59 return revlog.get_node_rev(prefix);
55 }
60 }
56 Err(RevlogError::InvalidRevision)
61 Err(RevlogError::InvalidRevision)
@@ -157,6 +157,9 b' impl From<ConfigParseError> for CommandE'
157 impl From<(RevlogError, &str)> for CommandError {
157 impl From<(RevlogError, &str)> for CommandError {
158 fn from((err, rev): (RevlogError, &str)) -> CommandError {
158 fn from((err, rev): (RevlogError, &str)) -> CommandError {
159 match err {
159 match err {
160 RevlogError::WDirUnsupported => CommandError::abort(
161 "abort: working directory revision cannot be specified",
162 ),
160 RevlogError::InvalidRevision => CommandError::abort(format!(
163 RevlogError::InvalidRevision => CommandError::abort(format!(
161 "abort: invalid revision identifier: {}",
164 "abort: invalid revision identifier: {}",
162 rev
165 rev
@@ -531,17 +531,9 b' amount of time, displays error message a'
531
531
532 Test WdirUnsupported exception
532 Test WdirUnsupported exception
533
533
534 #if no-rhg
535 $ hg debugdata -c ffffffffffffffffffffffffffffffffffffffff
534 $ hg debugdata -c ffffffffffffffffffffffffffffffffffffffff
536 abort: working directory revision cannot be specified
535 abort: working directory revision cannot be specified
537 [255]
536 [255]
538 #else
539 TODO: add rhg support for (at least parsing) the working directory pseudo-changeset
540 $ hg debugdata -c ffffffffffffffffffffffffffffffffffffffff
541 abort: working directory revision cannot be specified (missing-correct-output !)
542 abort: invalid revision identifier: ffffffffffffffffffffffffffffffffffffffff (known-bad-output !)
543 [255]
544 #endif
545
537
546 Test cache warming command
538 Test cache warming command
547
539
General Comments 0
You need to be logged in to leave comments. Login now