mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-21 04:04: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
|
@ -1,3 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
|
@ -6,13 +7,16 @@ namespace SourceGit.Commands {
|
|||
/// 检出
|
||||
/// </summary>
|
||||
public class Checkout : Command {
|
||||
private Action<string> handler = null;
|
||||
|
||||
public Checkout(string repo) {
|
||||
Cwd = repo;
|
||||
}
|
||||
|
||||
public bool Branch(string branch) {
|
||||
Args = $"checkout {branch}";
|
||||
public bool Branch(string branch, Action<string> onProgress) {
|
||||
Args = $"checkout --progress {branch}";
|
||||
TraitErrorAsOutput = true;
|
||||
handler = onProgress;
|
||||
return Exec();
|
||||
}
|
||||
|
||||
|
@ -42,5 +46,9 @@ namespace SourceGit.Commands {
|
|||
Args = builder.ToString();
|
||||
return Exec();
|
||||
}
|
||||
|
||||
public override void OnReadline(string line) {
|
||||
handler?.Invoke(line);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue