mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-23 21:24:59 +00:00
code_review: review for PR (#147)
* code style * localizations for zh_CN
This commit is contained in:
parent
e00bc4e630
commit
66f2aab6a7
11 changed files with 43 additions and 51 deletions
|
@ -223,7 +223,7 @@ namespace SourceGit.ViewModels
|
|||
lastFolder.Children.Add(new BranchTreeNode()
|
||||
{
|
||||
Name = Path.GetFileName(branch.Name),
|
||||
Type = branch.isHead ? BranchTreeNodeType.DetachedHead : BranchTreeNodeType.Branch,
|
||||
Type = branch.IsHead ? BranchTreeNodeType.DetachedHead : BranchTreeNodeType.Branch,
|
||||
Backend = branch,
|
||||
IsExpanded = false,
|
||||
IsFiltered = isFiltered,
|
||||
|
|
|
@ -4,7 +4,7 @@ namespace SourceGit.ViewModels
|
|||
{
|
||||
public class CheckoutCommit: Popup
|
||||
{
|
||||
public string Commit
|
||||
public Models.Commit Commit
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
|
@ -21,7 +21,7 @@ namespace SourceGit.ViewModels
|
|||
set => SetProperty(ref _autoStash, value);
|
||||
}
|
||||
|
||||
public CheckoutCommit(Repository repo, string commit)
|
||||
public CheckoutCommit(Repository repo, Models.Commit commit)
|
||||
{
|
||||
_repo = repo;
|
||||
Commit = commit;
|
||||
|
@ -31,7 +31,7 @@ namespace SourceGit.ViewModels
|
|||
public override Task<bool> Sure()
|
||||
{
|
||||
_repo.SetWatcherEnabled(false);
|
||||
ProgressDescription = $"Checkout Commit '{Commit}' ...";
|
||||
ProgressDescription = $"Checkout Commit '{Commit.SHA}' ...";
|
||||
|
||||
return Task.Run(() =>
|
||||
{
|
||||
|
@ -64,7 +64,7 @@ namespace SourceGit.ViewModels
|
|||
}
|
||||
|
||||
SetProgressDescription("Checkout commit ...");
|
||||
var rs = new Commands.Checkout(_repo.FullPath).Commit(Commit, SetProgressDescription);
|
||||
var rs = new Commands.Checkout(_repo.FullPath).Commit(Commit.SHA, SetProgressDescription);
|
||||
|
||||
if (needPopStash)
|
||||
{
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Data.Converters;
|
||||
using Avalonia.Platform.Storage;
|
||||
using Avalonia.Threading;
|
||||
|
||||
|
@ -238,15 +236,11 @@ namespace SourceGit.ViewModels
|
|||
menu.Items.Add(reset);
|
||||
|
||||
var checkoutCommit = new MenuItem();
|
||||
|
||||
var shortSha = Converters.StringConverters.ToShortSHA
|
||||
.Convert(commit.SHA, typeof(string), null, CultureInfo.CurrentCulture);
|
||||
|
||||
checkoutCommit.Header = new Views.NameHighlightedTextBlock("CommitCM.Checkout", shortSha);
|
||||
checkoutCommit.Header = new Views.NameHighlightedTextBlock("CommitCM.Checkout", commit.SHA.Substring(0, 10));
|
||||
checkoutCommit.Icon = App.CreateMenuIcon("Icons.Check");
|
||||
checkoutCommit.Click += (o, e) =>
|
||||
{
|
||||
_repo.CheckoutCommit(commit.SHA);
|
||||
_repo.CheckoutCommit(commit);
|
||||
e.Handled = true;
|
||||
};
|
||||
menu.Items.Add(checkoutCommit);
|
||||
|
|
|
@ -722,7 +722,7 @@ namespace SourceGit.ViewModels
|
|||
PopupHost.ShowAndStartPopup(new Checkout(this, branch));
|
||||
}
|
||||
|
||||
public void CheckoutCommit(string commit)
|
||||
public void CheckoutCommit(Models.Commit commit)
|
||||
{
|
||||
if (!PopupHost.CanCreatePopup())
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue