Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RevDiff: Allow path filter for several files #10303

Merged
merged 1 commit into from
Nov 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion GitUI/CommandsDialogs/FormBrowse.InitMenusAndToolbars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ void InitFilters()

if (!string.IsNullOrWhiteSpace(pathFilter))
{
SetPathFilter(pathFilter);
SetPathFilter(pathFilter.QuoteNE());
}
}

Expand Down
6 changes: 5 additions & 1 deletion GitUI/CommandsDialogs/FormBrowse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -641,9 +641,13 @@ public IReadOnlyList<GitRevision> GetSelectedRevisions()

#endregion

/// <summary>
/// Set the path filter.
/// </summary>
/// <param name="pathFilter">Zero or more quoted paths, separated by spaces.</param>
public void SetPathFilter(string pathFilter)
{
RevisionGrid.SetAndApplyPathFilter(pathFilter.QuoteNE());
RevisionGrid.SetAndApplyPathFilter(pathFilter);
}

private void ShowDashboard()
Expand Down
4 changes: 2 additions & 2 deletions GitUI/CommandsDialogs/RevisionDiffControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ private void diffShowInFileTreeToolStripMenuItem_Click(object sender, EventArgs

private void diffFilterFileInGridToolStripMenuItem_Click(object sender, EventArgs e)
{
(FindForm() as FormBrowse)?.SetPathFilter(DiffFiles.SelectedItems.First().Item.Name.ToPosixPath());
(FindForm() as FormBrowse)?.SetPathFilter(string.Join(" ", DiffFiles.SelectedItems.Select(f => f.Item.Name.ToPosixPath().QuoteNE())));
}

private void UpdateStatusOfMenuItems()
Expand Down Expand Up @@ -719,7 +719,7 @@ private void UpdateStatusOfMenuItems()

// Visibility of FileTree is not known, assume (CommitInfoTabControl.Contains(TreeTabPage);)
diffShowInFileTreeToolStripMenuItem.Visible = _revisionDiffController.ShouldShowMenuShowInFileTree(selectionInfo);
diffFilterFileInGridToolStripMenuItem.Enabled = _revisionDiffController.ShouldShowMenuFileHistory(selectionInfo);
diffFilterFileInGridToolStripMenuItem.Enabled = _revisionDiffController.ShouldShowResetFileMenus(selectionInfo);
fileHistoryDiffToolstripMenuItem.Enabled = _revisionDiffController.ShouldShowMenuFileHistory(selectionInfo);
blameToolStripMenuItem.Enabled = AppSettings.UseDiffViewerForBlame.Value
? _revisionDiffController.ShouldShowMenuBlame(selectionInfo)
Expand Down
2 changes: 1 addition & 1 deletion GitUI/CommandsDialogs/RevisionFileTreeControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ private void filterFileInGridToolStripMenuItem_Click(object sender, EventArgs e)
{
if (TryGetSelectedName(out string name))
{
(FindForm() as FormBrowse)?.SetPathFilter(name.ToPosixPath());
(FindForm() as FormBrowse)?.SetPathFilter(name.ToPosixPath().QuoteNE());
}
}

Expand Down