##// END OF EJS Templates
rhg: fallback if the current command has any generic hook defined...
Raphaël Gomès -
r48889:f11f2335 default
parent child Browse files
Show More
@@ -68,6 +68,17 b' fn main_with_result('
68 let matches = app.clone().get_matches_safe()?;
68 let matches = app.clone().get_matches_safe()?;
69
69
70 let (subcommand_name, subcommand_matches) = matches.subcommand();
70 let (subcommand_name, subcommand_matches) = matches.subcommand();
71
72 for prefix in ["pre", "post", "fail"].iter() {
73 // Mercurial allows users to define generic hooks for commands,
74 // fallback if any are detected
75 let item = format!("{}-{}", prefix, subcommand_name);
76 let hook_for_command = config.get_str(b"hooks", item.as_bytes())?;
77 if hook_for_command.is_some() {
78 let msg = format!("{}-{} hook defined", prefix, subcommand_name);
79 return Err(CommandError::unsupported(msg));
80 }
81 }
71 let run = subcommand_run_fn(subcommand_name)
82 let run = subcommand_run_fn(subcommand_name)
72 .expect("unknown subcommand name from clap despite AppSettings::SubcommandRequired");
83 .expect("unknown subcommand name from clap despite AppSettings::SubcommandRequired");
73 let subcommand_args = subcommand_matches
84 let subcommand_args = subcommand_matches
@@ -215,6 +215,19 b' Fallback with filesets'
215 unsupported feature: fileset
215 unsupported feature: fileset
216 [252]
216 [252]
217
217
218 Fallback with generic hooks
219 $ $NO_FALLBACK rhg cat original --config hooks.pre-cat=something
220 unsupported feature: pre-cat hook defined
221 [252]
222
223 $ $NO_FALLBACK rhg cat original --config hooks.post-cat=something
224 unsupported feature: post-cat hook defined
225 [252]
226
227 $ $NO_FALLBACK rhg cat original --config hooks.fail-cat=something
228 unsupported feature: fail-cat hook defined
229 [252]
230
218 Requirements
231 Requirements
219 $ $NO_FALLBACK rhg debugrequirements
232 $ $NO_FALLBACK rhg debugrequirements
220 dotencode
233 dotencode
General Comments 0
You need to be logged in to leave comments. Login now