mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-25 21:07:20 -08:00
enhance: show friendly name instead of --theirs
or --mine
while resolving conflicts
This commit is contained in:
parent
c8cdda3477
commit
feb7e96b2c
5 changed files with 45 additions and 0 deletions
|
@ -281,6 +281,7 @@
|
||||||
<x:String x:Key="Text.FileCM.DiscardMulti" xml:space="preserve">Discard {0} files...</x:String>
|
<x:String x:Key="Text.FileCM.DiscardMulti" xml:space="preserve">Discard {0} files...</x:String>
|
||||||
<x:String x:Key="Text.FileCM.DiscardSelectedLines" xml:space="preserve">Discard Changes in Selected Line(s)</x:String>
|
<x:String x:Key="Text.FileCM.DiscardSelectedLines" xml:space="preserve">Discard Changes in Selected Line(s)</x:String>
|
||||||
<x:String x:Key="Text.FileCM.OpenWithExternalMerger" xml:space="preserve">Open External Merge Tool</x:String>
|
<x:String x:Key="Text.FileCM.OpenWithExternalMerger" xml:space="preserve">Open External Merge Tool</x:String>
|
||||||
|
<x:String x:Key="Text.FileCM.ResolveUsing" xml:space="preserve">Resolve Using '{0}'</x:String>
|
||||||
<x:String x:Key="Text.FileCM.SaveAsPatch" xml:space="preserve">Save as Patch...</x:String>
|
<x:String x:Key="Text.FileCM.SaveAsPatch" xml:space="preserve">Save as Patch...</x:String>
|
||||||
<x:String x:Key="Text.FileCM.Stage" xml:space="preserve">Stage</x:String>
|
<x:String x:Key="Text.FileCM.Stage" xml:space="preserve">Stage</x:String>
|
||||||
<x:String x:Key="Text.FileCM.StageMulti" xml:space="preserve">Stage {0} files</x:String>
|
<x:String x:Key="Text.FileCM.StageMulti" xml:space="preserve">Stage {0} files</x:String>
|
||||||
|
|
|
@ -284,6 +284,7 @@
|
||||||
<x:String x:Key="Text.FileCM.DiscardMulti" xml:space="preserve">放弃 {0} 个文件的更改...</x:String>
|
<x:String x:Key="Text.FileCM.DiscardMulti" xml:space="preserve">放弃 {0} 个文件的更改...</x:String>
|
||||||
<x:String x:Key="Text.FileCM.DiscardSelectedLines" xml:space="preserve">放弃选中的更改</x:String>
|
<x:String x:Key="Text.FileCM.DiscardSelectedLines" xml:space="preserve">放弃选中的更改</x:String>
|
||||||
<x:String x:Key="Text.FileCM.OpenWithExternalMerger" xml:space="preserve">使用外部合并工具打开</x:String>
|
<x:String x:Key="Text.FileCM.OpenWithExternalMerger" xml:space="preserve">使用外部合并工具打开</x:String>
|
||||||
|
<x:String x:Key="Text.FileCM.ResolveUsing" xml:space="preserve">应用 '{0}'</x:String>
|
||||||
<x:String x:Key="Text.FileCM.SaveAsPatch" xml:space="preserve">另存为补丁...</x:String>
|
<x:String x:Key="Text.FileCM.SaveAsPatch" xml:space="preserve">另存为补丁...</x:String>
|
||||||
<x:String x:Key="Text.FileCM.Stage" xml:space="preserve">暂存(add)</x:String>
|
<x:String x:Key="Text.FileCM.Stage" xml:space="preserve">暂存(add)</x:String>
|
||||||
<x:String x:Key="Text.FileCM.StageMulti" xml:space="preserve">暂存(add){0} 个文件</x:String>
|
<x:String x:Key="Text.FileCM.StageMulti" xml:space="preserve">暂存(add){0} 个文件</x:String>
|
||||||
|
|
|
@ -284,6 +284,7 @@
|
||||||
<x:String x:Key="Text.FileCM.DiscardMulti" xml:space="preserve">捨棄已選的 {0} 個檔案變更...</x:String>
|
<x:String x:Key="Text.FileCM.DiscardMulti" xml:space="preserve">捨棄已選的 {0} 個檔案變更...</x:String>
|
||||||
<x:String x:Key="Text.FileCM.DiscardSelectedLines" xml:space="preserve">捨棄選取的變更</x:String>
|
<x:String x:Key="Text.FileCM.DiscardSelectedLines" xml:space="preserve">捨棄選取的變更</x:String>
|
||||||
<x:String x:Key="Text.FileCM.OpenWithExternalMerger" xml:space="preserve">使用外部合併工具開啟</x:String>
|
<x:String x:Key="Text.FileCM.OpenWithExternalMerger" xml:space="preserve">使用外部合併工具開啟</x:String>
|
||||||
|
<x:String x:Key="Text.FileCM.ResolveUsing" xml:space="preserve">使用 '{0}'</x:String>
|
||||||
<x:String x:Key="Text.FileCM.SaveAsPatch" xml:space="preserve">另存為修補檔 (patch)...</x:String>
|
<x:String x:Key="Text.FileCM.SaveAsPatch" xml:space="preserve">另存為修補檔 (patch)...</x:String>
|
||||||
<x:String x:Key="Text.FileCM.Stage" xml:space="preserve">暫存 (add)</x:String>
|
<x:String x:Key="Text.FileCM.Stage" xml:space="preserve">暫存 (add)</x:String>
|
||||||
<x:String x:Key="Text.FileCM.StageMulti" xml:space="preserve">暫存 (add) 已選的 {0} 個檔案</x:String>
|
<x:String x:Key="Text.FileCM.StageMulti" xml:space="preserve">暫存 (add) 已選的 {0} 個檔案</x:String>
|
||||||
|
|
|
@ -81,6 +81,12 @@ namespace SourceGit.ViewModels
|
||||||
|
|
||||||
public class RebaseInProgress : InProgressContext
|
public class RebaseInProgress : InProgressContext
|
||||||
{
|
{
|
||||||
|
public string HeadName
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
private set;
|
||||||
|
}
|
||||||
|
|
||||||
public Models.Commit StoppedAt
|
public Models.Commit StoppedAt
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
|
@ -93,6 +99,10 @@ namespace SourceGit.ViewModels
|
||||||
|
|
||||||
var stoppedSHA = File.ReadAllText(Path.Combine(repo.GitDir, "rebase-merge", "stopped-sha")).Trim();
|
var stoppedSHA = File.ReadAllText(Path.Combine(repo.GitDir, "rebase-merge", "stopped-sha")).Trim();
|
||||||
StoppedAt = new Commands.QuerySingleCommit(repo.FullPath, stoppedSHA).Result();
|
StoppedAt = new Commands.QuerySingleCommit(repo.FullPath, stoppedSHA).Result();
|
||||||
|
|
||||||
|
HeadName = File.ReadAllText(Path.Combine(repo.GitDir, "rebase-merge", "head-name")).Trim();
|
||||||
|
if (HeadName.StartsWith("refs/heads/"))
|
||||||
|
HeadName = HeadName.Substring(11);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Continue()
|
public override bool Continue()
|
||||||
|
|
|
@ -569,6 +569,22 @@ namespace SourceGit.ViewModels
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (_inProgressContext is RebaseInProgress rebase)
|
||||||
|
{
|
||||||
|
useTheirs.Header = App.Text("FileCM.ResolveUsing", rebase.HeadName);
|
||||||
|
useMine.Header = App.Text("FileCM.ResolveUsing", rebase.StoppedAt.SHA.Substring(0, 10));
|
||||||
|
}
|
||||||
|
else if (_inProgressContext is CherryPickInProgress cherryPick)
|
||||||
|
{
|
||||||
|
useTheirs.Header = App.Text("FileCM.ResolveUsing", cherryPick.Head.SHA.Substring(0, 10));
|
||||||
|
useMine.Header = App.Text("FileCM.ResolveUsing", _repo.CurrentBranch.Name);
|
||||||
|
}
|
||||||
|
else if (_inProgressContext is MergeInProgress merge)
|
||||||
|
{
|
||||||
|
useTheirs.Header = App.Text("FileCM.ResolveUsing", merge.SourceName);
|
||||||
|
useMine.Header = App.Text("FileCM.ResolveUsing", _repo.CurrentBranch.Name);
|
||||||
|
}
|
||||||
|
|
||||||
menu.Items.Add(useTheirs);
|
menu.Items.Add(useTheirs);
|
||||||
menu.Items.Add(useMine);
|
menu.Items.Add(useMine);
|
||||||
menu.Items.Add(openMerger);
|
menu.Items.Add(openMerger);
|
||||||
|
@ -892,6 +908,22 @@ namespace SourceGit.ViewModels
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (_inProgressContext is RebaseInProgress rebase)
|
||||||
|
{
|
||||||
|
useTheirs.Header = App.Text("FileCM.ResolveUsing", rebase.HeadName);
|
||||||
|
useMine.Header = App.Text("FileCM.ResolveUsing", rebase.StoppedAt.SHA.Substring(0, 10));
|
||||||
|
}
|
||||||
|
else if (_inProgressContext is CherryPickInProgress cherryPick)
|
||||||
|
{
|
||||||
|
useTheirs.Header = App.Text("FileCM.ResolveUsing", cherryPick.Head.SHA.Substring(0, 10));
|
||||||
|
useMine.Header = App.Text("FileCM.ResolveUsing", _repo.CurrentBranch.Name);
|
||||||
|
}
|
||||||
|
else if (_inProgressContext is MergeInProgress merge)
|
||||||
|
{
|
||||||
|
useTheirs.Header = App.Text("FileCM.ResolveUsing", merge.SourceName);
|
||||||
|
useMine.Header = App.Text("FileCM.ResolveUsing", _repo.CurrentBranch.Name);
|
||||||
|
}
|
||||||
|
|
||||||
menu.Items.Add(useTheirs);
|
menu.Items.Add(useTheirs);
|
||||||
menu.Items.Add(useMine);
|
menu.Items.Add(useMine);
|
||||||
return menu;
|
return menu;
|
||||||
|
|
Loading…
Reference in a new issue