From 7262437385a3f8043d31873f66ddfacc796c6282 Mon Sep 17 00:00:00 2001 From: leo Date: Sun, 6 Oct 2024 21:48:26 +0800 Subject: [PATCH] ux: new style for pushing a new branch to remote --- src/ViewModels/Push.cs | 11 +++++------ src/Views/Push.axaml | 10 +++++++++- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/ViewModels/Push.cs b/src/ViewModels/Push.cs index acbb1b1d..004ae7b6 100644 --- a/src/ViewModels/Push.cs +++ b/src/ViewModels/Push.cs @@ -26,7 +26,6 @@ namespace SourceGit.ViewModels public List LocalBranches { get; - private set; } public List Remotes @@ -157,7 +156,7 @@ namespace SourceGit.ViewModels { _repo.SetWatcherEnabled(false); - var remoteBranchName = _selectedRemoteBranch.Name.Replace(" (new)", ""); + var remoteBranchName = _selectedRemoteBranch.Name; ProgressDescription = $"Push {_selectedLocalBranch.Name} -> {_selectedRemote.Name}/{remoteBranchName} ..."; return Task.Run(() => @@ -187,7 +186,7 @@ namespace SourceGit.ViewModels branches.Add(branch); } - // If selected local branch has upstream branch. Try to find it in current remote branches. + // If selected local branch has upstream. Try to find it in current remote branches. if (!string.IsNullOrEmpty(_selectedLocalBranch.Upstream)) { foreach (var branch in branches) @@ -201,7 +200,7 @@ namespace SourceGit.ViewModels } } - // Find best remote branch by name. + // Try to find a remote branch with the same name of selected local branch. foreach (var branch in branches) { if (_selectedLocalBranch.Name == branch.Name) @@ -215,7 +214,7 @@ namespace SourceGit.ViewModels // Add a fake new branch. var fake = new Models.Branch() { - Name = $"{_selectedLocalBranch.Name} (new)", + Name = _selectedLocalBranch.Name, Remote = _selectedRemote.Name, }; branches.Add(fake); @@ -226,7 +225,7 @@ namespace SourceGit.ViewModels private readonly Repository _repo = null; private Models.Branch _selectedLocalBranch = null; private Models.Remote _selectedRemote = null; - private List _remoteBranches = new List(); + private List _remoteBranches = []; private Models.Branch _selectedRemoteBranch = null; private bool _isSetTrackOptionVisible = false; } diff --git a/src/Views/Push.axaml b/src/Views/Push.axaml index 2d1e9232..5abb08c0 100644 --- a/src/Views/Push.axaml +++ b/src/Views/Push.axaml @@ -65,7 +65,15 @@ - + + + +