mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-22 04:34:59 +00:00
feature<Checkout>: add a status panel for checkout progress
This commit is contained in:
parent
001453d6ff
commit
67f5eed9a0
5 changed files with 64 additions and 24 deletions
|
@ -424,7 +424,7 @@ namespace SourceGit.Views.Widgets {
|
|||
if (node.Type == BranchNodeType.Branch) NavigateTo((node.Data as Models.Branch).Head);
|
||||
}
|
||||
|
||||
private async void OnTreeDoubleClick(object sender, MouseButtonEventArgs e) {
|
||||
private void OnTreeDoubleClick(object sender, MouseButtonEventArgs e) {
|
||||
var item = sender as Controls.TreeItem;
|
||||
if (item == null) return;
|
||||
|
||||
|
@ -434,9 +434,7 @@ namespace SourceGit.Views.Widgets {
|
|||
var branch = node.Data as Models.Branch;
|
||||
if (!branch.IsLocal || branch.IsCurrent) return;
|
||||
|
||||
Models.Watcher.SetEnabled(repo.Path, false);
|
||||
await Task.Run(() => new Commands.Checkout(repo.Path).Branch(branch.Name));
|
||||
Models.Watcher.SetEnabled(repo.Path, true);
|
||||
new Popups.Checkout(repo.Path, branch.Name).ShowAndStart();
|
||||
}
|
||||
|
||||
private void OnTreeContextMenuOpening(object sender, ContextMenuEventArgs e) {
|
||||
|
@ -510,10 +508,8 @@ namespace SourceGit.Views.Widgets {
|
|||
|
||||
var checkout = new MenuItem();
|
||||
checkout.Header = App.Text("BranchCM.Checkout", branch.Name);
|
||||
checkout.Click += async (o, e) => {
|
||||
Models.Watcher.SetEnabled(repo.Path, false);
|
||||
await Task.Run(() => new Commands.Checkout(repo.Path).Branch(branch.Name));
|
||||
Models.Watcher.SetEnabled(repo.Path, true);
|
||||
checkout.Click += (o, e) => {
|
||||
new Popups.Checkout(repo.Path, branch.Name).ShowAndStart();
|
||||
e.Handled = true;
|
||||
};
|
||||
menu.Items.Add(checkout);
|
||||
|
@ -676,14 +672,11 @@ namespace SourceGit.Views.Widgets {
|
|||
|
||||
var checkout = new MenuItem();
|
||||
checkout.Header = App.Text("BranchCM.Checkout", branch.Name);
|
||||
checkout.Click += async (o, e) => {
|
||||
checkout.Click += (o, e) => {
|
||||
foreach (var b in repo.Branches) {
|
||||
if (b.IsLocal && b.Upstream == branch.FullName) {
|
||||
if (b.IsCurrent) return;
|
||||
|
||||
Models.Watcher.SetEnabled(repo.Path, false);
|
||||
await Task.Run(() => new Commands.Checkout(repo.Path).Branch(b.Name));
|
||||
Models.Watcher.SetEnabled(repo.Path, true);
|
||||
new Popups.Checkout(repo.Path, b.Name).ShowAndStart();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue