##// END OF EJS Templates
rhg: allow setting defaults.cmd to an empty string...
Spencer Baugh -
r51779:12476986 default
parent child Browse files
Show More
@@ -76,10 +76,15 b' fn main_with_result('
76
76
77 // Mercurial allows users to define "defaults" for commands, fallback
77 // Mercurial allows users to define "defaults" for commands, fallback
78 // if a default is detected for the current command
78 // if a default is detected for the current command
79 let defaults = config.get_str(b"defaults", subcommand_name.as_bytes());
79 let defaults = config.get_str(b"defaults", subcommand_name.as_bytes())?;
80 if defaults?.is_some() {
80 match defaults {
81 let msg = "`defaults` config set";
81 // Programmatic usage might set defaults to an empty string to unset
82 return Err(CommandError::unsupported(msg));
82 // it; allow that
83 None | Some("") => {}
84 Some(_) => {
85 let msg = "`defaults` config set";
86 return Err(CommandError::unsupported(msg));
87 }
83 }
88 }
84
89
85 for prefix in ["pre", "post", "fail"].iter() {
90 for prefix in ["pre", "post", "fail"].iter() {
General Comments 0
You need to be logged in to leave comments. Login now