@@ -28,7 +28,6 @@ use jj_lib::backend::TreeValue;
28
28
use jj_lib:: fileset;
29
29
use jj_lib:: fileset:: FilesetDiagnostics ;
30
30
use jj_lib:: fileset:: FilesetExpression ;
31
- use jj_lib:: matchers:: EverythingMatcher ;
32
31
use jj_lib:: matchers:: Matcher ;
33
32
use jj_lib:: merged_tree:: MergedTree ;
34
33
use jj_lib:: merged_tree:: MergedTreeBuilder ;
@@ -106,20 +105,6 @@ use crate::ui::Ui;
106
105
/// currently unspecified, and may change between releases. If two tools affect
107
106
/// the same file, the second tool to run will receive its input from the
108
107
/// output of the first tool.
109
- ///
110
- /// There is also a deprecated configuration schema that defines a single
111
- /// command that will affect all changed files in the specified revisions. For
112
- /// example, the following configuration would apply the Rust formatter to all
113
- /// changed files (whether they are Rust files or not):
114
- ///
115
- /// ```toml
116
- /// [fix]
117
- /// tool-command = ["rustfmt", "--emit", "stdout"]
118
- /// ```
119
- ///
120
- /// The tool defined by `tool-command` acts as if it was the first entry in
121
- /// `fix.tools`, and uses `pattern = "all()"``. Support for `tool-command`
122
- /// will be removed in a future version.
123
108
#[ derive( clap:: Args , Clone , Debug ) ]
124
109
#[ command( verbatim_doc_comment) ]
125
110
pub ( crate ) struct FixArgs {
@@ -443,43 +428,10 @@ struct RawToolConfig {
443
428
444
429
/// Parses the `fix.tools` config table.
445
430
///
446
- /// Parses the deprecated `fix.tool-command` config as if it was the first entry
447
- /// in `fix.tools`.
448
- ///
449
431
/// Fails if any of the commands or patterns are obviously unusable, but does
450
432
/// not check for issues that might still occur later like missing executables.
451
433
/// This is a place where we could fail earlier in some cases, though.
452
434
fn get_tools_config ( ui : & mut Ui , settings : & UserSettings ) -> Result < ToolsConfig , CommandError > {
453
- let mut tools_config = ToolsConfig { tools : Vec :: new ( ) } ;
454
- // TODO: Remove this block of code and associated documentation after at least
455
- // one release where the feature is marked deprecated.
456
- if let Ok ( tool_command) = settings. get :: < CommandNameAndArgs > ( "fix.tool-command" ) {
457
- // This doesn't change the displayed indices of the `fix.tools` definitions, and
458
- // doesn't have a `name` that could conflict with them. That would matter more
459
- // if we already had better error handling that made use of the `name`.
460
- tools_config. tools . push ( ToolConfig {
461
- command : tool_command,
462
- matcher : Box :: new ( EverythingMatcher ) ,
463
- } ) ;
464
-
465
- // TODO: Reimplement as a ConfigMigrationRule
466
- writeln ! (
467
- ui. warning_default( ) ,
468
- r"The `fix.tool-command` config option is deprecated and will be removed in a future version."
469
- ) ?;
470
- writeln ! (
471
- ui. hint_default( ) ,
472
- r###"Replace it with the following:
473
- [fix.tools.legacy-tool-command]
474
- command = {}
475
- patterns = ["all()"]
476
- "### ,
477
- settings
478
- . get_value( "fix.tool-command" )
479
- . unwrap( )
480
- . decorated( "" , "" ) // trim whitespace
481
- ) ?;
482
- }
483
435
let tools: Vec < ToolConfig > = settings
484
436
. table_keys ( "fix.tools" )
485
437
// Sort keys early so errors are deterministic.
@@ -509,15 +461,9 @@ fn get_tools_config(ui: &mut Ui, settings: &UserSettings) -> Result<ToolsConfig,
509
461
} )
510
462
} )
511
463
. try_collect ( ) ?;
512
- tools_config. tools . extend ( tools) ;
513
- if tools_config. tools . is_empty ( ) {
514
- // TODO: This is not a useful message when one or both fields are present but
515
- // have the wrong type. After removing `fix.tool-command`, it will be simpler to
516
- // propagate any errors from `settings.get_array("fix.tools")`.
517
- Err ( config_error (
518
- "At least one entry of `fix.tools` or `fix.tool-command` is required." . to_string ( ) ,
519
- ) )
464
+ if tools. is_empty ( ) {
465
+ Err ( config_error ( "No `fix.tools` are configured" ) )
520
466
} else {
521
- Ok ( tools_config )
467
+ Ok ( ToolsConfig { tools } )
522
468
}
523
469
}
0 commit comments