mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-25 21:07:20 -08:00
enhance: show reverting commit in banner while reverting is in-progress
This commit is contained in:
parent
2dd9cab695
commit
93d9a04460
6 changed files with 36 additions and 9 deletions
|
@ -399,6 +399,7 @@
|
||||||
<x:String x:Key="Text.InProgress.Rebase" xml:space="preserve">Rebase in progress.</x:String>
|
<x:String x:Key="Text.InProgress.Rebase" xml:space="preserve">Rebase in progress.</x:String>
|
||||||
<x:String x:Key="Text.InProgress.Rebase.StoppedAt" xml:space="preserve">Stopped at</x:String>
|
<x:String x:Key="Text.InProgress.Rebase.StoppedAt" xml:space="preserve">Stopped at</x:String>
|
||||||
<x:String x:Key="Text.InProgress.Revert" xml:space="preserve">Revert in progress.</x:String>
|
<x:String x:Key="Text.InProgress.Revert" xml:space="preserve">Revert in progress.</x:String>
|
||||||
|
<x:String x:Key="Text.InProgress.Revert.Head" xml:space="preserve">Reverting commit</x:String>
|
||||||
<x:String x:Key="Text.InteractiveRebase" xml:space="preserve">Interactive Rebase</x:String>
|
<x:String x:Key="Text.InteractiveRebase" xml:space="preserve">Interactive Rebase</x:String>
|
||||||
<x:String x:Key="Text.InteractiveRebase.Target" xml:space="preserve">Target Branch:</x:String>
|
<x:String x:Key="Text.InteractiveRebase.Target" xml:space="preserve">Target Branch:</x:String>
|
||||||
<x:String x:Key="Text.InteractiveRebase.On" xml:space="preserve">On:</x:String>
|
<x:String x:Key="Text.InteractiveRebase.On" xml:space="preserve">On:</x:String>
|
||||||
|
|
|
@ -402,6 +402,7 @@
|
||||||
<x:String x:Key="Text.InProgress.Rebase" xml:space="preserve">变基(Rebase)操作进行中。</x:String>
|
<x:String x:Key="Text.InProgress.Rebase" xml:space="preserve">变基(Rebase)操作进行中。</x:String>
|
||||||
<x:String x:Key="Text.InProgress.Rebase.StoppedAt" xml:space="preserve">当前停止于</x:String>
|
<x:String x:Key="Text.InProgress.Rebase.StoppedAt" xml:space="preserve">当前停止于</x:String>
|
||||||
<x:String x:Key="Text.InProgress.Revert" xml:space="preserve">回滚提交操作进行中。</x:String>
|
<x:String x:Key="Text.InProgress.Revert" xml:space="preserve">回滚提交操作进行中。</x:String>
|
||||||
|
<x:String x:Key="Text.InProgress.Revert.Head" xml:space="preserve">正在回滚提交</x:String>
|
||||||
<x:String x:Key="Text.InteractiveRebase" xml:space="preserve">交互式变基</x:String>
|
<x:String x:Key="Text.InteractiveRebase" xml:space="preserve">交互式变基</x:String>
|
||||||
<x:String x:Key="Text.InteractiveRebase.Target" xml:space="preserve">目标分支 :</x:String>
|
<x:String x:Key="Text.InteractiveRebase.Target" xml:space="preserve">目标分支 :</x:String>
|
||||||
<x:String x:Key="Text.InteractiveRebase.On" xml:space="preserve">起始提交 :</x:String>
|
<x:String x:Key="Text.InteractiveRebase.On" xml:space="preserve">起始提交 :</x:String>
|
||||||
|
|
|
@ -402,6 +402,7 @@
|
||||||
<x:String x:Key="Text.InProgress.Rebase" xml:space="preserve">重定基底 (rebase) 操作進行中。</x:String>
|
<x:String x:Key="Text.InProgress.Rebase" xml:space="preserve">重定基底 (rebase) 操作進行中。</x:String>
|
||||||
<x:String x:Key="Text.InProgress.Rebase.StoppedAt" xml:space="preserve">当前停止于</x:String>
|
<x:String x:Key="Text.InProgress.Rebase.StoppedAt" xml:space="preserve">当前停止于</x:String>
|
||||||
<x:String x:Key="Text.InProgress.Revert" xml:space="preserve">復原提交操作進行中。</x:String>
|
<x:String x:Key="Text.InProgress.Revert" xml:space="preserve">復原提交操作進行中。</x:String>
|
||||||
|
<x:String x:Key="Text.InProgress.Revert.Head" xml:space="preserve">正在復原提交</x:String>
|
||||||
<x:String x:Key="Text.InteractiveRebase" xml:space="preserve">互動式重定基底</x:String>
|
<x:String x:Key="Text.InteractiveRebase" xml:space="preserve">互動式重定基底</x:String>
|
||||||
<x:String x:Key="Text.InteractiveRebase.Target" xml:space="preserve">目標分支:</x:String>
|
<x:String x:Key="Text.InteractiveRebase.Target" xml:space="preserve">目標分支:</x:String>
|
||||||
<x:String x:Key="Text.InteractiveRebase.On" xml:space="preserve">起始提交:</x:String>
|
<x:String x:Key="Text.InteractiveRebase.On" xml:space="preserve">起始提交:</x:String>
|
||||||
|
|
|
@ -93,7 +93,7 @@ namespace SourceGit.ViewModels
|
||||||
public CherryPickInProgress(Repository repo) : base(repo.FullPath, "cherry-pick", true)
|
public CherryPickInProgress(Repository repo) : base(repo.FullPath, "cherry-pick", true)
|
||||||
{
|
{
|
||||||
var headSHA = File.ReadAllText(Path.Combine(repo.GitDir, "CHERRY_PICK_HEAD")).Trim();
|
var headSHA = File.ReadAllText(Path.Combine(repo.GitDir, "CHERRY_PICK_HEAD")).Trim();
|
||||||
Head = new Commands.QuerySingleCommit(repo.FullPath, headSHA).Result();
|
Head = new Commands.QuerySingleCommit(repo.FullPath, headSHA).Result() ?? new Models.Commit() { SHA = headSHA };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,7 +171,17 @@ namespace SourceGit.ViewModels
|
||||||
|
|
||||||
public class RevertInProgress : InProgressContext
|
public class RevertInProgress : InProgressContext
|
||||||
{
|
{
|
||||||
public RevertInProgress(Repository repo) : base(repo.FullPath, "revert", false) { }
|
public Models.Commit Head
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
private set;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RevertInProgress(Repository repo) : base(repo.FullPath, "revert", false)
|
||||||
|
{
|
||||||
|
var headSHA = File.ReadAllText(Path.Combine(repo.GitDir, "REVERT_HEAD")).Trim();
|
||||||
|
Head = new Commands.QuerySingleCommit(repo.FullPath, headSHA).Result() ?? new Models.Commit() { SHA = headSHA };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class MergeInProgress : InProgressContext
|
public class MergeInProgress : InProgressContext
|
||||||
|
|
|
@ -569,14 +569,19 @@ namespace SourceGit.ViewModels
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (_inProgressContext is RebaseInProgress rebase)
|
if (_inProgressContext is CherryPickInProgress cherryPick)
|
||||||
|
{
|
||||||
|
useTheirs.Header = new Views.NameHighlightedTextBlock("FileCM.ResolveUsing", cherryPick.HeadName);
|
||||||
|
useMine.Header = new Views.NameHighlightedTextBlock("FileCM.ResolveUsing", _repo.CurrentBranch.Name);
|
||||||
|
}
|
||||||
|
else if(_inProgressContext is RebaseInProgress rebase)
|
||||||
{
|
{
|
||||||
useTheirs.Header = new Views.NameHighlightedTextBlock("FileCM.ResolveUsing", rebase.HeadName);
|
useTheirs.Header = new Views.NameHighlightedTextBlock("FileCM.ResolveUsing", rebase.HeadName);
|
||||||
useMine.Header = new Views.NameHighlightedTextBlock("FileCM.ResolveUsing", rebase.BaseName);
|
useMine.Header = new Views.NameHighlightedTextBlock("FileCM.ResolveUsing", rebase.BaseName);
|
||||||
}
|
}
|
||||||
else if (_inProgressContext is CherryPickInProgress cherryPick)
|
else if (_inProgressContext is RevertInProgress revert)
|
||||||
{
|
{
|
||||||
useTheirs.Header = new Views.NameHighlightedTextBlock("FileCM.ResolveUsing", cherryPick.HeadName);
|
useTheirs.Header = new Views.NameHighlightedTextBlock("FileCM.ResolveUsing", revert.Head.SHA.Substring(0, 10) + " (revert)");
|
||||||
useMine.Header = new Views.NameHighlightedTextBlock("FileCM.ResolveUsing", _repo.CurrentBranch.Name);
|
useMine.Header = new Views.NameHighlightedTextBlock("FileCM.ResolveUsing", _repo.CurrentBranch.Name);
|
||||||
}
|
}
|
||||||
else if (_inProgressContext is MergeInProgress merge)
|
else if (_inProgressContext is MergeInProgress merge)
|
||||||
|
@ -909,14 +914,19 @@ namespace SourceGit.ViewModels
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (_inProgressContext is RebaseInProgress rebase)
|
if (_inProgressContext is CherryPickInProgress cherryPick)
|
||||||
|
{
|
||||||
|
useTheirs.Header = new Views.NameHighlightedTextBlock("FileCM.ResolveUsing", cherryPick.HeadName);
|
||||||
|
useMine.Header = new Views.NameHighlightedTextBlock("FileCM.ResolveUsing", _repo.CurrentBranch.Name);
|
||||||
|
}
|
||||||
|
else if (_inProgressContext is RebaseInProgress rebase)
|
||||||
{
|
{
|
||||||
useTheirs.Header = new Views.NameHighlightedTextBlock("FileCM.ResolveUsing", rebase.HeadName);
|
useTheirs.Header = new Views.NameHighlightedTextBlock("FileCM.ResolveUsing", rebase.HeadName);
|
||||||
useMine.Header = new Views.NameHighlightedTextBlock("FileCM.ResolveUsing", rebase.BaseName);
|
useMine.Header = new Views.NameHighlightedTextBlock("FileCM.ResolveUsing", rebase.BaseName);
|
||||||
}
|
}
|
||||||
else if (_inProgressContext is CherryPickInProgress cherryPick)
|
else if (_inProgressContext is RevertInProgress revert)
|
||||||
{
|
{
|
||||||
useTheirs.Header = new Views.NameHighlightedTextBlock("FileCM.ResolveUsing", cherryPick.HeadName);
|
useTheirs.Header = new Views.NameHighlightedTextBlock("FileCM.ResolveUsing", revert.Head.SHA.Substring(0,10) + " (revert)");
|
||||||
useMine.Header = new Views.NameHighlightedTextBlock("FileCM.ResolveUsing", _repo.CurrentBranch.Name);
|
useMine.Header = new Views.NameHighlightedTextBlock("FileCM.ResolveUsing", _repo.CurrentBranch.Name);
|
||||||
}
|
}
|
||||||
else if (_inProgressContext is MergeInProgress merge)
|
else if (_inProgressContext is MergeInProgress merge)
|
||||||
|
|
|
@ -579,7 +579,11 @@
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
|
|
||||||
<DataTemplate DataType="vm:RevertInProgress">
|
<DataTemplate DataType="vm:RevertInProgress">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
<TextBlock FontWeight="Bold" Foreground="{DynamicResource Brush.ConflictForeground}" Text="{DynamicResource Text.InProgress.Revert}"/>
|
<TextBlock FontWeight="Bold" Foreground="{DynamicResource Brush.ConflictForeground}" Text="{DynamicResource Text.InProgress.Revert}"/>
|
||||||
|
<TextBlock FontWeight="Bold" Margin="4,0,0,0" Foreground="{DynamicResource Brush.ConflictForeground}" Text="{DynamicResource Text.InProgress.Revert.Head}"/>
|
||||||
|
<TextBlock FontWeight="Bold" Margin="4,0,0,0" Foreground="DarkOrange" Text="{Binding Head.SHA, Converter={x:Static c:StringConverters.ToShortSHA}}" ToolTip.Tip="{Binding Head}"/>
|
||||||
|
</StackPanel>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
|
|
||||||
<DataTemplate DataType="vm:MergeInProgress">
|
<DataTemplate DataType="vm:MergeInProgress">
|
||||||
|
|
Loading…
Reference in a new issue