Show More
@@ -30,6 +30,10 b' impl DirstateParents {' | |||||
30 | p1: NULL_NODE, |
|
30 | p1: NULL_NODE, | |
31 | p2: NULL_NODE, |
|
31 | p2: NULL_NODE, | |
32 | }; |
|
32 | }; | |
|
33 | ||||
|
34 | pub fn is_merge(&self) -> bool { | |||
|
35 | return !(self.p2 == NULL_NODE); | |||
|
36 | } | |||
33 | } |
|
37 | } | |
34 |
|
38 | |||
35 | pub type StateMapIter<'a> = Box< |
|
39 | pub type StateMapIter<'a> = Box< |
@@ -104,6 +104,12 b" pub fn args() -> clap::App<'static, 'sta" | |||||
104 | .short("-n") |
|
104 | .short("-n") | |
105 | .long("--no-status"), |
|
105 | .long("--no-status"), | |
106 | ) |
|
106 | ) | |
|
107 | .arg( | |||
|
108 | Arg::with_name("verbose") | |||
|
109 | .help("enable additional output") | |||
|
110 | .short("-v") | |||
|
111 | .long("--verbose"), | |||
|
112 | ) | |||
107 | } |
|
113 | } | |
108 |
|
114 | |||
109 | /// Pure data type allowing the caller to specify file states to display |
|
115 | /// Pure data type allowing the caller to specify file states to display | |
@@ -150,6 +156,33 b' impl DisplayStates {' | |||||
150 | } |
|
156 | } | |
151 | } |
|
157 | } | |
152 |
|
158 | |||
|
159 | fn has_unfinished_merge(repo: &Repo) -> Result<bool, CommandError> { | |||
|
160 | return Ok(repo.dirstate_parents()?.is_merge()); | |||
|
161 | } | |||
|
162 | ||||
|
163 | fn has_unfinished_state(repo: &Repo) -> Result<bool, CommandError> { | |||
|
164 | // These are all the known values for the [fname] argument of | |||
|
165 | // [addunfinished] function in [state.py] | |||
|
166 | let known_state_files: &[&str] = &[ | |||
|
167 | "bisect.state", | |||
|
168 | "graftstate", | |||
|
169 | "histedit-state", | |||
|
170 | "rebasestate", | |||
|
171 | "shelvedstate", | |||
|
172 | "transplant/journal", | |||
|
173 | "updatestate", | |||
|
174 | ]; | |||
|
175 | if has_unfinished_merge(repo)? { | |||
|
176 | return Ok(true); | |||
|
177 | }; | |||
|
178 | for f in known_state_files { | |||
|
179 | if repo.hg_vfs().join(f).exists() { | |||
|
180 | return Ok(true); | |||
|
181 | } | |||
|
182 | } | |||
|
183 | return Ok(false); | |||
|
184 | } | |||
|
185 | ||||
153 | pub fn run(invocation: &crate::CliInvocation) -> Result<(), CommandError> { |
|
186 | pub fn run(invocation: &crate::CliInvocation) -> Result<(), CommandError> { | |
154 | // TODO: lift these limitations |
|
187 | // TODO: lift these limitations | |
155 | if invocation.config.get_bool(b"ui", b"tweakdefaults")? { |
|
188 | if invocation.config.get_bool(b"ui", b"tweakdefaults")? { | |
@@ -178,13 +211,9 b' pub fn run(invocation: &crate::CliInvoca' | |||||
178 |
|
211 | |||
179 | let verbose = !ui.plain(None) |
|
212 | let verbose = !ui.plain(None) | |
180 | && !args.is_present("print0") |
|
213 | && !args.is_present("print0") | |
181 | && (config.get_bool(b"ui", b"verbose")? |
|
214 | && (args.is_present("verbose") | |
|
215 | || config.get_bool(b"ui", b"verbose")? | |||
182 | || config.get_bool(b"commands", b"status.verbose")?); |
|
216 | || config.get_bool(b"commands", b"status.verbose")?); | |
183 | if verbose { |
|
|||
184 | return Err(CommandError::unsupported( |
|
|||
185 | "verbose status is not supported yet", |
|
|||
186 | )); |
|
|||
187 | } |
|
|||
188 |
|
217 | |||
189 | let all = args.is_present("all"); |
|
218 | let all = args.is_present("all"); | |
190 | let display_states = if all { |
|
219 | let display_states = if all { | |
@@ -214,6 +243,14 b' pub fn run(invocation: &crate::CliInvoca' | |||||
214 |
|
243 | |||
215 | let repo = invocation.repo?; |
|
244 | let repo = invocation.repo?; | |
216 |
|
245 | |||
|
246 | if verbose { | |||
|
247 | if has_unfinished_state(repo)? { | |||
|
248 | return Err(CommandError::unsupported( | |||
|
249 | "verbose status output is not supported by rhg (and is needed because we're in an unfinished operation)", | |||
|
250 | )); | |||
|
251 | }; | |||
|
252 | } | |||
|
253 | ||||
217 | if repo.has_sparse() || repo.has_narrow() { |
|
254 | if repo.has_sparse() || repo.has_narrow() { | |
218 | return Err(CommandError::unsupported( |
|
255 | return Err(CommandError::unsupported( | |
219 | "rhg status is not supported for sparse checkouts or narrow clones yet" |
|
256 | "rhg status is not supported for sparse checkouts or narrow clones yet" |
General Comments 0
You need to be logged in to leave comments.
Login now