mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-26 21:17:20 -08:00
Compare commits
No commits in common. "0ac1031c4c8e7178cfe94f65bdafb155e10c07c0" and "36ecbcc4e07c8c3560320acbca199ca087e57372" have entirely different histories.
0ac1031c4c
...
36ecbcc4e0
19 changed files with 190 additions and 367 deletions
|
@ -47,7 +47,7 @@
|
|||
|
||||
## Translation Status
|
||||
|
||||
[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-97.50%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-97.78%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-95.00%25-yellow)](TRANSLATION.md) [![it__IT](https://img.shields.io/badge/it__IT-95.56%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-96.81%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-97.92%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-100.00%25-brightgreen)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-100.00%25-brightgreen)](TRANSLATION.md)
|
||||
[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-97.64%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-97.91%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-95.13%25-yellow)](TRANSLATION.md) [![it__IT](https://img.shields.io/badge/it__IT-95.69%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-96.94%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-98.05%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-100.00%25-brightgreen)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-100.00%25-brightgreen)](TRANSLATION.md)
|
||||
|
||||
## How to Use
|
||||
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
### de_DE.axaml: 97.50%
|
||||
### de_DE.axaml: 97.64%
|
||||
|
||||
|
||||
<details>
|
||||
<summary>Missing Keys</summary>
|
||||
|
||||
- Text.BranchCM.MergeMultiBranches
|
||||
- Text.CommitCM.Merge
|
||||
- Text.CommitCM.MergeMultiple
|
||||
- Text.CommitDetail.Files.Search
|
||||
- Text.Diff.UseBlockNavigation
|
||||
|
@ -25,14 +24,13 @@
|
|||
|
||||
</details>
|
||||
|
||||
### es_ES.axaml: 97.78%
|
||||
### es_ES.axaml: 97.91%
|
||||
|
||||
|
||||
<details>
|
||||
<summary>Missing Keys</summary>
|
||||
|
||||
- Text.BranchCM.MergeMultiBranches
|
||||
- Text.CommitCM.Merge
|
||||
- Text.CommitCM.MergeMultiple
|
||||
- Text.Diff.UseBlockNavigation
|
||||
- Text.FileCM.ResolveUsing
|
||||
|
@ -50,7 +48,7 @@
|
|||
|
||||
</details>
|
||||
|
||||
### fr_FR.axaml: 95.00%
|
||||
### fr_FR.axaml: 95.13%
|
||||
|
||||
|
||||
<details>
|
||||
|
@ -60,7 +58,6 @@
|
|||
- Text.CherryPick.AppendSourceToMessage
|
||||
- Text.CherryPick.Mainline.Tips
|
||||
- Text.CommitCM.CherryPickMultiple
|
||||
- Text.CommitCM.Merge
|
||||
- Text.CommitCM.MergeMultiple
|
||||
- Text.CommitDetail.Files.Search
|
||||
- Text.Diff.UseBlockNavigation
|
||||
|
@ -95,14 +92,13 @@
|
|||
|
||||
</details>
|
||||
|
||||
### it_IT.axaml: 95.56%
|
||||
### it_IT.axaml: 95.69%
|
||||
|
||||
|
||||
<details>
|
||||
<summary>Missing Keys</summary>
|
||||
|
||||
- Text.BranchCM.MergeMultiBranches
|
||||
- Text.CommitCM.Merge
|
||||
- Text.CommitCM.MergeMultiple
|
||||
- Text.CommitDetail.Files.Search
|
||||
- Text.CommitDetail.Info.Children
|
||||
|
@ -136,14 +132,13 @@
|
|||
|
||||
</details>
|
||||
|
||||
### pt_BR.axaml: 96.81%
|
||||
### pt_BR.axaml: 96.94%
|
||||
|
||||
|
||||
<details>
|
||||
<summary>Missing Keys</summary>
|
||||
|
||||
- Text.BranchCM.MergeMultiBranches
|
||||
- Text.CommitCM.Merge
|
||||
- Text.CommitCM.MergeMultiple
|
||||
- Text.CommitDetail.Files.Search
|
||||
- Text.CommitDetail.Info.Children
|
||||
|
@ -168,14 +163,13 @@
|
|||
|
||||
</details>
|
||||
|
||||
### ru_RU.axaml: 97.92%
|
||||
### ru_RU.axaml: 98.05%
|
||||
|
||||
|
||||
<details>
|
||||
<summary>Missing Keys</summary>
|
||||
|
||||
- Text.BranchCM.MergeMultiBranches
|
||||
- Text.CommitCM.Merge
|
||||
- Text.CommitCM.MergeMultiple
|
||||
- Text.FileCM.ResolveUsing
|
||||
- Text.Hotkeys.Global.Clone
|
||||
|
|
|
@ -111,7 +111,6 @@
|
|||
<x:String x:Key="Text.CommitCM.CopySHA" xml:space="preserve">Copy SHA</x:String>
|
||||
<x:String x:Key="Text.CommitCM.CustomAction" xml:space="preserve">Custom Action</x:String>
|
||||
<x:String x:Key="Text.CommitCM.InteractiveRebase" xml:space="preserve">Interactive Rebase ${0}$ to Here</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>
|
||||
<x:String x:Key="Text.CommitCM.Rebase" xml:space="preserve">Rebase ${0}$ to Here</x:String>
|
||||
<x:String x:Key="Text.CommitCM.Reset" xml:space="preserve">Reset ${0}$ to Here</x:String>
|
||||
|
|
|
@ -114,7 +114,6 @@
|
|||
<x:String x:Key="Text.CommitCM.CopySHA" xml:space="preserve">复制提交指纹</x:String>
|
||||
<x:String x:Key="Text.CommitCM.CustomAction" xml:space="preserve">自定义操作</x:String>
|
||||
<x:String x:Key="Text.CommitCM.InteractiveRebase" xml:space="preserve">交互式变基(rebase -i) ${0}$ 到此处</x:String>
|
||||
<x:String x:Key="Text.CommitCM.Merge" xml:space="preserve">合并(merge)此提交至 ${0}$</x:String>
|
||||
<x:String x:Key="Text.CommitCM.MergeMultiple" xml:space="preserve">合并(merge)...</x:String>
|
||||
<x:String x:Key="Text.CommitCM.Rebase" xml:space="preserve">变基(rebase) ${0}$ 到此处</x:String>
|
||||
<x:String x:Key="Text.CommitCM.Reset" xml:space="preserve">重置(reset) ${0}$ 到此处</x:String>
|
||||
|
|
|
@ -114,7 +114,6 @@
|
|||
<x:String x:Key="Text.CommitCM.CopySHA" xml:space="preserve">複製提交編號</x:String>
|
||||
<x:String x:Key="Text.CommitCM.CustomAction" xml:space="preserve">自訂動作</x:String>
|
||||
<x:String x:Key="Text.CommitCM.InteractiveRebase" xml:space="preserve">互動式重定基底 (rebase -i) ${0}$ 到此處</x:String>
|
||||
<x:String x:Key="Text.CommitCM.Merge" xml:space="preserve">合併 (merge) 此提交到 ${0}$</x:String>
|
||||
<x:String x:Key="Text.CommitCM.MergeMultiple" xml:space="preserve">合併 (merge)...</x:String>
|
||||
<x:String x:Key="Text.CommitCM.Rebase" xml:space="preserve">重定基底 (rebase) ${0}$ 到此處</x:String>
|
||||
<x:String x:Key="Text.CommitCM.Reset" xml:space="preserve">重設 (reset) ${0}$ 到此處</x:String>
|
||||
|
|
|
@ -72,9 +72,10 @@ namespace SourceGit.ViewModels
|
|||
|
||||
return Task.Run(() =>
|
||||
{
|
||||
var succ = false;
|
||||
if (IsMergeCommit)
|
||||
{
|
||||
new Commands.CherryPick(
|
||||
succ = new Commands.CherryPick(
|
||||
_repo.FullPath,
|
||||
Targets[0].SHA,
|
||||
!AutoCommit,
|
||||
|
@ -83,7 +84,7 @@ namespace SourceGit.ViewModels
|
|||
}
|
||||
else
|
||||
{
|
||||
new Commands.CherryPick(
|
||||
succ = new Commands.CherryPick(
|
||||
_repo.FullPath,
|
||||
string.Join(' ', Targets.ConvertAll(c => c.SHA)),
|
||||
!AutoCommit,
|
||||
|
@ -92,7 +93,7 @@ namespace SourceGit.ViewModels
|
|||
}
|
||||
|
||||
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
||||
return true;
|
||||
return succ;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -1,78 +0,0 @@
|
|||
namespace SourceGit.ViewModels
|
||||
{
|
||||
public class Conflict
|
||||
{
|
||||
public object Theirs
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public object Mine
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public bool IsResolved
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public Conflict(Repository repo, WorkingCopy wc, Models.Change change)
|
||||
{
|
||||
_wc = wc;
|
||||
_change = change;
|
||||
|
||||
IsResolved = new Commands.IsConflictResolved(repo.FullPath, change).ReadToEnd().IsSuccess;
|
||||
|
||||
var context = wc.InProgressContext;
|
||||
if (context is CherryPickInProgress cherryPick)
|
||||
{
|
||||
Theirs = cherryPick.Head;
|
||||
Mine = repo.CurrentBranch;
|
||||
}
|
||||
else if (context is RebaseInProgress rebase)
|
||||
{
|
||||
Theirs = repo.Branches.Find(x => x.IsLocal && x.Name == rebase.HeadName) ??
|
||||
new Models.Branch()
|
||||
{
|
||||
IsLocal = true,
|
||||
Name = rebase.HeadName,
|
||||
FullName = $"refs/heads/{rebase.HeadName}"
|
||||
};
|
||||
|
||||
Mine = rebase.Onto;
|
||||
}
|
||||
else if (context is RevertInProgress revert)
|
||||
{
|
||||
Theirs = revert.Head;
|
||||
Mine = repo.CurrentBranch;
|
||||
}
|
||||
else if (context is MergeInProgress merge)
|
||||
{
|
||||
Theirs = merge.Source;
|
||||
Mine = repo.CurrentBranch;
|
||||
}
|
||||
}
|
||||
|
||||
public void UseTheirs()
|
||||
{
|
||||
_wc.UseTheirs([_change]);
|
||||
}
|
||||
|
||||
public void UseMine()
|
||||
{
|
||||
_wc.UseMine([_change]);
|
||||
}
|
||||
|
||||
public void OpenExternalMergeTool()
|
||||
{
|
||||
_wc.UseExternalMergeTool(_change);
|
||||
}
|
||||
|
||||
private WorkingCopy _wc = null;
|
||||
private Models.Change _change = null;
|
||||
}
|
||||
}
|
|
@ -513,21 +513,6 @@ namespace SourceGit.ViewModels
|
|||
e.Handled = true;
|
||||
};
|
||||
menu.Items.Add(cherryPick);
|
||||
|
||||
if (!commit.HasDecorators)
|
||||
{
|
||||
var merge = new MenuItem();
|
||||
merge.Header = new Views.NameHighlightedTextBlock("CommitCM.Merge", current.Name);
|
||||
merge.Icon = App.CreateMenuIcon("Icons.Merge");
|
||||
merge.Click += (_, e) =>
|
||||
{
|
||||
if (PopupHost.CanCreatePopup())
|
||||
PopupHost.ShowPopup(new Merge(_repo, commit, current.Name));
|
||||
|
||||
e.Handled = true;
|
||||
};
|
||||
menu.Items.Add(merge);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -4,29 +4,51 @@ namespace SourceGit.ViewModels
|
|||
{
|
||||
public abstract class InProgressContext
|
||||
{
|
||||
public InProgressContext(string repo, string cmd)
|
||||
public string Repository
|
||||
{
|
||||
_repo = repo;
|
||||
_cmd = cmd;
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public string Cmd
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public bool CanSkip
|
||||
{
|
||||
get;
|
||||
protected set;
|
||||
}
|
||||
|
||||
public InProgressContext(string repo, string cmd, bool canSkip)
|
||||
{
|
||||
Repository = repo;
|
||||
Cmd = cmd;
|
||||
CanSkip = canSkip;
|
||||
}
|
||||
|
||||
public bool Abort()
|
||||
{
|
||||
return new Commands.Command()
|
||||
{
|
||||
WorkingDirectory = _repo,
|
||||
Context = _repo,
|
||||
Args = $"{_cmd} --abort",
|
||||
WorkingDirectory = Repository,
|
||||
Context = Repository,
|
||||
Args = $"{Cmd} --abort",
|
||||
}.Exec();
|
||||
}
|
||||
|
||||
public virtual bool Skip()
|
||||
public bool Skip()
|
||||
{
|
||||
if (!CanSkip)
|
||||
return true;
|
||||
|
||||
return new Commands.Command()
|
||||
{
|
||||
WorkingDirectory = _repo,
|
||||
Context = _repo,
|
||||
Args = $"{_cmd} --skip",
|
||||
WorkingDirectory = Repository,
|
||||
Context = Repository,
|
||||
Args = $"{Cmd} --skip",
|
||||
}.Exec();
|
||||
}
|
||||
|
||||
|
@ -34,10 +56,10 @@ namespace SourceGit.ViewModels
|
|||
{
|
||||
return new Commands.Command()
|
||||
{
|
||||
WorkingDirectory = _repo,
|
||||
Context = _repo,
|
||||
WorkingDirectory = Repository,
|
||||
Context = Repository,
|
||||
Editor = Commands.Command.EditorType.None,
|
||||
Args = $"{_cmd} --continue",
|
||||
Args = $"{Cmd} --continue",
|
||||
}.Exec();
|
||||
}
|
||||
|
||||
|
@ -53,9 +75,6 @@ namespace SourceGit.ViewModels
|
|||
|
||||
return commit.SHA.Substring(0, 10);
|
||||
}
|
||||
|
||||
protected string _repo = string.Empty;
|
||||
protected string _cmd = string.Empty;
|
||||
}
|
||||
|
||||
public class CherryPickInProgress : InProgressContext
|
||||
|
@ -71,7 +90,7 @@ namespace SourceGit.ViewModels
|
|||
get => GetFriendlyNameOfCommit(Head);
|
||||
}
|
||||
|
||||
public CherryPickInProgress(Repository repo) : base(repo.FullPath, "cherry-pick")
|
||||
public CherryPickInProgress(Repository repo) : base(repo.FullPath, "cherry-pick", true)
|
||||
{
|
||||
var headSHA = File.ReadAllText(Path.Combine(repo.GitDir, "CHERRY_PICK_HEAD")).Trim();
|
||||
Head = new Commands.QuerySingleCommit(repo.FullPath, headSHA).Result() ?? new Models.Commit() { SHA = headSHA };
|
||||
|
@ -103,7 +122,7 @@ namespace SourceGit.ViewModels
|
|||
private set;
|
||||
}
|
||||
|
||||
public RebaseInProgress(Repository repo) : base(repo.FullPath, "rebase")
|
||||
public RebaseInProgress(Repository repo) : base(repo.FullPath, "rebase", true)
|
||||
{
|
||||
_gitDir = repo.GitDir;
|
||||
|
||||
|
@ -122,8 +141,8 @@ namespace SourceGit.ViewModels
|
|||
{
|
||||
var succ = new Commands.Command()
|
||||
{
|
||||
WorkingDirectory = _repo,
|
||||
Context = _repo,
|
||||
WorkingDirectory = Repository,
|
||||
Context = Repository,
|
||||
Editor = Commands.Command.EditorType.RebaseEditor,
|
||||
Args = $"rebase --continue",
|
||||
}.Exec();
|
||||
|
@ -158,7 +177,7 @@ namespace SourceGit.ViewModels
|
|||
private set;
|
||||
}
|
||||
|
||||
public RevertInProgress(Repository repo) : base(repo.FullPath, "revert")
|
||||
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 };
|
||||
|
@ -184,17 +203,12 @@ namespace SourceGit.ViewModels
|
|||
get => GetFriendlyNameOfCommit(Source);
|
||||
}
|
||||
|
||||
public MergeInProgress(Repository repo) : base(repo.FullPath, "merge")
|
||||
public MergeInProgress(Repository repo) : base(repo.FullPath, "merge", false)
|
||||
{
|
||||
Current = Commands.Branch.ShowCurrent(repo.FullPath);
|
||||
|
||||
var sourceSHA = File.ReadAllText(Path.Combine(repo.GitDir, "MERGE_HEAD")).Trim();
|
||||
Source = new Commands.QuerySingleCommit(repo.FullPath, sourceSHA).Result() ?? new Models.Commit() { SHA = sourceSHA };
|
||||
}
|
||||
|
||||
public override bool Skip()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,17 +32,6 @@ namespace SourceGit.ViewModels
|
|||
View = new Views.Merge() { DataContext = this };
|
||||
}
|
||||
|
||||
public Merge(Repository repo, Models.Commit source, string into)
|
||||
{
|
||||
_repo = repo;
|
||||
_sourceName = source.SHA;
|
||||
|
||||
Source = source;
|
||||
Into = into;
|
||||
SelectedMode = AutoSelectMergeMode();
|
||||
View = new Views.Merge() { DataContext = this };
|
||||
}
|
||||
|
||||
public Merge(Repository repo, Models.Tag source, string into)
|
||||
{
|
||||
_repo = repo;
|
||||
|
|
|
@ -764,11 +764,6 @@ namespace SourceGit.ViewModels
|
|||
_workingCopy?.StashAll(autoStart);
|
||||
}
|
||||
|
||||
public void SkipMerge()
|
||||
{
|
||||
_workingCopy?.SkipMerge();
|
||||
}
|
||||
|
||||
public void AbortMerge()
|
||||
{
|
||||
_workingCopy?.AbortMerge();
|
||||
|
|
|
@ -31,9 +31,9 @@ namespace SourceGit.ViewModels
|
|||
|
||||
return Task.Run(() =>
|
||||
{
|
||||
new Commands.Revert(_repo.FullPath, Target.SHA, AutoCommit).Exec();
|
||||
var succ = new Commands.Revert(_repo.FullPath, Target.SHA, AutoCommit).Exec();
|
||||
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
||||
return true;
|
||||
return succ;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,26 @@ using CommunityToolkit.Mvvm.ComponentModel;
|
|||
|
||||
namespace SourceGit.ViewModels
|
||||
{
|
||||
public class ConflictContext : ObservableObject
|
||||
{
|
||||
public bool IsResolved
|
||||
{
|
||||
get => _isResolved;
|
||||
set => SetProperty(ref _isResolved, value);
|
||||
}
|
||||
|
||||
public ConflictContext(string repo, Models.Change change)
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
var result = new Commands.IsConflictResolved(repo, change).ReadToEnd().IsSuccess;
|
||||
Dispatcher.UIThread.Post(() => IsResolved = result);
|
||||
});
|
||||
}
|
||||
|
||||
private bool _isResolved = false;
|
||||
}
|
||||
|
||||
public class WorkingCopy : ObservableObject
|
||||
{
|
||||
public bool IncludeUntracked
|
||||
|
@ -29,7 +49,11 @@ namespace SourceGit.ViewModels
|
|||
public bool CanCommitWithPush
|
||||
{
|
||||
get => _canCommitWithPush;
|
||||
set => SetProperty(ref _canCommitWithPush, value);
|
||||
set
|
||||
{
|
||||
if (SetProperty(ref _canCommitWithPush, value))
|
||||
OnPropertyChanged(nameof(IsCommitWithPushVisible));
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasUnsolvedConflicts
|
||||
|
@ -85,10 +109,16 @@ namespace SourceGit.ViewModels
|
|||
|
||||
Staged = GetStagedChanges();
|
||||
SelectedStaged = [];
|
||||
OnPropertyChanged(nameof(IsCommitWithPushVisible));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsCommitWithPushVisible
|
||||
{
|
||||
get => !UseAmend && CanCommitWithPush;
|
||||
}
|
||||
|
||||
public List<Models.Change> Unstaged
|
||||
{
|
||||
get => _unstaged;
|
||||
|
@ -410,54 +440,6 @@ namespace SourceGit.ViewModels
|
|||
}
|
||||
}
|
||||
|
||||
public async void UseTheirs(List<Models.Change> changes)
|
||||
{
|
||||
var files = new List<string>();
|
||||
foreach (var change in changes)
|
||||
{
|
||||
if (change.IsConflit)
|
||||
files.Add(change.Path);
|
||||
}
|
||||
|
||||
_repo.SetWatcherEnabled(false);
|
||||
var succ = await Task.Run(() => new Commands.Checkout(_repo.FullPath).UseTheirs(files));
|
||||
if (succ)
|
||||
{
|
||||
await Task.Run(() => new Commands.Add(_repo.FullPath, changes).Exec());
|
||||
}
|
||||
_repo.MarkWorkingCopyDirtyManually();
|
||||
_repo.SetWatcherEnabled(true);
|
||||
}
|
||||
|
||||
public async void UseMine(List<Models.Change> changes)
|
||||
{
|
||||
var files = new List<string>();
|
||||
foreach (var change in changes)
|
||||
{
|
||||
if (change.IsConflit)
|
||||
files.Add(change.Path);
|
||||
}
|
||||
|
||||
_repo.SetWatcherEnabled(false);
|
||||
var succ = await Task.Run(() => new Commands.Checkout(_repo.FullPath).UseMine(files));
|
||||
if (succ)
|
||||
{
|
||||
await Task.Run(() => new Commands.Add(_repo.FullPath, changes).Exec());
|
||||
}
|
||||
_repo.MarkWorkingCopyDirtyManually();
|
||||
_repo.SetWatcherEnabled(true);
|
||||
}
|
||||
|
||||
public async void UseExternalMergeTool(Models.Change change)
|
||||
{
|
||||
var toolType = Preference.Instance.ExternalMergeToolType;
|
||||
var toolPath = Preference.Instance.ExternalMergeToolPath;
|
||||
|
||||
_repo.SetWatcherEnabled(false);
|
||||
await Task.Run(() => Commands.MergeTool.OpenForMerge(_repo.FullPath, toolType, toolPath, change.Path));
|
||||
_repo.SetWatcherEnabled(true);
|
||||
}
|
||||
|
||||
public void ContinueMerge()
|
||||
{
|
||||
if (_inProgressContext != null)
|
||||
|
@ -481,29 +463,6 @@ namespace SourceGit.ViewModels
|
|||
}
|
||||
}
|
||||
|
||||
public void SkipMerge()
|
||||
{
|
||||
if (_inProgressContext != null)
|
||||
{
|
||||
_repo.SetWatcherEnabled(false);
|
||||
Task.Run(() =>
|
||||
{
|
||||
var succ = _inProgressContext.Skip();
|
||||
Dispatcher.UIThread.Invoke(() =>
|
||||
{
|
||||
if (succ)
|
||||
CommitMessage = string.Empty;
|
||||
|
||||
_repo.SetWatcherEnabled(true);
|
||||
});
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
_repo.MarkWorkingCopyDirtyManually();
|
||||
}
|
||||
}
|
||||
|
||||
public void AbortMerge()
|
||||
{
|
||||
if (_inProgressContext != null)
|
||||
|
@ -1479,11 +1438,59 @@ namespace SourceGit.ViewModels
|
|||
if (change == null)
|
||||
DetailContext = null;
|
||||
else if (change.IsConflit && isUnstaged)
|
||||
DetailContext = new Conflict(_repo, this, change);
|
||||
DetailContext = new ConflictContext(_repo.FullPath, change);
|
||||
else
|
||||
DetailContext = new DiffContext(_repo.FullPath, new Models.DiffOption(change, isUnstaged), _detailContext as DiffContext);
|
||||
}
|
||||
|
||||
private async void UseTheirs(List<Models.Change> changes)
|
||||
{
|
||||
var files = new List<string>();
|
||||
foreach (var change in changes)
|
||||
{
|
||||
if (change.IsConflit)
|
||||
files.Add(change.Path);
|
||||
}
|
||||
|
||||
_repo.SetWatcherEnabled(false);
|
||||
var succ = await Task.Run(() => new Commands.Checkout(_repo.FullPath).UseTheirs(files));
|
||||
if (succ)
|
||||
{
|
||||
await Task.Run(() => new Commands.Add(_repo.FullPath, changes).Exec());
|
||||
}
|
||||
_repo.MarkWorkingCopyDirtyManually();
|
||||
_repo.SetWatcherEnabled(true);
|
||||
}
|
||||
|
||||
private async void UseMine(List<Models.Change> changes)
|
||||
{
|
||||
var files = new List<string>();
|
||||
foreach (var change in changes)
|
||||
{
|
||||
if (change.IsConflit)
|
||||
files.Add(change.Path);
|
||||
}
|
||||
|
||||
_repo.SetWatcherEnabled(false);
|
||||
var succ = await Task.Run(() => new Commands.Checkout(_repo.FullPath).UseMine(files));
|
||||
if (succ)
|
||||
{
|
||||
await Task.Run(() => new Commands.Add(_repo.FullPath, changes).Exec());
|
||||
}
|
||||
_repo.MarkWorkingCopyDirtyManually();
|
||||
_repo.SetWatcherEnabled(true);
|
||||
}
|
||||
|
||||
private async void UseExternalMergeTool(Models.Change change)
|
||||
{
|
||||
var toolType = Preference.Instance.ExternalMergeToolType;
|
||||
var toolPath = Preference.Instance.ExternalMergeToolPath;
|
||||
|
||||
_repo.SetWatcherEnabled(false);
|
||||
await Task.Run(() => Commands.MergeTool.OpenForMerge(_repo.FullPath, toolType, toolPath, change.Path));
|
||||
_repo.SetWatcherEnabled(true);
|
||||
}
|
||||
|
||||
private void DoCommit(bool autoStage, bool autoPush, bool allowEmpty)
|
||||
{
|
||||
if (!PopupHost.CanCreatePopup())
|
||||
|
|
|
@ -77,7 +77,7 @@
|
|||
HorizontalAlignment="Right"
|
||||
IsVisible="{Binding InProgress, Converter={x:Static BoolConverters.Not}}">
|
||||
<Button Classes="flat primary"
|
||||
Width="100" Height="28"
|
||||
Width="80" Height="28"
|
||||
Padding="0"
|
||||
HorizontalContentAlignment="Center"
|
||||
VerticalContentAlignment="Center"
|
||||
|
@ -85,7 +85,7 @@
|
|||
Click="OnPopupSure"
|
||||
HotKey="Enter"/>
|
||||
<Button Classes="flat"
|
||||
Width="100" Height="28"
|
||||
Width="80" Height="28"
|
||||
Margin="8,0,0,0"
|
||||
Padding="0"
|
||||
HorizontalContentAlignment="Center"
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:m="using:SourceGit.Models"
|
||||
xmlns:vm="using:SourceGit.ViewModels"
|
||||
xmlns:c="using:SourceGit.Converters"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="SourceGit.Views.Merge"
|
||||
x:DataType="vm:Merge">
|
||||
|
@ -12,7 +11,7 @@
|
|||
<TextBlock FontSize="18"
|
||||
Classes="bold"
|
||||
Text="{DynamicResource Text.Merge}"/>
|
||||
<Grid Margin="0,16,0,0" RowDefinitions="32,32,32" ColumnDefinitions="130,*">
|
||||
<Grid Margin="0,16,0,0" RowDefinitions="32,32,32" ColumnDefinitions="150,*">
|
||||
<TextBlock Grid.Row="0" Grid.Column="0"
|
||||
HorizontalAlignment="Right" VerticalAlignment="Center"
|
||||
Margin="0,0,8,0"
|
||||
|
@ -26,14 +25,6 @@
|
|||
</StackPanel>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate DataType="m:Commit">
|
||||
<Grid ColumnDefinitions="Auto,Auto,*">
|
||||
<Path Grid.Column="0" Width="14" Height="14" Margin="0,8,0,0" Data="{StaticResource Icons.Commit}"/>
|
||||
<TextBlock Grid.Column="1" Classes="primary" VerticalAlignment="Center" Text="{Binding SHA, Converter={x:Static c:StringConverters.ToShortSHA}}" Foreground="DarkOrange" Margin="8,0,0,0"/>
|
||||
<TextBlock Grid.Column="2" VerticalAlignment="Center" Text="{Binding Subject}" Margin="4,0,0,0" TextTrimming="CharacterEllipsis"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate DataType="m:Tag">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Path Width="14" Height="14" Data="{StaticResource Icons.Tag}"/>
|
||||
|
|
|
@ -547,7 +547,7 @@
|
|||
|
||||
<!-- Right -->
|
||||
<Grid Grid.Column="2" RowDefinitions="Auto,Auto,*">
|
||||
<Grid Grid.Row="0" Height="28" ColumnDefinitions="*,Auto" Background="{DynamicResource Brush.Conflict}" IsVisible="{Binding InProgressContext, Converter={x:Static ObjectConverters.IsNotNull}}">
|
||||
<Grid Grid.Row="0" Height="28" ColumnDefinitions="*,Auto,Auto" Background="{DynamicResource Brush.Conflict}" IsVisible="{Binding InProgressContext, Converter={x:Static ObjectConverters.IsNotNull}}">
|
||||
<ContentControl Grid.Column="0" Margin="8,0" Content="{Binding InProgressContext}">
|
||||
<ContentControl.DataTemplates>
|
||||
<DataTemplate DataType="m:Commit">
|
||||
|
@ -563,39 +563,27 @@
|
|||
</DataTemplate>
|
||||
|
||||
<DataTemplate DataType="vm:CherryPickInProgress">
|
||||
<Grid ColumnDefinitions="*,Auto">
|
||||
<StackPanel Grid.Column="0" Orientation="Horizontal">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock FontWeight="Bold" Foreground="{DynamicResource Brush.ConflictForeground}" Text="{DynamicResource Text.InProgress.CherryPick}"/>
|
||||
<TextBlock FontWeight="Bold" Margin="4,0,0,0" Foreground="{DynamicResource Brush.ConflictForeground}" Text="{DynamicResource Text.InProgress.CherryPick.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>
|
||||
|
||||
<Button Grid.Column="1" Classes="flat" FontWeight="Regular" BorderThickness="0" Content="{DynamicResource Text.Repository.Skip}" Padding="8,2" Click="OnSkipInProgress"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate DataType="vm:RebaseInProgress">
|
||||
<Grid ColumnDefinitions="*,Auto">
|
||||
<StackPanel Grid.Column="0" Orientation="Horizontal">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock FontWeight="Bold" Foreground="{DynamicResource Brush.ConflictForeground}" Text="{DynamicResource Text.InProgress.Rebase}"/>
|
||||
<TextBlock FontWeight="Bold" Margin="4,0,0,0" Foreground="{DynamicResource Brush.ConflictForeground}" Text="{DynamicResource Text.InProgress.Rebase.StoppedAt}"/>
|
||||
<TextBlock FontWeight="Bold" Margin="4,0,0,0" Foreground="DarkOrange" Text="{Binding StoppedAt.SHA, Converter={x:Static c:StringConverters.ToShortSHA}}" ToolTip.Tip="{Binding StoppedAt}"/>
|
||||
</StackPanel>
|
||||
|
||||
<Button Grid.Column="1" Classes="flat" FontWeight="Regular" BorderThickness="0" Content="{DynamicResource Text.Repository.Skip}" Padding="8,2" Click="OnSkipInProgress"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate DataType="vm:RevertInProgress">
|
||||
<Grid ColumnDefinitions="*,Auto">
|
||||
<StackPanel Grid.Column="0" Orientation="Horizontal">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<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>
|
||||
|
||||
<Button Grid.Column="1" Classes="flat" FontWeight="Regular" BorderThickness="0" Content="{DynamicResource Text.Repository.Skip}" Padding="8,2" Click="OnSkipInProgress"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate DataType="vm:MergeInProgress">
|
||||
|
@ -610,12 +598,30 @@
|
|||
</ContentControl.DataTemplates>
|
||||
</ContentControl>
|
||||
|
||||
<Button Grid.Column="1"
|
||||
<ContentControl Grid.Column="1" Margin="4,0" Content="{Binding InProgressContext}">
|
||||
<ContentControl.DataTemplates>
|
||||
<DataTemplate DataType="vm:CherryPickInProgress">
|
||||
<Button Classes="flat" FontWeight="Regular" BorderThickness="0" Content="{DynamicResource Text.Repository.Skip}" Padding="8,2" Command="{Binding Skip}"/>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate DataType="vm:RebaseInProgress">
|
||||
<Button Classes="flat" FontWeight="Regular" BorderThickness="0" Content="{DynamicResource Text.Repository.Skip}" Padding="8,2" Command="{Binding Skip}"/>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate DataType="vm:RevertInProgress">
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate DataType="vm:MergeInProgress">
|
||||
</DataTemplate>
|
||||
</ContentControl.DataTemplates>
|
||||
</ContentControl>
|
||||
|
||||
<Button Grid.Column="2"
|
||||
Classes="flat"
|
||||
FontWeight="Regular"
|
||||
BorderThickness="0"
|
||||
Content="{DynamicResource Text.Repository.Abort}"
|
||||
Padding="8,2" Margin="0,0,8,0"
|
||||
Padding="8,2" Margin="4,0"
|
||||
Command="{Binding AbortMerge}"/>
|
||||
</Grid>
|
||||
|
||||
|
|
|
@ -428,13 +428,5 @@ namespace SourceGit.Views
|
|||
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
private void OnSkipInProgress(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (DataContext is ViewModels.Repository repo)
|
||||
repo.SkipMerge();
|
||||
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -719,22 +719,19 @@ namespace SourceGit.Views
|
|||
else if (change.Property == BlockNavigationProperty)
|
||||
{
|
||||
var oldValue = change.OldValue as ViewModels.BlockNavigation;
|
||||
if (oldValue != null)
|
||||
{
|
||||
oldValue.PropertyChanged -= OnBlockNavigationPropertyChanged;
|
||||
if (oldValue.Current != -1)
|
||||
TextArea?.TextView?.Redraw();
|
||||
}
|
||||
|
||||
var newValue = change.NewValue as ViewModels.BlockNavigation;
|
||||
if (oldValue != null)
|
||||
oldValue.PropertyChanged -= OnBlockNavigationPropertyChanged;
|
||||
if (newValue != null)
|
||||
newValue.PropertyChanged += OnBlockNavigationPropertyChanged;
|
||||
|
||||
InvalidateVisual();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnBlockNavigationPropertyChanged(object _1, PropertyChangedEventArgs _2)
|
||||
{
|
||||
TextArea?.TextView?.Redraw();
|
||||
TextArea.TextView.Redraw();
|
||||
}
|
||||
|
||||
private void OnTextViewContextRequested(object sender, ContextRequestedEventArgs e)
|
||||
|
@ -1579,7 +1576,7 @@ namespace SourceGit.Views
|
|||
|
||||
UseBlockNavigationProperty.Changed.AddClassHandler<TextDiffView>((v, _) =>
|
||||
{
|
||||
v.RefreshBlockNavigation();
|
||||
v.RefreshContent(v.DataContext as Models.TextDiff, false);
|
||||
});
|
||||
|
||||
SelectedChunkProperty.Changed.AddClassHandler<TextDiffView>((v, _) =>
|
||||
|
@ -1667,14 +1664,6 @@ namespace SourceGit.Views
|
|||
Editor.Content = diff;
|
||||
}
|
||||
|
||||
RefreshBlockNavigation();
|
||||
|
||||
IsUnstagedChange = diff.Option.IsUnstaged;
|
||||
EnableChunkSelection = diff.Option.WorkingCopyChange != null;
|
||||
}
|
||||
|
||||
private void RefreshBlockNavigation()
|
||||
{
|
||||
if (UseBlockNavigation)
|
||||
{
|
||||
BlockNavigation = new ViewModels.BlockNavigation(Editor.Content);
|
||||
|
@ -1685,6 +1674,9 @@ namespace SourceGit.Views
|
|||
BlockNavigation = null;
|
||||
BlockNavigationIndicator = "-/-";
|
||||
}
|
||||
|
||||
IsUnstagedChange = diff.Option.IsUnstaged;
|
||||
EnableChunkSelection = diff.Option.WorkingCopyChange != null;
|
||||
}
|
||||
|
||||
private void OnStageChunk(object _1, RoutedEventArgs _2)
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:m="using:SourceGit.Models"
|
||||
xmlns:vm="using:SourceGit.ViewModels"
|
||||
xmlns:v="using:SourceGit.Views"
|
||||
xmlns:c="using:SourceGit.Converters"
|
||||
|
@ -170,67 +169,13 @@
|
|||
|
||||
<ContentControl Content="{Binding DetailContext}">
|
||||
<ContentControl.DataTemplates>
|
||||
<DataTemplate DataType="vm:Conflict">
|
||||
<DataTemplate DataType="vm:ConflictContext">
|
||||
<Border Background="{DynamicResource Brush.Window}" BorderThickness="1" BorderBrush="{DynamicResource Brush.Border2}">
|
||||
<Grid VerticalAlignment="Center">
|
||||
<Grid HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||
<StackPanel Orientation="Vertical" IsVisible="{Binding !IsResolved}">
|
||||
<StackPanel.DataTemplates>
|
||||
<DataTemplate DataType="m:Branch">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Path Width="12" Height="12" Data="{StaticResource Icons.Branch}"/>
|
||||
<TextBlock Margin="4,0,0,0" Text="{Binding FriendlyName}"/>
|
||||
<TextBlock Margin="4,0,0,0" Text="{Binding Head, Converter={x:Static c:StringConverters.ToShortSHA}}" Foreground="DarkOrange"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate DataType="m:Commit">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Path Width="12" Height="12" Margin="0,6,0,0" Data="{StaticResource Icons.Commit}"/>
|
||||
<v:CommitRefsPresenter Margin="8,0,0,0"
|
||||
TagBackground="{DynamicResource Brush.DecoratorTag}"
|
||||
Foreground="{DynamicResource Brush.FG1}"
|
||||
FontFamily="{DynamicResource Fonts.Primary}"
|
||||
FontSize="11"
|
||||
VerticalAlignment="Center"
|
||||
UseGraphColor="False"/>
|
||||
<TextBlock Margin="4,0,0,0" Text="{Binding SHA, Converter={x:Static c:StringConverters.ToShortSHA}}" Foreground="DarkOrange"/>
|
||||
<TextBlock Margin="4,0,0,0" Text="{Binding Subject}"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate DataType="m:Tag">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Path Width="12" Height="12" Data="{StaticResource Icons.Tag}"/>
|
||||
<TextBlock Margin="4,0,0,0" Text="{Binding Name}"/>
|
||||
<TextBlock Margin="4,0,0,0" Text="{Binding SHA, Converter={x:Static c:StringConverters.ToShortSHA}}" Foreground="DarkOrange"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</StackPanel.DataTemplates>
|
||||
|
||||
<Path Width="64" Height="64" Data="{StaticResource Icons.Conflict}" Fill="{DynamicResource Brush.FG2}" HorizontalAlignment="Center"/>
|
||||
<TextBlock Margin="0,16" FontSize="20" FontWeight="Bold" Text="{DynamicResource Text.WorkingCopy.Conflicts}" Foreground="{DynamicResource Brush.FG2}" HorizontalAlignment="Center"/>
|
||||
|
||||
<Border Margin="16,0" Padding="8" CornerRadius="4" BorderThickness="1" BorderBrush="{DynamicResource Brush.Border2}">
|
||||
<Border.IsVisible>
|
||||
<MultiBinding Converter="{x:Static BoolConverters.And}">
|
||||
<Binding Path="Theirs" Converter="{x:Static ObjectConverters.IsNotNull}"/>
|
||||
<Binding Path="Mine" Converter="{x:Static ObjectConverters.IsNotNull}"/>
|
||||
</MultiBinding>
|
||||
</Border.IsVisible>
|
||||
|
||||
<Grid Margin="8,0,0,0" RowDefinitions="32,32" ColumnDefinitions="Auto,*">
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Classes="info_label" Text="THEIRS"/>
|
||||
<ContentControl Grid.Row="0" Grid.Column="1" Margin="16,0,0,0" Content="{Binding Theirs}"/>
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" Classes="info_label" Text="MINE"/>
|
||||
<ContentControl Grid.Row="1" Grid.Column="1" Margin="16,0,0,0" Content="{Binding Mine}"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<StackPanel Margin="0,8,0,0" Orientation="Horizontal" HorizontalAlignment="Center">
|
||||
<Button Classes="flat" Content="USE THEIRS" Command="{Binding UseTheirs}"/>
|
||||
<Button Classes="flat" Margin="8,0,0,0" Content="USE MINE" Command="{Binding UseMine}"/>
|
||||
<Button Classes="flat" Margin="8,0,0,0" Content="OPEN EXTERNAL MERGETOOL" Command="{Binding OpenExternalMergeTool}"/>
|
||||
</StackPanel>
|
||||
<Path Width="64" Height="64" Data="{StaticResource Icons.Conflict}" Fill="{DynamicResource Brush.FG2}"/>
|
||||
<TextBlock Margin="0,16,0,8" FontSize="20" FontWeight="Bold" Text="{DynamicResource Text.WorkingCopy.Conflicts}" Foreground="{DynamicResource Brush.FG2}" HorizontalAlignment="Center"/>
|
||||
<TextBlock Text="{DynamicResource Text.WorkingCopy.ResolveTip}" Foreground="{DynamicResource Brush.FG2}" HorizontalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Vertical" IsVisible="{Binding IsResolved}">
|
||||
|
@ -355,15 +300,8 @@
|
|||
HotKey="Alt+Enter"
|
||||
ToolTip.Tip="{OnPlatform Alt+Enter, macOS=⌥+Enter}"
|
||||
ToolTip.Placement="Top"
|
||||
ToolTip.VerticalOffset="0">
|
||||
<Button.IsVisible>
|
||||
<MultiBinding Converter="{x:Static BoolConverters.And}">
|
||||
<Binding Path="UseAmend" Converter="{x:Static BoolConverters.Not}"/>
|
||||
<Binding Path="CanCommitWithPush"/>
|
||||
<Binding Path="InProgressContext" Converter="{x:Static ObjectConverters.IsNull}"/>
|
||||
</MultiBinding>
|
||||
</Button.IsVisible>
|
||||
</Button>
|
||||
ToolTip.VerticalOffset="0"
|
||||
IsVisible="{Binding IsCommitWithPushVisible}"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
|
Loading…
Reference in a new issue