Skip to content

Commit

Permalink
Rebase onto: Display only the current branch to make selection easier
Browse files Browse the repository at this point in the history
  • Loading branch information
pmiossec committed Oct 25, 2021
1 parent 9f8c00c commit 3fa48a2
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
19 changes: 16 additions & 3 deletions GitUI/CommandsDialogs/FormRebase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -337,10 +337,23 @@ private void chkUseFromOnto_CheckedChanged(object sender, EventArgs e)

private void btnChooseFromRevision_Click(object sender, EventArgs e)
{
using FormChooseCommit chooseForm = new(UICommands, txtFrom.Text);
if (chooseForm.ShowDialog(this) == DialogResult.OK && chooseForm.SelectedRevision is not null)
var previousValueBranchFilterEnabled = AppSettings.BranchFilterEnabled;
var previousValueShowCurrentBranchOnly = AppSettings.ShowCurrentBranchOnly;
var previousValueShowReflogReferences = AppSettings.ShowReflogReferences;

try
{
using FormChooseCommit chooseForm = new(UICommands, txtFrom.Text, showCurrentBranchOnly: true);
if (chooseForm.ShowDialog(this) == DialogResult.OK && chooseForm.SelectedRevision is not null)
{
txtFrom.Text = chooseForm.SelectedRevision.ObjectId.ToShortString();
}
}
finally
{
txtFrom.Text = chooseForm.SelectedRevision.ObjectId.ToShortString();
AppSettings.BranchFilterEnabled = previousValueBranchFilterEnabled;
AppSettings.ShowCurrentBranchOnly = previousValueShowCurrentBranchOnly;
AppSettings.ShowReflogReferences = previousValueShowReflogReferences;
}
}

Expand Down
6 changes: 5 additions & 1 deletion GitUI/HelperDialogs/FormChooseCommit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,15 @@ private FormChooseCommit(GitUICommands commands)
InitializeComplete();
}

public FormChooseCommit(GitUICommands commands, string? preselectCommit, bool showArtificial = false)
public FormChooseCommit(GitUICommands commands, string? preselectCommit, bool showArtificial = false, bool showCurrentBranchOnly = false)
: this(commands)
{
revisionGrid.MultiSelect = false;
revisionGrid.ShowUncommittedChangesIfPossible = showArtificial;
if (showCurrentBranchOnly)
{
revisionGrid.ShowCurrentBranchOnly();
}

if (!string.IsNullOrEmpty(preselectCommit))
{
Expand Down

0 comments on commit 3fa48a2

Please sign in to comment.