Skip to content

Commit db9ca5b

Browse files
authored
Merge branch 'develop' into feature/allowing_to_checkout_commit
2 parents 8aa1690 + 5f333fc commit db9ca5b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+821
-282
lines changed

build/build.linux.sh

100644100755
File mode changed.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
#!/bin/bash
2-
exec /opt/sourcegit/sourcegit
2+
exec /opt/sourcegit/sourcegit $1

src/Commands/Branch.cs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,33 @@ public static bool SetUpstream(string repo, string name, string upstream)
3636
return cmd.Exec();
3737
}
3838

39-
public static bool Delete(string repo, string name)
39+
public static bool DeleteLocal(string repo, string name)
4040
{
4141
var cmd = new Command();
4242
cmd.WorkingDirectory = repo;
4343
cmd.Context = repo;
4444
cmd.Args = $"branch -D {name}";
4545
return cmd.Exec();
4646
}
47+
48+
public static bool DeleteRemote(string repo, string remote, string name)
49+
{
50+
var cmd = new Command();
51+
cmd.WorkingDirectory = repo;
52+
cmd.Context = repo;
53+
54+
var sshKey = new Config(repo).Get($"remote.{remote}.sshkey");
55+
if (!string.IsNullOrEmpty(sshKey))
56+
{
57+
cmd.Args = $"-c core.sshCommand=\"ssh -i '{sshKey}'\" ";
58+
}
59+
else
60+
{
61+
cmd.Args = "-c credential.helper=manager ";
62+
}
63+
64+
cmd.Args += $"push {remote} --delete {name}";
65+
return cmd.Exec();
66+
}
4767
}
4868
}

src/Commands/Push.cs

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -33,31 +33,6 @@ public Push(string repo, string local, string remote, string remoteBranch, bool
3333
Args += $"{remote} {local}:{remoteBranch}";
3434
}
3535

36-
/// <summary>
37-
/// Only used to delete a remote branch!!!!!!
38-
/// </summary>
39-
/// <param name="repo"></param>
40-
/// <param name="remote"></param>
41-
/// <param name="branch"></param>
42-
public Push(string repo, string remote, string branch)
43-
{
44-
WorkingDirectory = repo;
45-
Context = repo;
46-
TraitErrorAsOutput = true;
47-
48-
var sshKey = new Config(repo).Get($"remote.{remote}.sshkey");
49-
if (!string.IsNullOrEmpty(sshKey))
50-
{
51-
Args = $"-c core.sshCommand=\"ssh -i '{sshKey}'\" ";
52-
}
53-
else
54-
{
55-
Args = "-c credential.helper=manager ";
56-
}
57-
58-
Args += $"push {remote} --delete {branch}";
59-
}
60-
6136
public Push(string repo, string remote, string tag, bool isDelete)
6237
{
6338
WorkingDirectory = repo;

src/Commands/Tag.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,22 @@ namespace SourceGit.Commands
55
{
66
public static class Tag
77
{
8-
public static bool Add(string repo, string name, string basedOn, string message)
8+
public static bool Add(string repo, string name, string basedOn)
99
{
1010
var cmd = new Command();
1111
cmd.WorkingDirectory = repo;
1212
cmd.Context = repo;
13-
cmd.Args = $"tag -a {name} {basedOn} ";
13+
cmd.Args = $"tag {name} {basedOn}";
14+
return cmd.Exec();
15+
}
16+
17+
public static bool Add(string repo, string name, string basedOn, string message, bool sign)
18+
{
19+
var param = sign ? "-s -a" : "-a";
20+
var cmd = new Command();
21+
cmd.WorkingDirectory = repo;
22+
cmd.Context = repo;
23+
cmd.Args = $"tag {param} {name} {basedOn} ";
1424

1525
if (!string.IsNullOrEmpty(message))
1626
{

src/Converters/EnumConverters.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using Avalonia.Controls.Converters;
2+
3+
namespace SourceGit.Converters
4+
{
5+
public static class EnumConverters
6+
{
7+
public static readonly EnumToBoolConverter Equals = new EnumToBoolConverter();
8+
}
9+
}

src/Converters/WindowStateConverters.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public static class WindowStateConverters
3131
{
3232
if (state == WindowState.Maximized)
3333
{
34-
return new GridLength(30);
34+
return new GridLength(OperatingSystem.IsMacOS() ? 34 : 30);
3535
}
3636
else
3737
{

src/Models/Remote.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ public partial class Remote
66
{
77
[GeneratedRegex(@"^http[s]?://([\w\-]+@)?[\w\.\-]+(\:[0-9]+)?/[\w\-/]+/[\w\-\.]+\.git$")]
88
private static partial Regex REG_HTTPS();
9-
[GeneratedRegex(@"^[\w\-]+@[\w\.\-]+(\:[0-9]+)?:[\w\-]+/[\w\-\.]+\.git$")]
9+
[GeneratedRegex(@"^[\w\-]+@[\w\.\-]+(\:[0-9]+)?:[\w\-/]+/[\w\-\.]+\.git$")]
1010
private static partial Regex REG_SSH1();
11-
[GeneratedRegex(@"^ssh://([\w\-]+@)?[\w\.\-]+(\:[0-9]+)?/[\w\-]+/[\w\-\.]+\.git$")]
11+
[GeneratedRegex(@"^ssh://([\w\-]+@)?[\w\.\-]+(\:[0-9]+)?/[\w\-/]+/[\w\-\.]+\.git$")]
1212
private static partial Regex REG_SSH2();
1313

1414
private static readonly Regex[] URL_FORMATS = [

src/Resources/Locales/en_US.axaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
<x:String x:Key="Text.BranchCM.Checkout" xml:space="preserve">Checkout${0}$</x:String>
3636
<x:String x:Key="Text.BranchCM.CopyName" xml:space="preserve">Copy Branch Name</x:String>
3737
<x:String x:Key="Text.BranchCM.Delete" xml:space="preserve">Delete${0}$</x:String>
38+
<x:String x:Key="Text.BranchCM.DeleteMultiBranches" xml:space="preserve">Delete selected {0} branches</x:String>
3839
<x:String x:Key="Text.BranchCM.DiscardAll" xml:space="preserve">Discard all changes</x:String>
3940
<x:String x:Key="Text.BranchCM.FastForward" xml:space="preserve">Fast-Forward to${0}$</x:String>
4041
<x:String x:Key="Text.BranchCM.Finish" xml:space="preserve">Git Flow - Finish${0}$</x:String>
@@ -85,9 +86,10 @@
8586
<x:String x:Key="Text.CommitCM.SaveAsPatch" xml:space="preserve">Save as Patch ...</x:String>
8687
<x:String x:Key="Text.CommitCM.Squash" xml:space="preserve">Squash Into Parent</x:String>
8788
<x:String x:Key="Text.CommitDetail.Changes" xml:space="preserve">CHANGES</x:String>
88-
<x:String x:Key="Text.CommitDetail.Changes.Search" xml:space="preserve">Search Files ...</x:String>
89+
<x:String x:Key="Text.CommitDetail.Changes.Search" xml:space="preserve">Search Changes ...</x:String>
8990
<x:String x:Key="Text.CommitDetail.Files" xml:space="preserve">FILES</x:String>
9091
<x:String x:Key="Text.CommitDetail.Files.LFS" xml:space="preserve">LFS File</x:String>
92+
<x:String x:Key="Text.CommitDetail.Files.Search" xml:space="preserve">Search Files ...</x:String>
9193
<x:String x:Key="Text.CommitDetail.Files.Submodule" xml:space="preserve">Submodule</x:String>
9294
<x:String x:Key="Text.CommitDetail.Files.Tag" xml:space="preserve">Tag</x:String>
9395
<x:String x:Key="Text.CommitDetail.Files.Tree" xml:space="preserve">Tree</x:String>
@@ -114,20 +116,28 @@
114116
<x:String x:Key="Text.CreateBranch.LocalChanges" xml:space="preserve">Local Changes :</x:String>
115117
<x:String x:Key="Text.CreateBranch.LocalChanges.Discard" xml:space="preserve">Discard</x:String>
116118
<x:String x:Key="Text.CreateBranch.LocalChanges.StashAndReply" xml:space="preserve">Stash &amp; Reapply</x:String>
119+
<x:String x:Key="Text.CreateBranch.LocalChanges.DoNothing" xml:space="preserve">Do Nothing</x:String>
117120
<x:String x:Key="Text.CreateBranch.Name" xml:space="preserve">New Branch Name :</x:String>
118121
<x:String x:Key="Text.CreateBranch.Name.Placeholder" xml:space="preserve">Enter branch name.</x:String>
119122
<x:String x:Key="Text.CreateBranch.Title" xml:space="preserve">Create Local Branch</x:String>
120123
<x:String x:Key="Text.CreateTag" xml:space="preserve">Create Tag</x:String>
121124
<x:String x:Key="Text.CreateTag.BasedOn" xml:space="preserve">New Tag At :</x:String>
125+
<x:String x:Key="Text.CreateTag.GPGSign" xml:space="preserve">GPG signing</x:String>
122126
<x:String x:Key="Text.CreateTag.Message" xml:space="preserve">Tag Message :</x:String>
123127
<x:String x:Key="Text.CreateTag.Message.Placeholder" xml:space="preserve">Optional.</x:String>
124128
<x:String x:Key="Text.CreateTag.Name" xml:space="preserve">Tag Name :</x:String>
125129
<x:String x:Key="Text.CreateTag.Name.Placeholder" xml:space="preserve">Recommended format :v1.0.0-alpha</x:String>
130+
<x:String x:Key="Text.CreateTag.PushToAllRemotes" xml:space="preserve">Push to all remotes after created</x:String>
131+
<x:String x:Key="Text.CreateTag.Type" xml:space="preserve">Kind :</x:String>
132+
<x:String x:Key="Text.CreateTag.Type.Annotated" xml:space="preserve">annotated</x:String>
133+
<x:String x:Key="Text.CreateTag.Type.Lightweight" xml:space="preserve">lightweight</x:String>
126134
<x:String x:Key="Text.Cut" xml:space="preserve">Cut</x:String>
127135
<x:String x:Key="Text.DeleteBranch" xml:space="preserve">Delete Branch</x:String>
128136
<x:String x:Key="Text.DeleteBranch.Branch" xml:space="preserve">Branch :</x:String>
129137
<x:String x:Key="Text.DeleteBranch.IsRemoteTip" xml:space="preserve">You are about to delete a remote branch!!!</x:String>
130138
<x:String x:Key="Text.DeleteBranch.WithTrackingRemote" xml:space="preserve">Also delete remote branch${0}$</x:String>
139+
<x:String x:Key="Text.DeleteMultiBranch" xml:space="preserve">Delete Multiple Branches</x:String>
140+
<x:String x:Key="Text.DeleteMultiBranch.Tip" xml:space="preserve">You are trying to delete multiple branches at one time. Be sure to double-check before taking action!</x:String>
131141
<x:String x:Key="Text.DeleteRemote" xml:space="preserve">Delete Remote</x:String>
132142
<x:String x:Key="Text.DeleteRemote.Remote" xml:space="preserve">Remote :</x:String>
133143
<x:String x:Key="Text.DeleteRepositoryNode.Target" xml:space="preserve">Target :</x:String>
@@ -315,8 +325,10 @@
315325
<x:String x:Key="Text.Push.Remote" xml:space="preserve">Remote :</x:String>
316326
<x:String x:Key="Text.Push.Title" xml:space="preserve">Push Changes To Remote</x:String>
317327
<x:String x:Key="Text.Push.To" xml:space="preserve">Remote Branch :</x:String>
328+
<x:String x:Key="Text.Push.Tracking" xml:space="preserve">Tracking remote branch(--set-upstream)</x:String>
318329
<x:String x:Key="Text.Push.WithAllTags" xml:space="preserve">Push all tags</x:String>
319330
<x:String x:Key="Text.PushTag" xml:space="preserve">Push Tag To Remote</x:String>
331+
<x:String x:Key="Text.PushTag.PushAllRemotes" xml:space="preserve">Push to all remotes</x:String>
320332
<x:String x:Key="Text.PushTag.Remote" xml:space="preserve">Remote :</x:String>
321333
<x:String x:Key="Text.PushTag.Tag" xml:space="preserve">Tag :</x:String>
322334
<x:String x:Key="Text.Quit" xml:space="preserve">Quit</x:String>

src/Resources/Locales/zh_CN.axaml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
<x:String x:Key="Text.BranchCM.Checkout" xml:space="preserve">检出(checkout)${0}$</x:String>
3636
<x:String x:Key="Text.BranchCM.CopyName" xml:space="preserve">复制分支名</x:String>
3737
<x:String x:Key="Text.BranchCM.Delete" xml:space="preserve">删除${0}$</x:String>
38+
<x:String x:Key="Text.BranchCM.DeleteMultiBranches" xml:space="preserve">删除选中的 {0} 个分支</x:String>
3839
<x:String x:Key="Text.BranchCM.DiscardAll" xml:space="preserve">放弃所有更改</x:String>
3940
<x:String x:Key="Text.BranchCM.FastForward" xml:space="preserve">快进(fast-forward)到${0}$</x:String>
4041
<x:String x:Key="Text.BranchCM.Finish" xml:space="preserve">GIT工作流 - 完成${0}$</x:String>
@@ -80,9 +81,10 @@
8081
<x:String x:Key="Text.CommitCM.SaveAsPatch" xml:space="preserve">另存为补丁 ...</x:String>
8182
<x:String x:Key="Text.CommitCM.Squash" xml:space="preserve">合并此提交到上一个提交</x:String>
8283
<x:String x:Key="Text.CommitDetail.Changes" xml:space="preserve">变更对比</x:String>
83-
<x:String x:Key="Text.CommitDetail.Changes.Search" xml:space="preserve">查找文件...</x:String>
84+
<x:String x:Key="Text.CommitDetail.Changes.Search" xml:space="preserve">查找变更...</x:String>
8485
<x:String x:Key="Text.CommitDetail.Files" xml:space="preserve">文件列表</x:String>
8586
<x:String x:Key="Text.CommitDetail.Files.LFS" xml:space="preserve">LFS文件</x:String>
87+
<x:String x:Key="Text.CommitDetail.Files.Search" xml:space="preserve">查找文件...</x:String>
8688
<x:String x:Key="Text.CommitDetail.Files.Submodule" xml:space="preserve">子模块</x:String>
8789
<x:String x:Key="Text.CommitDetail.Files.Tag" xml:space="preserve">标签文件</x:String>
8890
<x:String x:Key="Text.CommitDetail.Files.Tree" xml:space="preserve">子树</x:String>
@@ -107,22 +109,30 @@
107109
<x:String x:Key="Text.CreateBranch.BasedOn" xml:space="preserve">新分支基于 :</x:String>
108110
<x:String x:Key="Text.CreateBranch.Checkout" xml:space="preserve">完成后切换到新分支</x:String>
109111
<x:String x:Key="Text.CreateBranch.LocalChanges" xml:space="preserve">未提交更改 :</x:String>
110-
<x:String x:Key="Text.CreateBranch.LocalChanges.Discard" xml:space="preserve">忽略</x:String>
111-
<x:String x:Key="Text.CreateBranch.LocalChanges.StashAndReply" xml:space="preserve">贮藏(stash)并自动恢复</x:String>
112+
<x:String x:Key="Text.CreateBranch.LocalChanges.Discard" xml:space="preserve">放弃所有</x:String>
113+
<x:String x:Key="Text.CreateBranch.LocalChanges.StashAndReply" xml:space="preserve">贮藏并自动恢复</x:String>
114+
<x:String x:Key="Text.CreateBranch.LocalChanges.DoNothing" xml:space="preserve">GIT默认</x:String>
112115
<x:String x:Key="Text.CreateBranch.Name" xml:space="preserve">新分支名 :</x:String>
113116
<x:String x:Key="Text.CreateBranch.Name.Placeholder" xml:space="preserve">填写分支名称。</x:String>
114117
<x:String x:Key="Text.CreateBranch.Title" xml:space="preserve">创建本地分支</x:String>
115118
<x:String x:Key="Text.CreateTag" xml:space="preserve">新建标签</x:String>
116119
<x:String x:Key="Text.CreateTag.BasedOn" xml:space="preserve">标签位于 :</x:String>
120+
<x:String x:Key="Text.CreateTag.GPGSign" xml:space="preserve">使用GPG签名</x:String>
117121
<x:String x:Key="Text.CreateTag.Message" xml:space="preserve">标签描述 :</x:String>
118122
<x:String x:Key="Text.CreateTag.Message.Placeholder" xml:space="preserve">选填。</x:String>
119123
<x:String x:Key="Text.CreateTag.Name" xml:space="preserve">标签名 :</x:String>
120124
<x:String x:Key="Text.CreateTag.Name.Placeholder" xml:space="preserve">推荐格式 :v1.0.0-alpha</x:String>
125+
<x:String x:Key="Text.CreateTag.PushToAllRemotes" xml:space="preserve">推送到所有远程仓库</x:String>
126+
<x:String x:Key="Text.CreateTag.Type" xml:space="preserve">类型 :</x:String>
127+
<x:String x:Key="Text.CreateTag.Type.Annotated" xml:space="preserve">附注标签</x:String>
128+
<x:String x:Key="Text.CreateTag.Type.Lightweight" xml:space="preserve">轻量标签</x:String>
121129
<x:String x:Key="Text.Cut" xml:space="preserve">剪切</x:String>
122130
<x:String x:Key="Text.DeleteBranch" xml:space="preserve">删除分支确认</x:String>
123131
<x:String x:Key="Text.DeleteBranch.Branch" xml:space="preserve">分支名 :</x:String>
124132
<x:String x:Key="Text.DeleteBranch.IsRemoteTip" xml:space="preserve">您正在删除远程上的分支,请务必小心!!!</x:String>
125133
<x:String x:Key="Text.DeleteBranch.WithTrackingRemote" xml:space="preserve">同时删除远程分支${0}$</x:String>
134+
<x:String x:Key="Text.DeleteMultiBranch" xml:space="preserve">删除多个分支</x:String>
135+
<x:String x:Key="Text.DeleteMultiBranch.Tip" xml:space="preserve">您正在尝试一次性删除多个分支,请务必仔细检查后再执行操作!</x:String>
126136
<x:String x:Key="Text.DeleteRemote" xml:space="preserve">删除远程确认</x:String>
127137
<x:String x:Key="Text.DeleteRemote.Remote" xml:space="preserve">远程名 :</x:String>
128138
<x:String x:Key="Text.DeleteRepositoryNode.Target" xml:space="preserve">目标 :</x:String>
@@ -310,8 +320,10 @@
310320
<x:String x:Key="Text.Push.Remote" xml:space="preserve">远程仓库 :</x:String>
311321
<x:String x:Key="Text.Push.Title" xml:space="preserve">推送到远程仓库</x:String>
312322
<x:String x:Key="Text.Push.To" xml:space="preserve">远程分支 :</x:String>
323+
<x:String x:Key="Text.Push.Tracking" xml:space="preserve">跟踪远程分支(--set-upstream)</x:String>
313324
<x:String x:Key="Text.Push.WithAllTags" xml:space="preserve">同时推送标签</x:String>
314325
<x:String x:Key="Text.PushTag" xml:space="preserve">推送标签到远程仓库</x:String>
326+
<x:String x:Key="Text.PushTag.PushAllRemotes" xml:space="preserve">推送到所有远程仓库</x:String>
315327
<x:String x:Key="Text.PushTag.Remote" xml:space="preserve">远程仓库 :</x:String>
316328
<x:String x:Key="Text.PushTag.Tag" xml:space="preserve">标签 :</x:String>
317329
<x:String x:Key="Text.Quit" xml:space="preserve">退出</x:String>

0 commit comments

Comments
 (0)