Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Resources/Locales/en_US.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
<x:String x:Key="Text.CommitCM.CopySHA" xml:space="preserve">SHA</x:String>
<x:String x:Key="Text.CommitCM.CopySubject" xml:space="preserve">Subject</x:String>
<x:String x:Key="Text.CommitCM.CustomAction" xml:space="preserve">Custom Action</x:String>
<x:String x:Key="Text.CommitCM.Drop" xml:space="preserve">Drop Commit</x:String>
<x:String x:Key="Text.CommitCM.InteractiveRebase" xml:space="preserve">Interactively Rebase ${0}$ on ${1}$</x:String>
<x:String x:Key="Text.CommitCM.Merge" xml:space="preserve">Merge to ${0}$</x:String>
<x:String x:Key="Text.CommitCM.MergeMultiple" xml:space="preserve">Merge ...</x:String>
Expand Down
11 changes: 11 additions & 0 deletions src/ViewModels/Histories.cs
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,17 @@ public ContextMenu CreateContextMenuForSelectedCommits(List<Models.Commit> selec
e.Handled = true;
};
menu.Items.Add(revert);

var drop = new MenuItem();
drop.Header = App.Text("CommitCM.Drop");
drop.Icon = App.CreateMenuIcon("Icons.Clear");
drop.Click += async (_, e) =>
{
var parent = await new Commands.QuerySingleCommit(_repo.FullPath, commit.Parents[0]).GetResultAsync();
await App.ShowDialog(new InteractiveRebase(_repo, current, parent, Models.InteractiveRebaseAction.Drop));
e.Handled = true;
};
menu.Items.Add(drop);
}

if (current.Head != commit.SHA)
Expand Down
12 changes: 7 additions & 5 deletions src/ViewModels/InteractiveRebase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,8 @@ public CommitDetail DetailContext
private set;
}

public InteractiveRebase(Repository repo, Models.Branch current, Models.Commit on)
public InteractiveRebase(Repository repo, Models.Branch current, Models.Commit on, Models.InteractiveRebaseAction lastAction = Models.InteractiveRebaseAction.Pick)
{
var repoPath = repo.FullPath;
_repo = repo;

Current = current;
Expand All @@ -135,22 +134,25 @@ public InteractiveRebase(Repository repo, Models.Branch current, Models.Commit o

Task.Run(async () =>
{
var commits = await new Commands.QueryCommitsForInteractiveRebase(repoPath, on.SHA)
var commits = await new Commands.QueryCommitsForInteractiveRebase(repo.FullPath, on.SHA)
.GetResultAsync()
.ConfigureAwait(false);

var list = new List<InteractiveRebaseItem>();
for (var i = 0; i < commits.Count; i++)
{
var c = commits[i];
list.Add(new InteractiveRebaseItem(c.Commit, c.Message, i < commits.Count - 1));
var item = new InteractiveRebaseItem(c.Commit, c.Message, i < commits.Count - 1);
if (i == commits.Count - 1)
item.Action = lastAction;
list.Add(item);
}

Dispatcher.UIThread.Post(() =>
{
Items.AddRange(list);
if (list.Count > 0)
SelectedItem = list[0];
SelectedItem = lastAction == Models.InteractiveRebaseAction.Pick ? list[0] : list[^1];
IsLoading = false;
});
});
Expand Down
Loading