mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-06-30 06:40:42 +00:00
code_style: general cleanup (#1469)
This commit is contained in:
parent
e5eced566b
commit
1acf2a14df
55 changed files with 138 additions and 277 deletions
|
@ -95,7 +95,7 @@ namespace SourceGit
|
|||
builder.Append($"App Start Time: {Process.GetCurrentProcess().StartTime}\n");
|
||||
builder.Append($"Exception Time: {DateTime.Now}\n");
|
||||
builder.Append($"Memory Usage: {Process.GetCurrentProcess().PrivateMemorySize64 / 1024 / 1024} MB\n");
|
||||
builder.Append($"---------------------------\n\n");
|
||||
builder.Append("---------------------------\n\n");
|
||||
builder.Append(ex);
|
||||
|
||||
var time = DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss");
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace SourceGit.Commands
|
|||
var cmd = new Command();
|
||||
cmd.WorkingDirectory = repo;
|
||||
cmd.Context = repo;
|
||||
cmd.Args = $"branch --show-current";
|
||||
cmd.Args = "branch --show-current";
|
||||
return cmd.ReadToEnd().StdOut.Trim();
|
||||
}
|
||||
|
||||
|
|
|
@ -169,18 +169,12 @@ namespace SourceGit.Commands
|
|||
}
|
||||
|
||||
// Force using this app as git editor.
|
||||
switch (Editor)
|
||||
start.Arguments += Editor switch
|
||||
{
|
||||
case EditorType.CoreEditor:
|
||||
start.Arguments += $"-c core.editor=\"\\\"{selfExecFile}\\\" --core-editor\" ";
|
||||
break;
|
||||
case EditorType.RebaseEditor:
|
||||
start.Arguments += $"-c core.editor=\"\\\"{selfExecFile}\\\" --rebase-message-editor\" -c sequence.editor=\"\\\"{selfExecFile}\\\" --rebase-todo-editor\" -c rebase.abbreviateCommands=true ";
|
||||
break;
|
||||
default:
|
||||
start.Arguments += "-c core.editor=true ";
|
||||
break;
|
||||
}
|
||||
EditorType.CoreEditor => $"-c core.editor=\"\\\"{selfExecFile}\\\" --core-editor\" ",
|
||||
EditorType.RebaseEditor => $"-c core.editor=\"\\\"{selfExecFile}\\\" --rebase-message-editor\" -c sequence.editor=\"\\\"{selfExecFile}\\\" --rebase-todo-editor\" -c rebase.abbreviateCommands=true ",
|
||||
_ => "-c core.editor=true ",
|
||||
};
|
||||
|
||||
// Append command args
|
||||
start.Arguments += Args;
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace SourceGit.Commands
|
|||
var starter = new ProcessStartInfo();
|
||||
starter.WorkingDirectory = repo;
|
||||
starter.FileName = Native.OS.GitExecutable;
|
||||
starter.Arguments = $"lfs smudge";
|
||||
starter.Arguments = "lfs smudge";
|
||||
starter.UseShellExecute = false;
|
||||
starter.CreateNoWindow = true;
|
||||
starter.WindowStyle = ProcessWindowStyle.Hidden;
|
||||
|
|
|
@ -51,21 +51,14 @@ namespace SourceGit.Commands
|
|||
obj.Type = Models.ObjectType.Blob;
|
||||
obj.Path = match.Groups[3].Value;
|
||||
|
||||
switch (match.Groups[1].Value)
|
||||
obj.Type = match.Groups[1].Value switch
|
||||
{
|
||||
case "blob":
|
||||
obj.Type = Models.ObjectType.Blob;
|
||||
break;
|
||||
case "tree":
|
||||
obj.Type = Models.ObjectType.Tree;
|
||||
break;
|
||||
case "tag":
|
||||
obj.Type = Models.ObjectType.Tag;
|
||||
break;
|
||||
case "commit":
|
||||
obj.Type = Models.ObjectType.Commit;
|
||||
break;
|
||||
}
|
||||
"blob" => Models.ObjectType.Blob,
|
||||
"tree" => Models.ObjectType.Tree,
|
||||
"tag" => Models.ObjectType.Tag,
|
||||
"commit" => Models.ObjectType.Commit,
|
||||
_ => obj.Type,
|
||||
};
|
||||
|
||||
_objects.Add(obj);
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace SourceGit.Commands
|
|||
{
|
||||
WorkingDirectory = repo;
|
||||
Context = repo;
|
||||
Args = $"stash list -z --no-show-signature --format=\"%H%n%P%n%ct%n%gd%n%B\"";
|
||||
Args = "stash list -z --no-show-signature --format=\"%H%n%P%n%ct%n%gd%n%B\"";
|
||||
}
|
||||
|
||||
public List<Models.Stash> Result()
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace SourceGit.Commands
|
|||
if (isLFSFiltered)
|
||||
{
|
||||
var pointerStream = QueryFileContent.Run(repo, revision, file);
|
||||
ExecCmd(repo, $"lfs smudge", saveTo, pointerStream);
|
||||
ExecCmd(repo, "lfs smudge", saveTo, pointerStream);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -8,15 +8,12 @@ namespace SourceGit.Converters
|
|||
public static readonly FuncValueConverter<Models.FilterMode, IBrush> ToBorderBrush =
|
||||
new FuncValueConverter<Models.FilterMode, IBrush>(v =>
|
||||
{
|
||||
switch (v)
|
||||
return v switch
|
||||
{
|
||||
case Models.FilterMode.Included:
|
||||
return Brushes.Green;
|
||||
case Models.FilterMode.Excluded:
|
||||
return Brushes.Red;
|
||||
default:
|
||||
return Brushes.Transparent;
|
||||
}
|
||||
Models.FilterMode.Included => Brushes.Green,
|
||||
Models.FilterMode.Excluded => Brushes.Red,
|
||||
_ => Brushes.Transparent,
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,42 +8,19 @@ namespace SourceGit.Converters
|
|||
public static readonly FuncValueConverter<Models.InteractiveRebaseAction, IBrush> ToIconBrush =
|
||||
new FuncValueConverter<Models.InteractiveRebaseAction, IBrush>(v =>
|
||||
{
|
||||
switch (v)
|
||||
return v switch
|
||||
{
|
||||
case Models.InteractiveRebaseAction.Pick:
|
||||
return Brushes.Green;
|
||||
case Models.InteractiveRebaseAction.Edit:
|
||||
return Brushes.Orange;
|
||||
case Models.InteractiveRebaseAction.Reword:
|
||||
return Brushes.Orange;
|
||||
case Models.InteractiveRebaseAction.Squash:
|
||||
return Brushes.LightGray;
|
||||
case Models.InteractiveRebaseAction.Fixup:
|
||||
return Brushes.LightGray;
|
||||
default:
|
||||
return Brushes.Red;
|
||||
}
|
||||
Models.InteractiveRebaseAction.Pick => Brushes.Green,
|
||||
Models.InteractiveRebaseAction.Edit => Brushes.Orange,
|
||||
Models.InteractiveRebaseAction.Reword => Brushes.Orange,
|
||||
Models.InteractiveRebaseAction.Squash => Brushes.LightGray,
|
||||
Models.InteractiveRebaseAction.Fixup => Brushes.LightGray,
|
||||
_ => Brushes.Red,
|
||||
};
|
||||
});
|
||||
|
||||
public static readonly FuncValueConverter<Models.InteractiveRebaseAction, string> ToName =
|
||||
new FuncValueConverter<Models.InteractiveRebaseAction, string>(v =>
|
||||
{
|
||||
switch (v)
|
||||
{
|
||||
case Models.InteractiveRebaseAction.Pick:
|
||||
return "Pick";
|
||||
case Models.InteractiveRebaseAction.Edit:
|
||||
return "Edit";
|
||||
case Models.InteractiveRebaseAction.Reword:
|
||||
return "Reword";
|
||||
case Models.InteractiveRebaseAction.Squash:
|
||||
return "Squash";
|
||||
case Models.InteractiveRebaseAction.Fixup:
|
||||
return "Fixup";
|
||||
default:
|
||||
return "Drop";
|
||||
}
|
||||
});
|
||||
new FuncValueConverter<Models.InteractiveRebaseAction, string>(v => v.ToString());
|
||||
|
||||
public static readonly FuncValueConverter<Models.InteractiveRebaseAction, bool> CanEditMessage =
|
||||
new FuncValueConverter<Models.InteractiveRebaseAction, bool>(v => v == Models.InteractiveRebaseAction.Reword || v == Models.InteractiveRebaseAction.Squash);
|
||||
|
|
|
@ -185,7 +185,7 @@ namespace SourceGit.Models
|
|||
{
|
||||
try
|
||||
{
|
||||
Bitmap image = null;
|
||||
Bitmap image;
|
||||
|
||||
using (var stream = File.OpenRead(file))
|
||||
{
|
||||
|
|
|
@ -13,21 +13,13 @@ namespace SourceGit.Models
|
|||
{
|
||||
get
|
||||
{
|
||||
switch (VerifyResult)
|
||||
return VerifyResult switch
|
||||
{
|
||||
case 'G':
|
||||
case 'U':
|
||||
return Brushes.Green;
|
||||
case 'X':
|
||||
case 'Y':
|
||||
case 'R':
|
||||
return Brushes.DarkOrange;
|
||||
case 'B':
|
||||
case 'E':
|
||||
return Brushes.Red;
|
||||
default:
|
||||
return Brushes.Transparent;
|
||||
}
|
||||
'G' or 'U' => Brushes.Green,
|
||||
'X' or 'Y' or 'R' => Brushes.DarkOrange,
|
||||
'B' or 'E' => Brushes.Red,
|
||||
_ => Brushes.Transparent,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,25 +27,17 @@ namespace SourceGit.Models
|
|||
{
|
||||
get
|
||||
{
|
||||
switch (VerifyResult)
|
||||
return VerifyResult switch
|
||||
{
|
||||
case 'G':
|
||||
return "Good signature.";
|
||||
case 'U':
|
||||
return "Good signature with unknown validity.";
|
||||
case 'X':
|
||||
return "Good signature but has expired.";
|
||||
case 'Y':
|
||||
return "Good signature made by expired key.";
|
||||
case 'R':
|
||||
return "Good signature made by a revoked key.";
|
||||
case 'B':
|
||||
return "Bad signature.";
|
||||
case 'E':
|
||||
return "Signature cannot be checked.";
|
||||
default:
|
||||
return "No signature.";
|
||||
}
|
||||
'G' => "Good signature.",
|
||||
'U' => "Good signature with unknown validity.",
|
||||
'X' => "Good signature but has expired.",
|
||||
'Y' => "Good signature made by expired key.",
|
||||
'R' => "Good signature made by a revoked key.",
|
||||
'B' => "Bad signature.",
|
||||
'E' => "Signature cannot be checked.",
|
||||
_ => "No signature.",
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ namespace SourceGit.Models
|
|||
rs.HasChanges = true;
|
||||
break;
|
||||
}
|
||||
else if (isOldSide)
|
||||
if (isOldSide)
|
||||
{
|
||||
rs.HasLeftChanges = true;
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ namespace SourceGit.Models
|
|||
rs.HasChanges = true;
|
||||
break;
|
||||
}
|
||||
else if (isOldSide)
|
||||
if (isOldSide)
|
||||
{
|
||||
rs.HasChanges = true;
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ namespace SourceGit.Models
|
|||
if (revert)
|
||||
{
|
||||
var totalLines = Lines.Count - 1;
|
||||
builder.Append($"@@ -0,").Append(totalLines - additions).Append(" +0,").Append(totalLines).Append(" @@");
|
||||
builder.Append("@@ -0,").Append(totalLines - additions).Append(" +0,").Append(totalLines).Append(" @@");
|
||||
for (int i = 1; i <= totalLines; i++)
|
||||
{
|
||||
var line = Lines[i];
|
||||
|
@ -645,12 +645,6 @@ namespace SourceGit.Models
|
|||
|
||||
public class NoOrEOLChange;
|
||||
|
||||
public class FileModeDiff
|
||||
{
|
||||
public string Old { get; set; } = string.Empty;
|
||||
public string New { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public class SubmoduleDiff
|
||||
{
|
||||
public RevisionSubmodule Old { get; set; } = null;
|
||||
|
|
|
@ -30,17 +30,13 @@
|
|||
|
||||
public string GetPrefix(GitFlowBranchType type)
|
||||
{
|
||||
switch (type)
|
||||
return type switch
|
||||
{
|
||||
case GitFlowBranchType.Feature:
|
||||
return FeaturePrefix;
|
||||
case GitFlowBranchType.Release:
|
||||
return ReleasePrefix;
|
||||
case GitFlowBranchType.Hotfix:
|
||||
return HotfixPrefix;
|
||||
default:
|
||||
return string.Empty;
|
||||
}
|
||||
GitFlowBranchType.Feature => FeaturePrefix,
|
||||
GitFlowBranchType.Release => ReleasePrefix,
|
||||
GitFlowBranchType.Hotfix => HotfixPrefix,
|
||||
_ => string.Empty,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -177,18 +177,10 @@ namespace SourceGit.Models
|
|||
{
|
||||
var server = new Uri(_server);
|
||||
var key = new ApiKeyCredential(_apiKey);
|
||||
var client = null as ChatClient;
|
||||
if (_server.Contains("openai.azure.com/", StringComparison.Ordinal))
|
||||
{
|
||||
var azure = new AzureOpenAIClient(server, key);
|
||||
client = azure.GetChatClient(_model);
|
||||
}
|
||||
else
|
||||
{
|
||||
var openai = new OpenAIClient(key, new() { Endpoint = server });
|
||||
client = openai.GetChatClient(_model);
|
||||
}
|
||||
|
||||
var oaiClient = _server.Contains("openai.azure.com/", StringComparison.Ordinal)
|
||||
? new AzureOpenAIClient(server, key)
|
||||
: new OpenAIClient(key, new() { Endpoint = server });
|
||||
var client = oaiClient.GetChatClient(_model);
|
||||
var messages = new List<ChatMessage>();
|
||||
messages.Add(_model.Equals("o1-mini", StringComparison.Ordinal) ? new UserChatMessage(prompt) : new SystemChatMessage(prompt));
|
||||
messages.Add(new UserChatMessage(question));
|
||||
|
|
|
@ -57,21 +57,15 @@ namespace SourceGit.Native
|
|||
|
||||
public string FindTerminal(Models.ShellOrTerminal shell)
|
||||
{
|
||||
switch (shell.Type)
|
||||
return shell.Type switch
|
||||
{
|
||||
case "mac-terminal":
|
||||
return "Terminal";
|
||||
case "iterm2":
|
||||
return "iTerm";
|
||||
case "warp":
|
||||
return "Warp";
|
||||
case "ghostty":
|
||||
return "Ghostty";
|
||||
case "kitty":
|
||||
return "kitty";
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
"mac-terminal" => "Terminal",
|
||||
"iterm2" => "iTerm",
|
||||
"warp" => "Warp",
|
||||
"ghostty" => "Ghostty",
|
||||
"kitty" => "kitty",
|
||||
_ => string.Empty,
|
||||
};
|
||||
}
|
||||
|
||||
public List<Models.ExternalTool> FindExternalTools()
|
||||
|
|
|
@ -165,7 +165,7 @@ namespace SourceGit.Native
|
|||
public static void OpenTerminal(string workdir)
|
||||
{
|
||||
if (string.IsNullOrEmpty(ShellOrTerminal))
|
||||
App.RaiseException(workdir, $"Terminal is not specified! Please confirm that the correct shell/terminal has been configured.");
|
||||
App.RaiseException(workdir, "Terminal is not specified! Please confirm that the correct shell/terminal has been configured.");
|
||||
else
|
||||
_backend.OpenTerminal(workdir);
|
||||
}
|
||||
|
|
|
@ -94,27 +94,18 @@ namespace SourceGit.Native
|
|||
y = 2;
|
||||
|
||||
var zone = y * 3 + x;
|
||||
switch (zone)
|
||||
return zone switch
|
||||
{
|
||||
case 0:
|
||||
return 13; // HTTOPLEFT
|
||||
case 1:
|
||||
return 12; // HTTOP
|
||||
case 2:
|
||||
return 14; // HTTOPRIGHT
|
||||
case 3:
|
||||
return 10; // HTLEFT
|
||||
case 4:
|
||||
return 1; // HTCLIENT
|
||||
case 5:
|
||||
return 11; // HTRIGHT
|
||||
case 6:
|
||||
return 16; // HTBOTTOMLEFT
|
||||
case 7:
|
||||
return 15; // HTBOTTOM
|
||||
default:
|
||||
return 17; // HTBOTTOMRIGHT
|
||||
}
|
||||
0 => 13, // HTTOPLEFT
|
||||
1 => 12, // HTTOP
|
||||
2 => 14, // HTTOPRIGHT
|
||||
3 => 10, // HTLEFT
|
||||
4 => 1, // HTCLIENT
|
||||
5 => 11, // HTRIGHT
|
||||
6 => 16, // HTBOTTOMLEFT
|
||||
7 => 15, // HTBOTTOM
|
||||
_ => 17,
|
||||
};
|
||||
}
|
||||
|
||||
return IntPtr.Zero;
|
||||
|
@ -211,7 +202,7 @@ namespace SourceGit.Native
|
|||
{
|
||||
if (!File.Exists(OS.ShellOrTerminal))
|
||||
{
|
||||
App.RaiseException(workdir, $"Terminal is not specified! Please confirm that the correct shell/terminal has been configured.");
|
||||
App.RaiseException(workdir, "Terminal is not specified! Please confirm that the correct shell/terminal has been configured.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ namespace SourceGit.ViewModels
|
|||
var updateSubmodules = IsRecurseSubmoduleVisible && RecurseSubmodules;
|
||||
return Task.Run(() =>
|
||||
{
|
||||
var succ = false;
|
||||
bool succ;
|
||||
var needPopStash = false;
|
||||
|
||||
if (!_repo.ConfirmCheckoutBranch())
|
||||
|
|
|
@ -44,7 +44,7 @@ namespace SourceGit.ViewModels
|
|||
var updateSubmodules = IsRecurseSubmoduleVisible && RecurseSubmodules;
|
||||
return Task.Run(() =>
|
||||
{
|
||||
var succ = false;
|
||||
bool succ;
|
||||
var needPop = false;
|
||||
|
||||
if (!_repo.ConfirmCheckoutBranch())
|
||||
|
|
|
@ -67,7 +67,7 @@ namespace SourceGit.ViewModels
|
|||
{
|
||||
_repo.SetWatcherEnabled(false);
|
||||
_repo.ClearCommitMessage();
|
||||
ProgressDescription = $"Cherry-Pick commit(s) ...";
|
||||
ProgressDescription = "Cherry-Pick commit(s) ...";
|
||||
|
||||
var log = _repo.CreateLog("Cherry-Pick");
|
||||
Use(log);
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace SourceGit.ViewModels
|
|||
{
|
||||
get;
|
||||
private set;
|
||||
} = string.Empty;
|
||||
}
|
||||
|
||||
public DateTime StartTime
|
||||
{
|
||||
|
|
|
@ -129,7 +129,7 @@ namespace SourceGit.ViewModels
|
|||
var updateSubmodules = IsRecurseSubmoduleVisible && RecurseSubmodules;
|
||||
return Task.Run(() =>
|
||||
{
|
||||
bool succ = false;
|
||||
bool succ;
|
||||
|
||||
if (CheckoutAfterCreated && !_repo.ConfirmCheckoutBranch())
|
||||
{
|
||||
|
|
|
@ -284,18 +284,12 @@ namespace SourceGit.ViewModels
|
|||
if (_viewContent is FileHistoriesSingleRevision singleRevision)
|
||||
_prevIsDiffMode = singleRevision.IsDiffMode;
|
||||
|
||||
switch (SelectedCommits.Count)
|
||||
ViewContent = SelectedCommits.Count switch
|
||||
{
|
||||
case 1:
|
||||
ViewContent = new FileHistoriesSingleRevision(_repo, file, SelectedCommits[0], _prevIsDiffMode);
|
||||
break;
|
||||
case 2:
|
||||
ViewContent = new FileHistoriesCompareRevisions(_repo, file, SelectedCommits[0], SelectedCommits[1]);
|
||||
break;
|
||||
default:
|
||||
ViewContent = SelectedCommits.Count;
|
||||
break;
|
||||
}
|
||||
1 => new FileHistoriesSingleRevision(_repo, file, SelectedCommits[0], _prevIsDiffMode),
|
||||
2 => new FileHistoriesCompareRevisions(_repo, file, SelectedCommits[0], SelectedCommits[1]),
|
||||
_ => SelectedCommits.Count,
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -27,25 +27,13 @@ namespace SourceGit.ViewModels
|
|||
{
|
||||
var ext = (Path.GetExtension(file) ?? ".invalid_img").ToLower(CultureInfo.CurrentCulture);
|
||||
|
||||
switch (ext)
|
||||
return ext switch
|
||||
{
|
||||
case ".ico":
|
||||
case ".bmp":
|
||||
case ".gif":
|
||||
case ".jpg":
|
||||
case ".jpeg":
|
||||
case ".png":
|
||||
case ".webp":
|
||||
return Models.ImageDecoder.Builtin;
|
||||
case ".tga":
|
||||
case ".dds":
|
||||
return Models.ImageDecoder.Pfim;
|
||||
case ".tif":
|
||||
case ".tiff":
|
||||
return Models.ImageDecoder.Tiff;
|
||||
default:
|
||||
return Models.ImageDecoder.None;
|
||||
}
|
||||
".ico" or ".bmp" or ".gif" or ".jpg" or ".jpeg" or ".png" or ".webp" => Models.ImageDecoder.Builtin,
|
||||
".tga" or ".dds" => Models.ImageDecoder.Pfim,
|
||||
".tif" or ".tiff" => Models.ImageDecoder.Tiff,
|
||||
_ => Models.ImageDecoder.None,
|
||||
};
|
||||
}
|
||||
|
||||
public static ImageSource FromFile(string fullpath, Models.ImageDecoder decoder)
|
||||
|
|
|
@ -112,11 +112,9 @@ namespace SourceGit.ViewModels
|
|||
HeadName = HeadName.Substring(10);
|
||||
|
||||
var stoppedSHAPath = Path.Combine(repo.GitDir, "rebase-merge", "stopped-sha");
|
||||
var stoppedSHA = string.Empty;
|
||||
if (File.Exists(stoppedSHAPath))
|
||||
stoppedSHA = File.ReadAllText(stoppedSHAPath).Trim();
|
||||
else
|
||||
stoppedSHA = new Commands.QueryRevisionByRefName(repo.FullPath, HeadName).Result();
|
||||
var stoppedSHA = File.Exists(stoppedSHAPath)
|
||||
? File.ReadAllText(stoppedSHAPath).Trim()
|
||||
: new Commands.QueryRevisionByRefName(repo.FullPath, HeadName).Result();
|
||||
|
||||
if (!string.IsNullOrEmpty(stoppedSHA))
|
||||
StoppedAt = new Commands.QuerySingleCommit(repo.FullPath, stoppedSHA).Result() ?? new Models.Commit() { SHA = stoppedSHA };
|
||||
|
@ -132,7 +130,7 @@ namespace SourceGit.ViewModels
|
|||
WorkingDirectory = _repo,
|
||||
Context = _repo,
|
||||
Editor = Commands.Command.EditorType.RebaseEditor,
|
||||
Args = $"rebase --continue",
|
||||
Args = "rebase --continue",
|
||||
}.Exec();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ namespace SourceGit.ViewModels
|
|||
|
||||
return Task.Run(() =>
|
||||
{
|
||||
var succ = false;
|
||||
bool succ;
|
||||
var current = _repo.CurrentBranch;
|
||||
|
||||
var masterBranch = _repo.Branches.Find(x => x.IsLocal && x.Name.Equals(_master, StringComparison.Ordinal));
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace SourceGit.ViewModels
|
|||
public override Task<bool> Sure()
|
||||
{
|
||||
_repo.SetWatcherEnabled(false);
|
||||
ProgressDescription = $"Fetching LFS objects from remote ...";
|
||||
ProgressDescription = "Fetching LFS objects from remote ...";
|
||||
|
||||
var log = _repo.CreateLog("LFS Fetch");
|
||||
Use(log);
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace SourceGit.ViewModels
|
|||
public override Task<bool> Sure()
|
||||
{
|
||||
_repo.SetWatcherEnabled(false);
|
||||
ProgressDescription = $"Pull LFS objects from remote ...";
|
||||
ProgressDescription = "Pull LFS objects from remote ...";
|
||||
|
||||
var log = _repo.CreateLog("LFS Pull");
|
||||
Use(log);
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace SourceGit.ViewModels
|
|||
public override Task<bool> Sure()
|
||||
{
|
||||
_repo.SetWatcherEnabled(false);
|
||||
ProgressDescription = $"Push LFS objects to remote ...";
|
||||
ProgressDescription = "Push LFS objects to remote ...";
|
||||
|
||||
var log = _repo.CreateLog("LFS Push");
|
||||
Use(log);
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace SourceGit.ViewModels
|
|||
public override Task<bool> Sure()
|
||||
{
|
||||
_repo.SetWatcherEnabled(false);
|
||||
ProgressDescription = $"Pushing tag ...";
|
||||
ProgressDescription = "Pushing tag ...";
|
||||
|
||||
var log = _repo.CreateLog("Push Tag");
|
||||
Use(log);
|
||||
|
|
|
@ -75,18 +75,12 @@ namespace SourceGit.ViewModels
|
|||
{
|
||||
if (SetProperty(ref _selectedViewIndex, value))
|
||||
{
|
||||
switch (value)
|
||||
SelectedView = value switch
|
||||
{
|
||||
case 1:
|
||||
SelectedView = _workingCopy;
|
||||
break;
|
||||
case 2:
|
||||
SelectedView = _stashesPage;
|
||||
break;
|
||||
default:
|
||||
SelectedView = _histories;
|
||||
break;
|
||||
}
|
||||
1 => _workingCopy,
|
||||
2 => _stashesPage,
|
||||
_ => _histories,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -829,7 +823,7 @@ namespace SourceGit.ViewModels
|
|||
if (!CanCreatePopup())
|
||||
return;
|
||||
|
||||
var popup = null as ExecuteCustomAction;
|
||||
ExecuteCustomAction popup;
|
||||
if (scope is Models.Branch b)
|
||||
popup = new ExecuteCustomAction(this, action, b);
|
||||
else if (scope is Models.Commit c)
|
||||
|
@ -877,7 +871,7 @@ namespace SourceGit.ViewModels
|
|||
|
||||
Task.Run(() =>
|
||||
{
|
||||
var visible = null as List<Models.Commit>;
|
||||
List<Models.Commit> visible;
|
||||
var method = (Models.CommitSearchMethod)_searchCommitFilterType;
|
||||
|
||||
if (method == Models.CommitSearchMethod.BySHA)
|
||||
|
@ -1733,7 +1727,7 @@ namespace SourceGit.ViewModels
|
|||
var log = CreateLog("Install LFS");
|
||||
var succ = new Commands.LFS(_fullpath).Install(log);
|
||||
if (succ)
|
||||
App.SendNotification(_fullpath, $"LFS enabled successfully!");
|
||||
App.SendNotification(_fullpath, "LFS enabled successfully!");
|
||||
|
||||
log.Complete();
|
||||
e.Handled = true;
|
||||
|
|
|
@ -48,6 +48,6 @@ namespace SourceGit.ViewModels
|
|||
}
|
||||
|
||||
private readonly Repository _repo = null;
|
||||
private readonly string _revision = string.Empty;
|
||||
private readonly string _revision;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace SourceGit.ViewModels
|
|||
return null;
|
||||
|
||||
_repo.SetWatcherEnabled(false);
|
||||
ProgressDescription = $"Editing head commit message ...";
|
||||
ProgressDescription = "Editing head commit message ...";
|
||||
|
||||
var log = _repo.CreateLog("Reword HEAD");
|
||||
Use(log);
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace SourceGit.ViewModels
|
|||
{
|
||||
var signOff = _repo.Settings.EnableSignOffForCommit;
|
||||
var autoStashed = false;
|
||||
var succ = false;
|
||||
bool succ;
|
||||
|
||||
if (_repo.LocalChangesCount > 0)
|
||||
{
|
||||
|
|
|
@ -53,7 +53,7 @@ namespace SourceGit.ViewModels
|
|||
public override Task<bool> Sure()
|
||||
{
|
||||
_repo.SetWatcherEnabled(false);
|
||||
ProgressDescription = $"Stash changes ...";
|
||||
ProgressDescription = "Stash changes ...";
|
||||
|
||||
var log = _repo.CreateLog("Stash Local Changes");
|
||||
Use(log);
|
||||
|
@ -62,7 +62,7 @@ namespace SourceGit.ViewModels
|
|||
{
|
||||
var mode = (DealWithChangesAfterStashing)ChangesAfterStashing;
|
||||
var keepIndex = mode == DealWithChangesAfterStashing.KeepIndex;
|
||||
var succ = false;
|
||||
bool succ;
|
||||
|
||||
if (!HasSelectedFiles)
|
||||
{
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:v="using:SourceGit.Views"
|
||||
xmlns:vm="using:SourceGit.ViewModels"
|
||||
xmlns:c="using:SourceGit.Converters"
|
||||
mc:Ignorable="d" d:DesignWidth="400" d:DesignHeight="120"
|
||||
x:Class="SourceGit.Views.AIAssistant"
|
||||
x:DataType="vm:AIAssistant"
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace SourceGit.Views
|
|||
{
|
||||
var folder = selected[0];
|
||||
var folderPath = folder is { Path: { IsAbsoluteUri: true } path } ? path.LocalPath : folder?.Path.ToString();
|
||||
TxtLocation.Text = folderPath.TrimEnd(['\\', '/']);
|
||||
TxtLocation.Text = folderPath.TrimEnd('\\', '/');
|
||||
}
|
||||
}
|
||||
catch (Exception exception)
|
||||
|
|
|
@ -268,7 +268,7 @@ namespace SourceGit.Views
|
|||
}
|
||||
}
|
||||
|
||||
var target = treePath[treePath.Count - 1];
|
||||
var target = treePath[^1];
|
||||
BranchesPresenter.SelectedItem = target;
|
||||
BranchesPresenter.ScrollIntoView(target);
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:m="using:SourceGit.Models"
|
||||
xmlns:v="using:SourceGit.Views"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="SourceGit.Views.ChangeViewModeSwitcher"
|
||||
x:Name="ThisControl">
|
||||
|
|
|
@ -2,9 +2,7 @@
|
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:m="using:SourceGit.Models"
|
||||
xmlns:vm="using:SourceGit.ViewModels"
|
||||
xmlns:ac="using:Avalonia.Controls.Converters"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="SourceGit.Views.Checkout"
|
||||
x:DataType="vm:Checkout">
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:m="using:SourceGit.Models"
|
||||
xmlns:vm="using:SourceGit.ViewModels"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="SourceGit.Views.CheckoutAndFastForward"
|
||||
|
|
|
@ -186,7 +186,6 @@ namespace SourceGit.Views
|
|||
var fg = Foreground;
|
||||
var normalBG = UseGraphColor ? commit.Brush : Brushes.Gray;
|
||||
var labelSize = FontSize;
|
||||
var requiredWidth = 0.0;
|
||||
var requiredHeight = 16.0;
|
||||
var x = 0.0;
|
||||
var allowWrap = AllowWrap;
|
||||
|
@ -260,11 +259,9 @@ namespace SourceGit.Views
|
|||
}
|
||||
}
|
||||
|
||||
if (allowWrap && requiredHeight > 16.0)
|
||||
requiredWidth = availableSize.Width;
|
||||
else
|
||||
requiredWidth = x + 2;
|
||||
|
||||
var requiredWidth = allowWrap && requiredHeight > 16.0
|
||||
? availableSize.Width
|
||||
: x + 2;
|
||||
InvalidateVisual();
|
||||
return new Size(requiredWidth, requiredHeight);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
xmlns:vm="using:SourceGit.ViewModels"
|
||||
xmlns:v="using:SourceGit.Views"
|
||||
xmlns:c="using:SourceGit.Converters"
|
||||
xmlns:ac="using:Avalonia.Controls.Converters"
|
||||
mc:Ignorable="d" d:DesignWidth="500" d:DesignHeight="450"
|
||||
x:Class="SourceGit.Views.CreateBranch"
|
||||
x:DataType="vm:CreateBranch">
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:vm="using:SourceGit.ViewModels"
|
||||
xmlns:v="using:SourceGit.Views"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="SourceGit.Views.DeinitSubmodule"
|
||||
x:DataType="vm:DeinitSubmodule">
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:m="using:SourceGit.Models"
|
||||
xmlns:vm="using:SourceGit.ViewModels"
|
||||
xmlns:c="using:SourceGit.Converters"
|
||||
mc:Ignorable="d" d:DesignWidth="500" d:DesignHeight="450"
|
||||
x:Class="SourceGit.Views.GitFlowFinish"
|
||||
x:DataType="vm:GitFlowFinish">
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
xmlns:m="using:SourceGit.Models"
|
||||
xmlns:vm="using:SourceGit.ViewModels"
|
||||
xmlns:v="using:SourceGit.Views"
|
||||
xmlns:c="using:SourceGit.Converters"
|
||||
mc:Ignorable="d" d:DesignWidth="500" d:DesignHeight="450"
|
||||
x:Class="SourceGit.Views.GitFlowStart"
|
||||
x:DataType="vm:GitFlowStart">
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:v="using:SourceGit.Views"
|
||||
xmlns:vm="using:SourceGit.ViewModels"
|
||||
xmlns:c="using:SourceGit.Converters"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:m="using:SourceGit.Models"
|
||||
xmlns:vm="using:SourceGit.ViewModels"
|
||||
xmlns:ac="using:Avalonia.Controls.Converters"
|
||||
mc:Ignorable="d" d:DesignWidth="500" d:DesignHeight="450"
|
||||
x:Class="SourceGit.Views.Pull"
|
||||
x:DataType="vm:Pull">
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:m="using:SourceGit.Models"
|
||||
xmlns:vm="using:SourceGit.ViewModels"
|
||||
xmlns:c="using:SourceGit.Converters"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
|
|
|
@ -157,7 +157,7 @@ namespace SourceGit.Views
|
|||
{
|
||||
if (DataContext is ViewModels.Repository { CurrentBranch: not null } repo)
|
||||
{
|
||||
var repoView = TopLevel.GetTopLevel(this)?.FindDescendantOfType<Repository>(false);
|
||||
var repoView = TopLevel.GetTopLevel(this)?.FindDescendantOfType<Repository>();
|
||||
repoView?.LocalBranchTree?.Select(repo.CurrentBranch);
|
||||
|
||||
repo.NavigateToCommit(repo.CurrentBranch.Head);
|
||||
|
|
|
@ -25,12 +25,7 @@
|
|||
HorizontalAlignment="Stretch">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate DataType="m:DealWithChangesAfterStashing">
|
||||
<Grid Height="20">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Grid Height="20" ColumnDefinitions="Auto,*">
|
||||
<TextBlock Grid.Column="0" Text="{Binding Label}"/>
|
||||
<TextBlock Grid.Column="1" Text="{Binding Desc}" Margin="8,0" FontSize="11" Foreground="{DynamicResource Brush.FG2}"/>
|
||||
</Grid>
|
||||
|
|
|
@ -63,7 +63,7 @@ namespace SourceGit.Views
|
|||
if (string.IsNullOrEmpty(subject))
|
||||
return;
|
||||
|
||||
var typeface = new Typeface(FontFamily, FontStyle.Normal, FontWeight.Normal);
|
||||
var typeface = new Typeface(FontFamily);
|
||||
var foreground = Foreground;
|
||||
var x = 0.0;
|
||||
var h = Bounds.Height;
|
||||
|
@ -117,7 +117,7 @@ namespace SourceGit.Views
|
|||
|
||||
protected override Size MeasureOverride(Size availableSize)
|
||||
{
|
||||
var typeface = new Typeface(FontFamily, FontStyle.Normal, FontWeight.Normal);
|
||||
var typeface = new Typeface(FontFamily);
|
||||
var test = new FormattedText("fgl|", CultureInfo.CurrentCulture, FlowDirection.LeftToRight, typeface, FontSize, Brushes.White);
|
||||
var h = Math.Max(18, test.Height);
|
||||
return new Size(availableSize.Width, h);
|
||||
|
|
|
@ -225,7 +225,7 @@ namespace SourceGit.Views
|
|||
|
||||
var typeface = TextView.CreateTypeface();
|
||||
var test = new FormattedText(
|
||||
$"-",
|
||||
"-",
|
||||
CultureInfo.CurrentCulture,
|
||||
FlowDirection.LeftToRight,
|
||||
typeface,
|
||||
|
@ -332,17 +332,13 @@ namespace SourceGit.Views
|
|||
|
||||
private IBrush GetBrushByLineType(Models.TextDiffLineType type)
|
||||
{
|
||||
switch (type)
|
||||
return type switch
|
||||
{
|
||||
case Models.TextDiffLineType.None:
|
||||
return _presenter.EmptyContentBackground;
|
||||
case Models.TextDiffLineType.Added:
|
||||
return _presenter.AddedContentBackground;
|
||||
case Models.TextDiffLineType.Deleted:
|
||||
return _presenter.DeletedContentBackground;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
Models.TextDiffLineType.None => _presenter.EmptyContentBackground,
|
||||
Models.TextDiffLineType.Added => _presenter.AddedContentBackground,
|
||||
Models.TextDiffLineType.Deleted => _presenter.DeletedContentBackground,
|
||||
_ => null,
|
||||
};
|
||||
}
|
||||
|
||||
private ThemedTextDiffPresenter _presenter = null;
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:m="using:SourceGit.Models"
|
||||
xmlns:vm="using:SourceGit.ViewModels"
|
||||
xmlns:v="using:SourceGit.Views"
|
||||
xmlns:c="using:SourceGit.Converters"
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace SourceGit.Views
|
|||
{
|
||||
var container = control.FindDescendantOfType<ChangeCollectionContainer>();
|
||||
var selectedSingleFolder = string.Empty;
|
||||
if (container is { SelectedItems: { Count: 1 }, SelectedItem: ViewModels.ChangeTreeNode { IsFolder: true } node })
|
||||
if (container is { SelectedItems.Count: 1, SelectedItem: ViewModels.ChangeTreeNode { IsFolder: true } node })
|
||||
selectedSingleFolder = node.FullPath;
|
||||
|
||||
var menu = vm.CreateContextMenuForUnstagedChanges(selectedSingleFolder);
|
||||
|
@ -47,7 +47,7 @@ namespace SourceGit.Views
|
|||
{
|
||||
var container = control.FindDescendantOfType<ChangeCollectionContainer>();
|
||||
var selectedSingleFolder = string.Empty;
|
||||
if (container is { SelectedItems: { Count: 1 }, SelectedItem: ViewModels.ChangeTreeNode { IsFolder: true } node })
|
||||
if (container is { SelectedItems.Count: 1, SelectedItem: ViewModels.ChangeTreeNode { IsFolder: true } node })
|
||||
selectedSingleFolder = node.FullPath;
|
||||
|
||||
var menu = vm.CreateContextMenuForStagedChanges(selectedSingleFolder);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue