mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-25 21:07:20 -08:00
Compare commits
6 commits
05c135a89d
...
bcc43e167c
Author | SHA1 | Date | |
---|---|---|---|
|
bcc43e167c | ||
|
5a536fae06 | ||
|
130c98ad40 | ||
|
027844f4c5 | ||
|
304b175b4b | ||
|
9ff28dff72 |
17 changed files with 155 additions and 52 deletions
|
@ -14,21 +14,23 @@ namespace SourceGit.Commands
|
||||||
_findFirstMerged = needFindHead;
|
_findFirstMerged = needFindHead;
|
||||||
}
|
}
|
||||||
|
|
||||||
public QueryCommits(string repo, string filter, Models.CommitSearchMethod method)
|
public QueryCommits(string repo, string filter, Models.CommitSearchMethod method, bool onlyCurrentBranch)
|
||||||
{
|
{
|
||||||
string search;
|
string search = onlyCurrentBranch ? string.Empty : "--branches --remotes ";
|
||||||
|
|
||||||
if (method == Models.CommitSearchMethod.ByUser)
|
if (method == Models.CommitSearchMethod.ByUser)
|
||||||
{
|
{
|
||||||
search = $"-i --author=\"{filter}\" --committer=\"{filter}\"";
|
search += $"-i --author=\"{filter}\" --committer=\"{filter}\"";
|
||||||
}
|
}
|
||||||
else if (method == Models.CommitSearchMethod.ByFile)
|
else if (method == Models.CommitSearchMethod.ByFile)
|
||||||
{
|
{
|
||||||
search = $"-- \"{filter}\"";
|
search += $"-- \"{filter}\"";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var argsBuilder = new StringBuilder();
|
var argsBuilder = new StringBuilder();
|
||||||
|
argsBuilder.Append(search);
|
||||||
|
|
||||||
var words = filter.Split(new[] { ' ', '\t', '\r' }, StringSplitOptions.RemoveEmptyEntries);
|
var words = filter.Split(new[] { ' ', '\t', '\r' }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
foreach (var word in words)
|
foreach (var word in words)
|
||||||
{
|
{
|
||||||
|
@ -36,12 +38,13 @@ namespace SourceGit.Commands
|
||||||
argsBuilder.Append($"--grep=\"{escaped}\" ");
|
argsBuilder.Append($"--grep=\"{escaped}\" ");
|
||||||
}
|
}
|
||||||
argsBuilder.Append("--all-match -i");
|
argsBuilder.Append("--all-match -i");
|
||||||
|
|
||||||
search = argsBuilder.ToString();
|
search = argsBuilder.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
WorkingDirectory = repo;
|
WorkingDirectory = repo;
|
||||||
Context = repo;
|
Context = repo;
|
||||||
Args = $"log -1000 --date-order --no-show-signature --decorate=full --pretty=format:%H%n%P%n%D%n%aN±%aE%n%at%n%cN±%cE%n%ct%n%s --branches --remotes " + search;
|
Args = $"log -1000 --date-order --no-show-signature --decorate=full --pretty=format:%H%n%P%n%D%n%aN±%aE%n%at%n%cN±%cE%n%ct%n%s " + search;
|
||||||
_findFirstMerged = false;
|
_findFirstMerged = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,9 +8,9 @@ namespace SourceGit.Models
|
||||||
[
|
[
|
||||||
new ResetMode("Soft", "Keep all changes. Stage differences", "--soft", Brushes.Green),
|
new ResetMode("Soft", "Keep all changes. Stage differences", "--soft", Brushes.Green),
|
||||||
new ResetMode("Mixed", "Keep all changes. Unstage differences", "--mixed", Brushes.Orange),
|
new ResetMode("Mixed", "Keep all changes. Unstage differences", "--mixed", Brushes.Orange),
|
||||||
|
new ResetMode("Merge", "Reset while keeping unmerged changes", "--merge", Brushes.Purple),
|
||||||
|
new ResetMode("Keep", "Reset while keeping local modifications", "--keep", Brushes.Purple),
|
||||||
new ResetMode("Hard", "Discard all changes", "--hard", Brushes.Red),
|
new ResetMode("Hard", "Discard all changes", "--hard", Brushes.Red),
|
||||||
new ResetMode("Merge", "Reset while keeping unmerged changes", "--merge", Brushes.Green),
|
|
||||||
new ResetMode("Keep", "Reset while keeping local modifications", "--keep", Brushes.Green),
|
|
||||||
];
|
];
|
||||||
|
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
|
@ -512,7 +512,6 @@
|
||||||
<x:String x:Key="Text.Repository.Remotes.Add" xml:space="preserve">REMOTE HINZUFÜGEN</x:String>
|
<x:String x:Key="Text.Repository.Remotes.Add" xml:space="preserve">REMOTE HINZUFÜGEN</x:String>
|
||||||
<x:String x:Key="Text.Repository.Resolve" xml:space="preserve">KONFLIKTE BEHEBEN</x:String>
|
<x:String x:Key="Text.Repository.Resolve" xml:space="preserve">KONFLIKTE BEHEBEN</x:String>
|
||||||
<x:String x:Key="Text.Repository.Search" xml:space="preserve">Commit suchen</x:String>
|
<x:String x:Key="Text.Repository.Search" xml:space="preserve">Commit suchen</x:String>
|
||||||
<x:String x:Key="Text.Repository.Search.By" xml:space="preserve">Suche über</x:String>
|
|
||||||
<x:String x:Key="Text.Repository.Search.ByFile" xml:space="preserve">Dateiname</x:String>
|
<x:String x:Key="Text.Repository.Search.ByFile" xml:space="preserve">Dateiname</x:String>
|
||||||
<x:String x:Key="Text.Repository.Search.ByMessage" xml:space="preserve">Commit-Nachricht</x:String>
|
<x:String x:Key="Text.Repository.Search.ByMessage" xml:space="preserve">Commit-Nachricht</x:String>
|
||||||
<x:String x:Key="Text.Repository.Search.BySHA" xml:space="preserve">SHA</x:String>
|
<x:String x:Key="Text.Repository.Search.BySHA" xml:space="preserve">SHA</x:String>
|
||||||
|
|
|
@ -509,11 +509,11 @@
|
||||||
<x:String x:Key="Text.Repository.Remotes.Add" xml:space="preserve">ADD REMOTE</x:String>
|
<x:String x:Key="Text.Repository.Remotes.Add" xml:space="preserve">ADD REMOTE</x:String>
|
||||||
<x:String x:Key="Text.Repository.Resolve" xml:space="preserve">RESOLVE</x:String>
|
<x:String x:Key="Text.Repository.Resolve" xml:space="preserve">RESOLVE</x:String>
|
||||||
<x:String x:Key="Text.Repository.Search" xml:space="preserve">Search Commit</x:String>
|
<x:String x:Key="Text.Repository.Search" xml:space="preserve">Search Commit</x:String>
|
||||||
<x:String x:Key="Text.Repository.Search.By" xml:space="preserve">Search By</x:String>
|
|
||||||
<x:String x:Key="Text.Repository.Search.ByFile" xml:space="preserve">File</x:String>
|
<x:String x:Key="Text.Repository.Search.ByFile" xml:space="preserve">File</x:String>
|
||||||
<x:String x:Key="Text.Repository.Search.ByMessage" xml:space="preserve">Message</x:String>
|
<x:String x:Key="Text.Repository.Search.ByMessage" xml:space="preserve">Message</x:String>
|
||||||
<x:String x:Key="Text.Repository.Search.BySHA" xml:space="preserve">SHA</x:String>
|
<x:String x:Key="Text.Repository.Search.BySHA" xml:space="preserve">SHA</x:String>
|
||||||
<x:String x:Key="Text.Repository.Search.ByUser" xml:space="preserve">Author & Committer</x:String>
|
<x:String x:Key="Text.Repository.Search.ByUser" xml:space="preserve">Author & Committer</x:String>
|
||||||
|
<x:String x:Key="Text.Repository.Search.InCurrentBranch" xml:space="preserve">Current Branch</x:String>
|
||||||
<x:String x:Key="Text.Repository.ShowTagsAsTree" xml:space="preserve">Show Tags as Tree</x:String>
|
<x:String x:Key="Text.Repository.ShowTagsAsTree" xml:space="preserve">Show Tags as Tree</x:String>
|
||||||
<x:String x:Key="Text.Repository.Statistics" xml:space="preserve">Statistics</x:String>
|
<x:String x:Key="Text.Repository.Statistics" xml:space="preserve">Statistics</x:String>
|
||||||
<x:String x:Key="Text.Repository.Submodules" xml:space="preserve">SUBMODULES</x:String>
|
<x:String x:Key="Text.Repository.Submodules" xml:space="preserve">SUBMODULES</x:String>
|
||||||
|
|
|
@ -491,7 +491,6 @@
|
||||||
<x:String x:Key="Text.Repository.Remotes.Add" xml:space="preserve">ADD REMOTE</x:String>
|
<x:String x:Key="Text.Repository.Remotes.Add" xml:space="preserve">ADD REMOTE</x:String>
|
||||||
<x:String x:Key="Text.Repository.Resolve" xml:space="preserve">RESOLVE</x:String>
|
<x:String x:Key="Text.Repository.Resolve" xml:space="preserve">RESOLVE</x:String>
|
||||||
<x:String x:Key="Text.Repository.Search" xml:space="preserve">Search Commit</x:String>
|
<x:String x:Key="Text.Repository.Search" xml:space="preserve">Search Commit</x:String>
|
||||||
<x:String x:Key="Text.Repository.Search.By" xml:space="preserve">Search By</x:String>
|
|
||||||
<x:String x:Key="Text.Repository.Search.ByFile" xml:space="preserve">File</x:String>
|
<x:String x:Key="Text.Repository.Search.ByFile" xml:space="preserve">File</x:String>
|
||||||
<x:String x:Key="Text.Repository.Search.ByMessage" xml:space="preserve">Message</x:String>
|
<x:String x:Key="Text.Repository.Search.ByMessage" xml:space="preserve">Message</x:String>
|
||||||
<x:String x:Key="Text.Repository.Search.BySHA" xml:space="preserve">SHA</x:String>
|
<x:String x:Key="Text.Repository.Search.BySHA" xml:space="preserve">SHA</x:String>
|
||||||
|
|
|
@ -484,7 +484,6 @@
|
||||||
<x:String x:Key="Text.Repository.Remotes.Add" xml:space="preserve">ADICIONAR REMOTO</x:String>
|
<x:String x:Key="Text.Repository.Remotes.Add" xml:space="preserve">ADICIONAR REMOTO</x:String>
|
||||||
<x:String x:Key="Text.Repository.Resolve" xml:space="preserve">RESOLVER</x:String>
|
<x:String x:Key="Text.Repository.Resolve" xml:space="preserve">RESOLVER</x:String>
|
||||||
<x:String x:Key="Text.Repository.Search" xml:space="preserve">Pesquisar Commit</x:String>
|
<x:String x:Key="Text.Repository.Search" xml:space="preserve">Pesquisar Commit</x:String>
|
||||||
<x:String x:Key="Text.Repository.Search.By" xml:space="preserve">Pesquisar Por</x:String>
|
|
||||||
<x:String x:Key="Text.Repository.Search.ByFile" xml:space="preserve">Arquivo</x:String>
|
<x:String x:Key="Text.Repository.Search.ByFile" xml:space="preserve">Arquivo</x:String>
|
||||||
<x:String x:Key="Text.Repository.Search.ByMessage" xml:space="preserve">Mensagem</x:String>
|
<x:String x:Key="Text.Repository.Search.ByMessage" xml:space="preserve">Mensagem</x:String>
|
||||||
<x:String x:Key="Text.Repository.Search.BySHA" xml:space="preserve">SHA</x:String>
|
<x:String x:Key="Text.Repository.Search.BySHA" xml:space="preserve">SHA</x:String>
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
|
<ResourceDictionary.MergedDictionaries>
|
||||||
|
<ResourceInclude Source="avares://SourceGit/Resources/Locales/en_US.axaml"/>
|
||||||
|
</ResourceDictionary.MergedDictionaries>
|
||||||
<x:String x:Key="Text.About" xml:space="preserve">О программе</x:String>
|
<x:String x:Key="Text.About" xml:space="preserve">О программе</x:String>
|
||||||
<x:String x:Key="Text.About.Menu" xml:space="preserve">О SourceGit</x:String>
|
<x:String x:Key="Text.About.Menu" xml:space="preserve">О SourceGit</x:String>
|
||||||
<x:String x:Key="Text.About.BuildWith" xml:space="preserve">• Сборка с </x:String>
|
<x:String x:Key="Text.About.BuildWith" xml:space="preserve">• Сборка с </x:String>
|
||||||
|
@ -507,7 +510,6 @@
|
||||||
<x:String x:Key="Text.Repository.Remotes.Add" xml:space="preserve">ДОБАВИТЬ ВНЕШНЕЕ ХРАНИЛИЩЕ</x:String>
|
<x:String x:Key="Text.Repository.Remotes.Add" xml:space="preserve">ДОБАВИТЬ ВНЕШНЕЕ ХРАНИЛИЩЕ</x:String>
|
||||||
<x:String x:Key="Text.Repository.Resolve" xml:space="preserve">РАЗРЕШИТЬ</x:String>
|
<x:String x:Key="Text.Repository.Resolve" xml:space="preserve">РАЗРЕШИТЬ</x:String>
|
||||||
<x:String x:Key="Text.Repository.Search" xml:space="preserve">Поиск фиксации</x:String>
|
<x:String x:Key="Text.Repository.Search" xml:space="preserve">Поиск фиксации</x:String>
|
||||||
<x:String x:Key="Text.Repository.Search.By" xml:space="preserve">Поиск по</x:String>
|
|
||||||
<x:String x:Key="Text.Repository.Search.ByFile" xml:space="preserve">Файл</x:String>
|
<x:String x:Key="Text.Repository.Search.ByFile" xml:space="preserve">Файл</x:String>
|
||||||
<x:String x:Key="Text.Repository.Search.ByMessage" xml:space="preserve">Сообщение</x:String>
|
<x:String x:Key="Text.Repository.Search.ByMessage" xml:space="preserve">Сообщение</x:String>
|
||||||
<x:String x:Key="Text.Repository.Search.BySHA" xml:space="preserve">SHA</x:String>
|
<x:String x:Key="Text.Repository.Search.BySHA" xml:space="preserve">SHA</x:String>
|
||||||
|
|
|
@ -507,11 +507,11 @@
|
||||||
<x:String x:Key="Text.Repository.Remotes.Add" xml:space="preserve">添加远程</x:String>
|
<x:String x:Key="Text.Repository.Remotes.Add" xml:space="preserve">添加远程</x:String>
|
||||||
<x:String x:Key="Text.Repository.Resolve" xml:space="preserve">解决冲突</x:String>
|
<x:String x:Key="Text.Repository.Resolve" xml:space="preserve">解决冲突</x:String>
|
||||||
<x:String x:Key="Text.Repository.Search" xml:space="preserve">查找提交</x:String>
|
<x:String x:Key="Text.Repository.Search" xml:space="preserve">查找提交</x:String>
|
||||||
<x:String x:Key="Text.Repository.Search.By" xml:space="preserve">搜索途径</x:String>
|
|
||||||
<x:String x:Key="Text.Repository.Search.ByFile" xml:space="preserve">文件</x:String>
|
<x:String x:Key="Text.Repository.Search.ByFile" xml:space="preserve">文件</x:String>
|
||||||
<x:String x:Key="Text.Repository.Search.ByMessage" xml:space="preserve">提交信息</x:String>
|
<x:String x:Key="Text.Repository.Search.ByMessage" xml:space="preserve">提交信息</x:String>
|
||||||
<x:String x:Key="Text.Repository.Search.BySHA" xml:space="preserve">提交指纹</x:String>
|
<x:String x:Key="Text.Repository.Search.BySHA" xml:space="preserve">提交指纹</x:String>
|
||||||
<x:String x:Key="Text.Repository.Search.ByUser" xml:space="preserve">作者及提交者</x:String>
|
<x:String x:Key="Text.Repository.Search.ByUser" xml:space="preserve">作者及提交者</x:String>
|
||||||
|
<x:String x:Key="Text.Repository.Search.InCurrentBranch" xml:space="preserve">仅在当前分支中查找</x:String>
|
||||||
<x:String x:Key="Text.Repository.ShowTagsAsTree" xml:space="preserve">以树型结构展示</x:String>
|
<x:String x:Key="Text.Repository.ShowTagsAsTree" xml:space="preserve">以树型结构展示</x:String>
|
||||||
<x:String x:Key="Text.Repository.Statistics" xml:space="preserve">提交统计</x:String>
|
<x:String x:Key="Text.Repository.Statistics" xml:space="preserve">提交统计</x:String>
|
||||||
<x:String x:Key="Text.Repository.Submodules" xml:space="preserve">子模块列表</x:String>
|
<x:String x:Key="Text.Repository.Submodules" xml:space="preserve">子模块列表</x:String>
|
||||||
|
|
|
@ -512,11 +512,11 @@
|
||||||
<x:String x:Key="Text.Repository.Remotes.Add" xml:space="preserve">新增遠端</x:String>
|
<x:String x:Key="Text.Repository.Remotes.Add" xml:space="preserve">新增遠端</x:String>
|
||||||
<x:String x:Key="Text.Repository.Resolve" xml:space="preserve">解決衝突</x:String>
|
<x:String x:Key="Text.Repository.Resolve" xml:space="preserve">解決衝突</x:String>
|
||||||
<x:String x:Key="Text.Repository.Search" xml:space="preserve">搜尋提交</x:String>
|
<x:String x:Key="Text.Repository.Search" xml:space="preserve">搜尋提交</x:String>
|
||||||
<x:String x:Key="Text.Repository.Search.By" xml:space="preserve">搜尋方式</x:String>
|
|
||||||
<x:String x:Key="Text.Repository.Search.ByFile" xml:space="preserve">檔案</x:String>
|
<x:String x:Key="Text.Repository.Search.ByFile" xml:space="preserve">檔案</x:String>
|
||||||
<x:String x:Key="Text.Repository.Search.ByMessage" xml:space="preserve">提交訊息</x:String>
|
<x:String x:Key="Text.Repository.Search.ByMessage" xml:space="preserve">提交訊息</x:String>
|
||||||
<x:String x:Key="Text.Repository.Search.BySHA" xml:space="preserve">提交編號</x:String>
|
<x:String x:Key="Text.Repository.Search.BySHA" xml:space="preserve">提交編號</x:String>
|
||||||
<x:String x:Key="Text.Repository.Search.ByUser" xml:space="preserve">作者及提交者</x:String>
|
<x:String x:Key="Text.Repository.Search.ByUser" xml:space="preserve">作者及提交者</x:String>
|
||||||
|
<x:String x:Key="Text.Repository.Search.InCurrentBranch" xml:space="preserve">僅搜尋當前分支</x:String>
|
||||||
<x:String x:Key="Text.Repository.ShowTagsAsTree" xml:space="preserve">以樹型結構展示</x:String>
|
<x:String x:Key="Text.Repository.ShowTagsAsTree" xml:space="preserve">以樹型結構展示</x:String>
|
||||||
<x:String x:Key="Text.Repository.Statistics" xml:space="preserve">提交統計</x:String>
|
<x:String x:Key="Text.Repository.Statistics" xml:space="preserve">提交統計</x:String>
|
||||||
<x:String x:Key="Text.Repository.Submodules" xml:space="preserve">子模組列表</x:String>
|
<x:String x:Key="Text.Repository.Submodules" xml:space="preserve">子模組列表</x:String>
|
||||||
|
|
|
@ -321,6 +321,9 @@ namespace SourceGit.ViewModels
|
||||||
menu.Items.Add(resetToFirstParent);
|
menu.Items.Add(resetToFirstParent);
|
||||||
menu.Items.Add(new MenuItem { Header = "-" });
|
menu.Items.Add(new MenuItem { Header = "-" });
|
||||||
|
|
||||||
|
if (File.Exists(Path.Combine(fullPath)))
|
||||||
|
TryToAddContextMenuItemsForGitLFS(menu, change.Path);
|
||||||
|
|
||||||
var copyPath = new MenuItem();
|
var copyPath = new MenuItem();
|
||||||
copyPath.Header = App.Text("CopyPath");
|
copyPath.Header = App.Text("CopyPath");
|
||||||
copyPath.Icon = App.CreateMenuIcon("Icons.Copy");
|
copyPath.Icon = App.CreateMenuIcon("Icons.Copy");
|
||||||
|
@ -346,6 +349,7 @@ namespace SourceGit.ViewModels
|
||||||
|
|
||||||
public ContextMenu CreateRevisionFileContextMenu(Models.Object file)
|
public ContextMenu CreateRevisionFileContextMenu(Models.Object file)
|
||||||
{
|
{
|
||||||
|
var menu = new ContextMenu();
|
||||||
var fullPath = Path.Combine(_repo.FullPath, file.Path);
|
var fullPath = Path.Combine(_repo.FullPath, file.Path);
|
||||||
var explore = new MenuItem();
|
var explore = new MenuItem();
|
||||||
explore.Header = App.Text("RevealFile");
|
explore.Header = App.Text("RevealFile");
|
||||||
|
@ -385,6 +389,10 @@ namespace SourceGit.ViewModels
|
||||||
ev.Handled = true;
|
ev.Handled = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
menu.Items.Add(explore);
|
||||||
|
menu.Items.Add(saveAs);
|
||||||
|
menu.Items.Add(new MenuItem() { Header = "-" });
|
||||||
|
|
||||||
var history = new MenuItem();
|
var history = new MenuItem();
|
||||||
history.Header = App.Text("FileHistory");
|
history.Header = App.Text("FileHistory");
|
||||||
history.Icon = App.CreateMenuIcon("Icons.Histories");
|
history.Icon = App.CreateMenuIcon("Icons.Histories");
|
||||||
|
@ -406,6 +414,10 @@ namespace SourceGit.ViewModels
|
||||||
ev.Handled = true;
|
ev.Handled = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
menu.Items.Add(history);
|
||||||
|
menu.Items.Add(blame);
|
||||||
|
menu.Items.Add(new MenuItem() { Header = "-" });
|
||||||
|
|
||||||
var resetToThisRevision = new MenuItem();
|
var resetToThisRevision = new MenuItem();
|
||||||
resetToThisRevision.Header = App.Text("ChangeCM.CheckoutThisRevision");
|
resetToThisRevision.Header = App.Text("ChangeCM.CheckoutThisRevision");
|
||||||
resetToThisRevision.Icon = App.CreateMenuIcon("Icons.File.Checkout");
|
resetToThisRevision.Icon = App.CreateMenuIcon("Icons.File.Checkout");
|
||||||
|
@ -428,6 +440,13 @@ namespace SourceGit.ViewModels
|
||||||
ev.Handled = true;
|
ev.Handled = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
menu.Items.Add(resetToThisRevision);
|
||||||
|
menu.Items.Add(resetToFirstParent);
|
||||||
|
menu.Items.Add(new MenuItem() { Header = "-" });
|
||||||
|
|
||||||
|
if (File.Exists(Path.Combine(fullPath)))
|
||||||
|
TryToAddContextMenuItemsForGitLFS(menu, file.Path);
|
||||||
|
|
||||||
var copyPath = new MenuItem();
|
var copyPath = new MenuItem();
|
||||||
copyPath.Header = App.Text("CopyPath");
|
copyPath.Header = App.Text("CopyPath");
|
||||||
copyPath.Icon = App.CreateMenuIcon("Icons.Copy");
|
copyPath.Icon = App.CreateMenuIcon("Icons.Copy");
|
||||||
|
@ -446,16 +465,6 @@ namespace SourceGit.ViewModels
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
var menu = new ContextMenu();
|
|
||||||
menu.Items.Add(explore);
|
|
||||||
menu.Items.Add(saveAs);
|
|
||||||
menu.Items.Add(new MenuItem() { Header = "-" });
|
|
||||||
menu.Items.Add(history);
|
|
||||||
menu.Items.Add(blame);
|
|
||||||
menu.Items.Add(new MenuItem() { Header = "-" });
|
|
||||||
menu.Items.Add(resetToThisRevision);
|
|
||||||
menu.Items.Add(resetToFirstParent);
|
|
||||||
menu.Items.Add(new MenuItem() { Header = "-" });
|
|
||||||
menu.Items.Add(copyPath);
|
menu.Items.Add(copyPath);
|
||||||
menu.Items.Add(copyFileName);
|
menu.Items.Add(copyFileName);
|
||||||
return menu;
|
return menu;
|
||||||
|
@ -532,6 +541,90 @@ namespace SourceGit.ViewModels
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void TryToAddContextMenuItemsForGitLFS(ContextMenu menu, string path)
|
||||||
|
{
|
||||||
|
var lfsEnabled = new Commands.LFS(_repo.FullPath).IsEnabled();
|
||||||
|
if (!lfsEnabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var lfs = new MenuItem();
|
||||||
|
lfs.Header = App.Text("GitLFS");
|
||||||
|
lfs.Icon = App.CreateMenuIcon("Icons.LFS");
|
||||||
|
|
||||||
|
var lfsLock = new MenuItem();
|
||||||
|
lfsLock.Header = App.Text("GitLFS.Locks.Lock");
|
||||||
|
lfsLock.Icon = App.CreateMenuIcon("Icons.Lock");
|
||||||
|
lfsLock.IsEnabled = _repo.Remotes.Count > 0;
|
||||||
|
if (_repo.Remotes.Count == 1)
|
||||||
|
{
|
||||||
|
lfsLock.Click += async (_, e) =>
|
||||||
|
{
|
||||||
|
var succ = await Task.Run(() => new Commands.LFS(_repo.FullPath).Lock(_repo.Remotes[0].Name, path));
|
||||||
|
if (succ)
|
||||||
|
App.SendNotification(_repo.FullPath, $"Lock file \"{path}\" successfully!");
|
||||||
|
|
||||||
|
e.Handled = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
foreach (var remote in _repo.Remotes)
|
||||||
|
{
|
||||||
|
var remoteName = remote.Name;
|
||||||
|
var lockRemote = new MenuItem();
|
||||||
|
lockRemote.Header = remoteName;
|
||||||
|
lockRemote.Click += async (_, e) =>
|
||||||
|
{
|
||||||
|
var succ = await Task.Run(() => new Commands.LFS(_repo.FullPath).Lock(remoteName, path));
|
||||||
|
if (succ)
|
||||||
|
App.SendNotification(_repo.FullPath, $"Lock file \"{path}\" successfully!");
|
||||||
|
|
||||||
|
e.Handled = true;
|
||||||
|
};
|
||||||
|
lfsLock.Items.Add(lockRemote);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lfs.Items.Add(lfsLock);
|
||||||
|
|
||||||
|
var lfsUnlock = new MenuItem();
|
||||||
|
lfsUnlock.Header = App.Text("GitLFS.Locks.Unlock");
|
||||||
|
lfsUnlock.Icon = App.CreateMenuIcon("Icons.Unlock");
|
||||||
|
lfsUnlock.IsEnabled = _repo.Remotes.Count > 0;
|
||||||
|
if (_repo.Remotes.Count == 1)
|
||||||
|
{
|
||||||
|
lfsUnlock.Click += async (_, e) =>
|
||||||
|
{
|
||||||
|
var succ = await Task.Run(() => new Commands.LFS(_repo.FullPath).Unlock(_repo.Remotes[0].Name, path, false));
|
||||||
|
if (succ)
|
||||||
|
App.SendNotification(_repo.FullPath, $"Unlock file \"{path}\" successfully!");
|
||||||
|
|
||||||
|
e.Handled = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
foreach (var remote in _repo.Remotes)
|
||||||
|
{
|
||||||
|
var remoteName = remote.Name;
|
||||||
|
var unlockRemote = new MenuItem();
|
||||||
|
unlockRemote.Header = remoteName;
|
||||||
|
unlockRemote.Click += async (_, e) =>
|
||||||
|
{
|
||||||
|
var succ = await Task.Run(() => new Commands.LFS(_repo.FullPath).Unlock(remoteName, path, false));
|
||||||
|
if (succ)
|
||||||
|
App.SendNotification(_repo.FullPath, $"Unlock file \"{path}\" successfully!");
|
||||||
|
|
||||||
|
e.Handled = true;
|
||||||
|
};
|
||||||
|
lfsUnlock.Items.Add(unlockRemote);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lfs.Items.Add(lfsUnlock);
|
||||||
|
|
||||||
|
menu.Items.Add(lfs);
|
||||||
|
menu.Items.Add(new MenuItem() { Header = "-" });
|
||||||
|
}
|
||||||
|
|
||||||
[GeneratedRegex(@"^version https://git-lfs.github.com/spec/v\d+\r?\noid sha256:([0-9a-f]+)\r?\nsize (\d+)[\r\n]*$")]
|
[GeneratedRegex(@"^version https://git-lfs.github.com/spec/v\d+\r?\noid sha256:([0-9a-f]+)\r?\nsize (\d+)[\r\n]*$")]
|
||||||
private static partial Regex REG_LFS_FORMAT();
|
private static partial Regex REG_LFS_FORMAT();
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@ namespace SourceGit.ViewModels
|
||||||
CallUIThread(() =>
|
CallUIThread(() =>
|
||||||
{
|
{
|
||||||
_repo.MarkFetched();
|
_repo.MarkFetched();
|
||||||
_repo.SetWatcherEnabled(true);
|
_repo.SetWatcherEnabled(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace SourceGit.ViewModels
|
||||||
get => _isLoading;
|
get => _isLoading;
|
||||||
private set => SetProperty(ref _isLoading, value);
|
private set => SetProperty(ref _isLoading, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool ShowOnlyMyLocks
|
public bool ShowOnlyMyLocks
|
||||||
{
|
{
|
||||||
get => _showOnlyMyLocks;
|
get => _showOnlyMyLocks;
|
||||||
|
|
|
@ -210,6 +210,12 @@ namespace SourceGit.ViewModels
|
||||||
private set => SetProperty(ref _isSearchLoadingVisible, value);
|
private set => SetProperty(ref _isSearchLoadingVisible, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool OnlySearchCommitsInCurrentBranch
|
||||||
|
{
|
||||||
|
get => _onlySearchCommitsInCurrentBranch;
|
||||||
|
set => SetProperty(ref _onlySearchCommitsInCurrentBranch, value);
|
||||||
|
}
|
||||||
|
|
||||||
public int SearchCommitFilterType
|
public int SearchCommitFilterType
|
||||||
{
|
{
|
||||||
get => _searchCommitFilterType;
|
get => _searchCommitFilterType;
|
||||||
|
@ -589,13 +595,13 @@ namespace SourceGit.ViewModels
|
||||||
visible.Add(commit);
|
visible.Add(commit);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
visible = new Commands.QueryCommits(_fullpath, _searchCommitFilter, Models.CommitSearchMethod.ByUser).Result();
|
visible = new Commands.QueryCommits(_fullpath, _searchCommitFilter, Models.CommitSearchMethod.ByUser, _onlySearchCommitsInCurrentBranch).Result();
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
visible = new Commands.QueryCommits(_fullpath, _searchCommitFilter, Models.CommitSearchMethod.ByMessage).Result();
|
visible = new Commands.QueryCommits(_fullpath, _searchCommitFilter, Models.CommitSearchMethod.ByMessage, _onlySearchCommitsInCurrentBranch).Result();
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
visible = new Commands.QueryCommits(_fullpath, _searchCommitFilter, Models.CommitSearchMethod.ByFile).Result();
|
visible = new Commands.QueryCommits(_fullpath, _searchCommitFilter, Models.CommitSearchMethod.ByFile, _onlySearchCommitsInCurrentBranch).Result();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -667,8 +673,8 @@ namespace SourceGit.ViewModels
|
||||||
var hasLeft = false;
|
var hasLeft = false;
|
||||||
foreach (var b in _branches)
|
foreach (var b in _branches)
|
||||||
{
|
{
|
||||||
if (!b.FullName.Equals(local.FullName, StringComparison.Ordinal) &&
|
if (!b.FullName.Equals(local.FullName, StringComparison.Ordinal) &&
|
||||||
!b.FullName.Equals(local.Upstream, StringComparison.Ordinal) &&
|
!b.FullName.Equals(local.Upstream, StringComparison.Ordinal) &&
|
||||||
!_settings.Filters.Contains(b.FullName))
|
!_settings.Filters.Contains(b.FullName))
|
||||||
{
|
{
|
||||||
hasLeft = true;
|
hasLeft = true;
|
||||||
|
@ -2072,6 +2078,7 @@ namespace SourceGit.ViewModels
|
||||||
private bool _isSearchLoadingVisible = false;
|
private bool _isSearchLoadingVisible = false;
|
||||||
private bool _isSearchCommitSuggestionOpen = false;
|
private bool _isSearchCommitSuggestionOpen = false;
|
||||||
private int _searchCommitFilterType = 2;
|
private int _searchCommitFilterType = 2;
|
||||||
|
private bool _onlySearchCommitsInCurrentBranch = false;
|
||||||
private bool _enableFirstParentInHistories = false;
|
private bool _enableFirstParentInHistories = false;
|
||||||
private string _searchCommitFilter = string.Empty;
|
private string _searchCommitFilter = string.Empty;
|
||||||
private List<Models.Commit> _searchedCommits = new List<Models.Commit>();
|
private List<Models.Commit> _searchedCommits = new List<Models.Commit>();
|
||||||
|
|
|
@ -430,7 +430,7 @@ namespace SourceGit.Views
|
||||||
|
|
||||||
private void OnToggleFilterClicked(object sender, RoutedEventArgs e)
|
private void OnToggleFilterClicked(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (DataContext is ViewModels.Repository repo &&
|
if (DataContext is ViewModels.Repository repo &&
|
||||||
sender is ToggleButton toggle &&
|
sender is ToggleButton toggle &&
|
||||||
toggle.DataContext is ViewModels.BranchTreeNode { Backend: Models.Branch branch } node)
|
toggle.DataContext is ViewModels.BranchTreeNode { Backend: Models.Branch branch } node)
|
||||||
{
|
{
|
||||||
|
|
|
@ -58,7 +58,7 @@ namespace SourceGit.Views
|
||||||
|
|
||||||
var geo = new StreamGeometry();
|
var geo = new StreamGeometry();
|
||||||
var angle = Math.PI / 2;
|
var angle = Math.PI / 2;
|
||||||
var y = height + 0.1;
|
var y = height + 0.5;
|
||||||
using (var ctx = geo.Open())
|
using (var ctx = geo.Open())
|
||||||
{
|
{
|
||||||
double x;
|
double x;
|
||||||
|
@ -94,17 +94,17 @@ namespace SourceGit.Views
|
||||||
x = drawRightX;
|
x = drawRightX;
|
||||||
y = 6;
|
y = 6;
|
||||||
ctx.ArcTo(new Point(x, y), new Size(6, 6), angle, false, SweepDirection.Clockwise);
|
ctx.ArcTo(new Point(x, y), new Size(6, 6), angle, false, SweepDirection.Clockwise);
|
||||||
y = height + 0.1 - 5;
|
y = height + 0.5 - 5;
|
||||||
ctx.LineTo(new Point(x, y));
|
ctx.LineTo(new Point(x, y));
|
||||||
x += 5;
|
x += 5;
|
||||||
y = height + 0.1;
|
y = height + 0.5;
|
||||||
ctx.ArcTo(new Point(x, y), new Size(5, 5), angle, false, SweepDirection.CounterClockwise);
|
ctx.ArcTo(new Point(x, y), new Size(5, 5), angle, false, SweepDirection.CounterClockwise);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
x = LauncherTabsScroller.Bounds.Right;
|
x = LauncherTabsScroller.Bounds.Right;
|
||||||
ctx.LineTo(new Point(x, y));
|
ctx.LineTo(new Point(x, y));
|
||||||
y = height + 0.1;
|
y = height + 0.5;
|
||||||
ctx.LineTo(new Point(x, y));
|
ctx.LineTo(new Point(x, y));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -343,7 +343,7 @@
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<!-- Commit Search Panel -->
|
<!-- Commit Search Panel -->
|
||||||
<Grid Grid.Row="1" RowDefinitions="24,32,*" Margin="8,0,4,8" IsVisible="{Binding IsSearching}" PropertyChanged="OnSearchCommitPanelPropertyChanged">
|
<Grid Grid.Row="1" RowDefinitions="26,26,*" Margin="8,0,4,8" IsVisible="{Binding IsSearching}" PropertyChanged="OnSearchCommitPanelPropertyChanged">
|
||||||
<!-- Search Input Box -->
|
<!-- Search Input Box -->
|
||||||
<Grid Grid.Row="0">
|
<Grid Grid.Row="0">
|
||||||
<TextBox x:Name="TxtSearchCommitsBox"
|
<TextBox x:Name="TxtSearchCommitsBox"
|
||||||
|
@ -430,18 +430,11 @@
|
||||||
</Popup>
|
</Popup>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<Grid Grid.Row="1" ColumnDefinitions="Auto,*">
|
<StackPanel Grid.Row="1" Orientation="Horizontal">
|
||||||
<TextBlock Grid.Column="0"
|
<ComboBox MinHeight="24" Height="24"
|
||||||
Text="{DynamicResource Text.Repository.Search.By}"
|
Padding="4,0"
|
||||||
Foreground="{DynamicResource Brush.FG2}"
|
Background="Transparent"
|
||||||
Margin="2,0,0,0"/>
|
BorderThickness="0"
|
||||||
|
|
||||||
<ComboBox Grid.Column="1"
|
|
||||||
MinHeight="24" Height="24"
|
|
||||||
Padding="8,0"
|
|
||||||
Background="{DynamicResource Brush.Contents}"
|
|
||||||
BorderBrush="{DynamicResource Brush.Border2}"
|
|
||||||
HorizontalAlignment="Right"
|
|
||||||
SelectedIndex="{Binding SearchCommitFilterType, Mode=TwoWay}">
|
SelectedIndex="{Binding SearchCommitFilterType, Mode=TwoWay}">
|
||||||
<ComboBox.Items>
|
<ComboBox.Items>
|
||||||
<TextBlock Text="{DynamicResource Text.Repository.Search.BySHA}" FontSize="12"/>
|
<TextBlock Text="{DynamicResource Text.Repository.Search.BySHA}" FontSize="12"/>
|
||||||
|
@ -450,9 +443,17 @@
|
||||||
<TextBlock Text="{DynamicResource Text.Repository.Search.ByFile}" FontSize="12"/>
|
<TextBlock Text="{DynamicResource Text.Repository.Search.ByFile}" FontSize="12"/>
|
||||||
</ComboBox.Items>
|
</ComboBox.Items>
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
</Grid>
|
|
||||||
|
<CheckBox Height="24"
|
||||||
|
Margin="4,0,0,0"
|
||||||
|
FontSize="12"
|
||||||
|
Content="{DynamicResource Text.Repository.Search.InCurrentBranch}"
|
||||||
|
IsChecked="{Binding OnlySearchCommitsInCurrentBranch, Mode=TwoWay}"
|
||||||
|
IsVisible="{Binding SearchCommitFilterType, Converter={x:Static c:IntConverters.IsGreaterThanZero}}"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
<ListBox Grid.Row="2"
|
<ListBox Grid.Row="2"
|
||||||
|
Margin="0,8,0,0"
|
||||||
ItemsSource="{Binding SearchedCommits}"
|
ItemsSource="{Binding SearchedCommits}"
|
||||||
SelectionMode="Single"
|
SelectionMode="Single"
|
||||||
SelectedItem="{Binding SearchResultSelectedCommit, Mode=TwoWay}"
|
SelectedItem="{Binding SearchResultSelectedCommit, Mode=TwoWay}"
|
||||||
|
|
|
@ -113,7 +113,7 @@
|
||||||
IsChecked="{Binding EnableAutoFetch, Mode=TwoWay}"/>
|
IsChecked="{Binding EnableAutoFetch, Mode=TwoWay}"/>
|
||||||
|
|
||||||
<NumericUpDown Minimum="1" Maximum="60" Increment="1"
|
<NumericUpDown Minimum="1" Maximum="60" Increment="1"
|
||||||
Height="26"
|
Height="26" Width="110"
|
||||||
Margin="8,0,0,0" Padding="4"
|
Margin="8,0,0,0" Padding="4"
|
||||||
BorderThickness="1" BorderBrush="{DynamicResource Brush.Border1}"
|
BorderThickness="1" BorderBrush="{DynamicResource Brush.Border1}"
|
||||||
CornerRadius="3"
|
CornerRadius="3"
|
||||||
|
|
Loading…
Reference in a new issue