Show More
@@ -350,11 +350,7 b' fn rhg_main(argv: Vec<OsString>) -> ! {' | |||||
350 | &argv, |
|
350 | &argv, | |
351 | &initial_current_dir, |
|
351 | &initial_current_dir, | |
352 | &ui, |
|
352 | &ui, | |
353 |
OnUnsupported:: |
|
353 | OnUnsupported::fallback(config), | |
354 | executable: config |
|
|||
355 | .get(b"rhg", b"fallback-executable") |
|
|||
356 | .map(ToOwned::to_owned), |
|
|||
357 | }, |
|
|||
358 | Err(CommandError::unsupported( |
|
354 | Err(CommandError::unsupported( | |
359 | "`rhg.fallback-immediately is true`", |
|
355 | "`rhg.fallback-immediately is true`", | |
360 | )), |
|
356 | )), | |
@@ -663,6 +659,18 b' enum OnUnsupported {' | |||||
663 | impl OnUnsupported { |
|
659 | impl OnUnsupported { | |
664 | const DEFAULT: Self = OnUnsupported::Abort; |
|
660 | const DEFAULT: Self = OnUnsupported::Abort; | |
665 |
|
661 | |||
|
662 | fn fallback_executable(config: &Config) -> Option<Vec<u8>> { | |||
|
663 | config | |||
|
664 | .get(b"rhg", b"fallback-executable") | |||
|
665 | .map(|x| x.to_owned()) | |||
|
666 | } | |||
|
667 | ||||
|
668 | fn fallback(config: &Config) -> Self { | |||
|
669 | OnUnsupported::Fallback { | |||
|
670 | executable: Self::fallback_executable(config), | |||
|
671 | } | |||
|
672 | } | |||
|
673 | ||||
666 | fn from_config(config: &Config) -> Self { |
|
674 | fn from_config(config: &Config) -> Self { | |
667 | match config |
|
675 | match config | |
668 | .get(b"rhg", b"on-unsupported") |
|
676 | .get(b"rhg", b"on-unsupported") | |
@@ -671,11 +679,7 b' impl OnUnsupported {' | |||||
671 | { |
|
679 | { | |
672 | Some(b"abort") => OnUnsupported::Abort, |
|
680 | Some(b"abort") => OnUnsupported::Abort, | |
673 | Some(b"abort-silent") => OnUnsupported::AbortSilent, |
|
681 | Some(b"abort-silent") => OnUnsupported::AbortSilent, | |
674 |
Some(b"fallback") => |
|
682 | Some(b"fallback") => Self::fallback(config), | |
675 | executable: config |
|
|||
676 | .get(b"rhg", b"fallback-executable") |
|
|||
677 | .map(|x| x.to_owned()), |
|
|||
678 | }, |
|
|||
679 | None => Self::DEFAULT, |
|
683 | None => Self::DEFAULT, | |
680 | Some(_) => { |
|
684 | Some(_) => { | |
681 | // TODO: warn about unknown config value |
|
685 | // TODO: warn about unknown config value |
General Comments 0
You need to be logged in to leave comments.
Login now