diff --git a/src/Resources/Locales/de_DE.axaml b/src/Resources/Locales/de_DE.axaml
index d91c44da..a8a585d5 100644
--- a/src/Resources/Locales/de_DE.axaml
+++ b/src/Resources/Locales/de_DE.axaml
@@ -67,8 +67,7 @@
Push ${0}$
Rebase ${0}$ auf ${1}$...
Benenne ${0}$ um...
- Setze verfolgten Branch
- Upstream Verfolgung aufheben
+ Setze verfolgten Branch...
Branch Vergleich
Bytes
ABBRECHEN
diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml
index 24f9fa67..f907b15b 100644
--- a/src/Resources/Locales/en_US.axaml
+++ b/src/Resources/Locales/en_US.axaml
@@ -64,8 +64,7 @@
Push ${0}$
Rebase ${0}$ on ${1}$...
Rename ${0}$...
- Set Tracking Branch
- Unset Upstream
+ Set Tracking Branch...
Branch Compare
Bytes
CANCEL
@@ -625,6 +624,10 @@
Skip This Version
Software Update
There are currently no updates available.
+ Set Tracking Branch
+ Branch:
+ Unset upstream
+ Upstream:
Copy SHA
Go to
Squash Commits
diff --git a/src/Resources/Locales/es_ES.axaml b/src/Resources/Locales/es_ES.axaml
index ce7a2f61..757cdae1 100644
--- a/src/Resources/Locales/es_ES.axaml
+++ b/src/Resources/Locales/es_ES.axaml
@@ -67,8 +67,7 @@
Push ${0}$
Rebase ${0}$ en ${1}$...
Renombrar ${0}$...
- Establecer Rama de Seguimiento
- Desestablecer Upstream
+ Establecer Rama de Seguimiento...
Comparar Ramas
Bytes
CANCELAR
diff --git a/src/Resources/Locales/fr_FR.axaml b/src/Resources/Locales/fr_FR.axaml
index b7802fe6..12b08d08 100644
--- a/src/Resources/Locales/fr_FR.axaml
+++ b/src/Resources/Locales/fr_FR.axaml
@@ -66,8 +66,7 @@
Pousser ${0}$
Rebaser ${0}$ sur ${1}$...
Renommer ${0}$...
- Définir la branche de suivi
- Ne plus suivre la branche distante
+ Définir la branche de suivi...
Comparer les branches
Octets
ANNULER
diff --git a/src/Resources/Locales/it_IT.axaml b/src/Resources/Locales/it_IT.axaml
index 55457178..3022ffe9 100644
--- a/src/Resources/Locales/it_IT.axaml
+++ b/src/Resources/Locales/it_IT.axaml
@@ -66,8 +66,7 @@
Invia ${0}$
Riallinea ${0}$ su ${1}$...
Rinomina ${0}$...
- Imposta Branch di Tracciamento
- Rimuovi Tracciamento
+ Imposta Branch di Tracciamento...
Confronto Branch
Byte
ANNULLA
diff --git a/src/Resources/Locales/pt_BR.axaml b/src/Resources/Locales/pt_BR.axaml
index 3f026d70..fb3694ef 100644
--- a/src/Resources/Locales/pt_BR.axaml
+++ b/src/Resources/Locales/pt_BR.axaml
@@ -91,8 +91,7 @@
Subir ${0}$
Rebase ${0}$ em ${1}$...
Renomear ${0}$...
- Definir Branch de Rastreamento
- Remover Upstream
+ Definir Branch de Rastreamento...
Comparação de Branches
Bytes
CANCELAR
diff --git a/src/Resources/Locales/ru_RU.axaml b/src/Resources/Locales/ru_RU.axaml
index 4c02a840..a8aafe47 100644
--- a/src/Resources/Locales/ru_RU.axaml
+++ b/src/Resources/Locales/ru_RU.axaml
@@ -67,8 +67,7 @@
Выложить ${0}$
Переместить ${0}$ на ${1}$...
Переименовать ${0}$...
- Отслеживать ветку
- Отключить основной поток
+ Отслеживать ветку...
Сравнение веток
Байты
ОТМЕНА
diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml
index 7589678c..0a5cd880 100644
--- a/src/Resources/Locales/zh_CN.axaml
+++ b/src/Resources/Locales/zh_CN.axaml
@@ -67,8 +67,7 @@
推送(push)${0}$
变基(rebase) ${0}$ 分支至 ${1}$...
重命名 ${0}$...
- 切换上游分支
- 取消追踪
+ 切换上游分支 ...
分支比较
字节
取 消
@@ -629,6 +628,10 @@
忽略此版本
软件更新
当前已是最新版本。
+ 切换上游分支
+ 本地分支 :
+ 取消追踪
+ 上游分支 :
复制提交指纹
跳转到提交
压缩为单个提交
diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml
index 21b1967a..d49cbce7 100644
--- a/src/Resources/Locales/zh_TW.axaml
+++ b/src/Resources/Locales/zh_TW.axaml
@@ -67,8 +67,7 @@
推送 (push) ${0}$
重定基底 (rebase) ${0}$ 分支至 ${1}$...
重新命名 ${0}$...
- 切換上游分支
- 取消設定上游分支
+ 切換上游分支...
分支比較
位元組
取 消
@@ -628,6 +627,10 @@
忽略此版本
軟體更新
目前已是最新版本。
+ 切換上游分支
+ 本機分支:
+ 取消設定上游分支
+ 上游分支:
複製提交編號
前往此提交
壓縮為單個提交
diff --git a/src/ViewModels/Repository.cs b/src/ViewModels/Repository.cs
index 5d84d979..2a624d79 100644
--- a/src/ViewModels/Repository.cs
+++ b/src/ViewModels/Repository.cs
@@ -1624,38 +1624,12 @@ namespace SourceGit.ViewModels
var tracking = new MenuItem();
tracking.Header = App.Text("BranchCM.Tracking");
tracking.Icon = App.CreateMenuIcon("Icons.Track");
-
- foreach (var b in remoteBranches)
+ tracking.Click += (_, e) =>
{
- var upstream = b.FullName.Replace("refs/remotes/", "");
- var target = new MenuItem();
- target.Header = upstream;
- if (branch.Upstream == b.FullName)
- target.Icon = App.CreateMenuIcon("Icons.Check");
-
- target.Click += (_, e) =>
- {
- if (Commands.Branch.SetUpstream(_fullpath, branch.Name, upstream))
- Task.Run(RefreshBranches);
-
- e.Handled = true;
- };
-
- tracking.Items.Add(target);
- }
-
- var unsetUpstream = new MenuItem();
- unsetUpstream.Header = App.Text("BranchCM.UnsetUpstream");
- unsetUpstream.Click += (_, e) =>
- {
- if (Commands.Branch.SetUpstream(_fullpath, branch.Name, string.Empty))
- Task.Run(RefreshBranches);
-
+ if (PopupHost.CanCreatePopup())
+ PopupHost.ShowPopup(new SetUpstream(this, branch, remoteBranches));
e.Handled = true;
};
- tracking.Items.Add(new MenuItem() { Header = "-" });
- tracking.Items.Add(unsetUpstream);
-
menu.Items.Add(tracking);
}
diff --git a/src/ViewModels/SetUpstream.cs b/src/ViewModels/SetUpstream.cs
new file mode 100644
index 00000000..2741aa04
--- /dev/null
+++ b/src/ViewModels/SetUpstream.cs
@@ -0,0 +1,78 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+
+using Avalonia.Threading;
+
+namespace SourceGit.ViewModels
+{
+ public class SetUpstream : Popup
+ {
+ public Models.Branch Local
+ {
+ get;
+ private set;
+ }
+
+ public List RemoteBranches
+ {
+ get;
+ private set;
+ }
+
+ public Models.Branch SelectedRemoteBranch
+ {
+ get;
+ set;
+ }
+
+ public bool Unset
+ {
+ get => _unset;
+ set => SetProperty(ref _unset, value);
+ }
+
+ public SetUpstream(Repository repo, Models.Branch local, List remoteBranches)
+ {
+ _repo = repo;
+ Local = local;
+ RemoteBranches = remoteBranches;
+ Unset = false;
+
+ if (!string.IsNullOrEmpty(local.Upstream))
+ {
+ var upstream = remoteBranches.Find(x => x.FullName == local.Upstream);
+ if (upstream != null)
+ SelectedRemoteBranch = upstream;
+ }
+
+ if (SelectedRemoteBranch == null)
+ {
+ var upstream = remoteBranches.Find(x => x.Name == local.Name);
+ if (upstream != null)
+ SelectedRemoteBranch = upstream;
+ }
+
+ View = new Views.SetUpstream() { DataContext = this };
+ }
+
+ public override Task Sure()
+ {
+ SetProgressDescription("Setting upstream...");
+
+ var upstream = (_unset || SelectedRemoteBranch == null) ? string.Empty : SelectedRemoteBranch.FullName;
+ if (upstream == Local.Upstream)
+ return null;
+
+ return Task.Run(() =>
+ {
+ var succ = Commands.Branch.SetUpstream(_repo.FullPath, Local.Name, upstream.Replace("refs/remotes/", ""));
+ if (succ)
+ _repo.RefreshBranches();
+ return true;
+ });
+ }
+
+ private Repository _repo;
+ private bool _unset = false;
+ }
+}
diff --git a/src/Views/SetUpstream.axaml b/src/Views/SetUpstream.axaml
new file mode 100644
index 00000000..9acc4d74
--- /dev/null
+++ b/src/Views/SetUpstream.axaml
@@ -0,0 +1,56 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Views/SetUpstream.axaml.cs b/src/Views/SetUpstream.axaml.cs
new file mode 100644
index 00000000..e7b7f356
--- /dev/null
+++ b/src/Views/SetUpstream.axaml.cs
@@ -0,0 +1,12 @@
+using Avalonia.Controls;
+
+namespace SourceGit.Views
+{
+ public partial class SetUpstream : UserControl
+ {
+ public SetUpstream()
+ {
+ InitializeComponent();
+ }
+ }
+}