diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml
index d6bdbb93..d4b4d26f 100644
--- a/src/Resources/Locales/en_US.axaml
+++ b/src/Resources/Locales/en_US.axaml
@@ -120,6 +120,7 @@
Interactively Rebase ${0}$ on Here
Merge to ${0}$
Merge ...
+ Push ${0}$ to ${1}$
Rebase ${0}$ on Here
Reset ${0}$ to Here
Revert Commit
@@ -554,6 +555,8 @@
Force push
Local Branch:
Remote:
+ Revision:
+ Push Revision To Remote
Push Changes To Remote
Remote Branch:
Set as tracking branch
diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml
index 803f0498..2a5991fd 100644
--- a/src/Resources/Locales/zh_CN.axaml
+++ b/src/Resources/Locales/zh_CN.axaml
@@ -124,6 +124,7 @@
交互式变基(rebase -i) ${0}$ 到此处
合并(merge)此提交至 ${0}$
合并(merge)...
+ 推送(push) ${0}$ 到 ${1}$
变基(rebase) ${0}$ 到此处
重置(reset) ${0}$ 到此处
回滚此提交
@@ -558,6 +559,8 @@
启用强制推送
本地分支 :
远程仓库 :
+ 修订 :
+ 推送指定修订到远程仓库
推送到远程仓库
远程分支 :
跟踪远程分支
diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml
index 91ac765d..f1736ff8 100644
--- a/src/Resources/Locales/zh_TW.axaml
+++ b/src/Resources/Locales/zh_TW.axaml
@@ -124,6 +124,7 @@
互動式重定基底 (rebase -i) ${0}$ 到此處
合併 (merge) 此提交到 ${0}$
合併 (merge)...
+ 推送(push) ${0}$ 至 ${1}$
重定基底 (rebase) ${0}$ 到此處
重設 (reset) ${0}$ 到此處
復原此提交
@@ -558,6 +559,8 @@
啟用強制推送
本機分支:
遠端存放庫:
+ 修訂:
+ 推送修訂到遠端存放庫
推送到遠端存放庫
遠端分支:
追蹤遠端分支
diff --git a/src/ViewModels/Histories.cs b/src/ViewModels/Histories.cs
index a004ed79..9e24e9b3 100644
--- a/src/ViewModels/Histories.cs
+++ b/src/ViewModels/Histories.cs
@@ -666,6 +666,22 @@ namespace SourceGit.ViewModels
if (current.Head != commit.SHA)
{
+ if (current.TrackStatus.Ahead.Contains(commit.SHA))
+ {
+ var upstream = _repo.Branches.Find(x => x.FullName.Equals(current.Upstream, StringComparison.Ordinal));
+ var pushRevision = new MenuItem();
+ pushRevision.Header = App.Text("CommitCM.PushRevision", commit.SHA.Substring(0, 10), upstream.FriendlyName);
+ pushRevision.Icon = App.CreateMenuIcon("Icons.Push");
+ pushRevision.Click += (_, e) =>
+ {
+ if (_repo.CanCreatePopup())
+ _repo.ShowPopup(new PushRevision(_repo, commit, upstream));
+ e.Handled = true;
+ };
+ menu.Items.Add(pushRevision);
+ menu.Items.Add(new MenuItem() { Header = "-" });
+ }
+
var compareWithHead = new MenuItem();
compareWithHead.Header = App.Text("CommitCM.CompareWithHead");
compareWithHead.Icon = App.CreateMenuIcon("Icons.Compare");
diff --git a/src/ViewModels/PushRevision.cs b/src/ViewModels/PushRevision.cs
new file mode 100644
index 00000000..9322db2c
--- /dev/null
+++ b/src/ViewModels/PushRevision.cs
@@ -0,0 +1,59 @@
+using System.Threading.Tasks;
+
+namespace SourceGit.ViewModels
+{
+ public class PushRevision : Popup
+ {
+ public Models.Commit Revision
+ {
+ get;
+ }
+
+ public Models.Branch RemoteBranch
+ {
+ get;
+ }
+
+ public bool Force
+ {
+ get;
+ set;
+ }
+
+ public PushRevision(Repository repo, Models.Commit revision, Models.Branch remoteBranch)
+ {
+ _repo = repo;
+ Revision = revision;
+ RemoteBranch = remoteBranch;
+ Force = false;
+ }
+
+ public override Task Sure()
+ {
+ _repo.SetWatcherEnabled(false);
+ ProgressDescription = $"Push {Revision.SHA.Substring(0, 10)} -> {RemoteBranch.FriendlyName} ...";
+
+ var log = _repo.CreateLog("Push Revision");
+ Use(log);
+
+ return Task.Run(() =>
+ {
+ var succ = new Commands.Push(
+ _repo.FullPath,
+ Revision.SHA,
+ RemoteBranch.Remote,
+ RemoteBranch.Name,
+ false,
+ false,
+ false,
+ Force).Use(log).Exec();
+
+ log.Complete();
+ CallUIThread(() => _repo.SetWatcherEnabled(true));
+ return succ;
+ });
+ }
+
+ private readonly Repository _repo;
+ }
+}
diff --git a/src/Views/PushRevision.axaml b/src/Views/PushRevision.axaml
new file mode 100644
index 00000000..71afd300
--- /dev/null
+++ b/src/Views/PushRevision.axaml
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Views/PushRevision.axaml.cs b/src/Views/PushRevision.axaml.cs
new file mode 100644
index 00000000..6a982844
--- /dev/null
+++ b/src/Views/PushRevision.axaml.cs
@@ -0,0 +1,12 @@
+using Avalonia.Controls;
+
+namespace SourceGit.Views
+{
+ public partial class PushRevision : UserControl
+ {
+ public PushRevision()
+ {
+ InitializeComponent();
+ }
+ }
+}