ok/jj
1
0
Fork 0
forked from mirrors/jj

cli: add support for restricting jj files by paths

This commit is contained in:
Martin von Zweigbergk 2022-02-09 12:20:31 -08:00
parent dabfd04da6
commit 68710366b4

View file

@ -857,7 +857,8 @@ fn get_app<'help>() -> App<'help> {
.arg(paths_arg()); .arg(paths_arg());
let files_command = App::new("files") let files_command = App::new("files")
.about("List files in a revision") .about("List files in a revision")
.arg(rev_arg().help("The revision to list files in")); .arg(rev_arg().help("The revision to list files in"))
.arg(paths_arg());
let diff_command = App::new("diff") let diff_command = App::new("diff")
.about("Show changes in a revision") .about("Show changes in a revision")
.long_about( .long_about(
@ -1800,7 +1801,12 @@ fn cmd_untrack(
fn cmd_files(ui: &mut Ui, command: &CommandHelper, args: &ArgMatches) -> Result<(), CommandError> { fn cmd_files(ui: &mut Ui, command: &CommandHelper, args: &ArgMatches) -> Result<(), CommandError> {
let mut workspace_command = command.workspace_helper(ui)?; let mut workspace_command = command.workspace_helper(ui)?;
let commit = workspace_command.resolve_revision_arg(ui, args)?; let commit = workspace_command.resolve_revision_arg(ui, args)?;
for (name, _value) in commit.tree().entries() { let matcher = matcher_from_values(
ui,
workspace_command.workspace_root(),
args.values_of("paths"),
)?;
for (name, _value) in commit.tree().entries_matching(matcher.as_ref()) {
writeln!( writeln!(
ui, ui,
"{}", "{}",