Mercurial > hg
diff rust/rhg/src/commands/files.rs @ 49985:e57f76c28f7b
rhg-files: add support for narrow when specifying a revision
This makes it so that `rhg files -r NODE` works properly when using narrow.
author | Raphaël Gomès <rgomes@octobus.net> |
---|---|
date | Wed, 11 Jan 2023 17:30:55 +0100 |
parents | df9eabc9837b |
children | 74e4dbb0fcd5 |
line wrap: on
line diff
--- a/rust/rhg/src/commands/files.rs Wed Jan 11 17:08:23 2023 +0100 +++ b/rust/rhg/src/commands/files.rs Wed Jan 11 17:30:55 2023 +0100 @@ -51,24 +51,15 @@ )); } + let (narrow_matcher, narrow_warnings) = narrow::matcher(repo)?; + print_narrow_sparse_warnings(&narrow_warnings, &[], invocation.ui, repo)?; + if let Some(rev) = rev { - if repo.has_narrow() { - return Err(CommandError::unsupported( - "rhg files -r <rev> is not supported in narrow clones", - )); - } - let files = list_rev_tracked_files(repo, rev) + let files = list_rev_tracked_files(repo, rev, narrow_matcher) .map_err(|e| (e, rev.as_ref()))?; display_files(invocation.ui, repo, files.iter()) } else { // The dirstate always reflects the sparse narrowspec. - let (narrow_matcher, narrow_warnings) = narrow::matcher(repo)?; - print_narrow_sparse_warnings( - &narrow_warnings, - &[], - invocation.ui, - repo, - )?; let dirstate = repo.dirstate_map()?; let files_res: Result<Vec<_>, _> = filter_map_results(dirstate.iter(), |(path, entry)| {