mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-22 04:34:59 +00:00
refactor<*>: rewrite all codes...
This commit is contained in:
parent
89ff8aa744
commit
30ab8ae954
342 changed files with 17208 additions and 19633 deletions
39
src/Commands/Push.cs
Normal file
39
src/Commands/Push.cs
Normal file
|
@ -0,0 +1,39 @@
|
|||
using System;
|
||||
|
||||
namespace SourceGit.Commands {
|
||||
/// <summary>
|
||||
/// 推送
|
||||
/// </summary>
|
||||
public class Push : Command {
|
||||
private Action<string> handler = null;
|
||||
|
||||
public Push(string repo, string local, string remote, string remoteBranch, bool withTags, bool force, bool track, Action<string> onProgress) {
|
||||
Cwd = repo;
|
||||
TraitErrorAsOutput = true;
|
||||
handler = onProgress;
|
||||
Args = "-c credential.helper=manager push --progress --verbose ";
|
||||
|
||||
if (withTags) Args += "--tags ";
|
||||
if (track) Args += "-u ";
|
||||
if (force) Args += "--force-with-lease ";
|
||||
|
||||
Args += $"{remote} {local}:{remoteBranch}";
|
||||
}
|
||||
|
||||
public Push(string repo, string remote, string branch) {
|
||||
Cwd = repo;
|
||||
Args = $"-c credential.helper=manager push {remote} --delete {branch}";
|
||||
}
|
||||
|
||||
public Push(string repo, string remote, string tag, bool isDelete) {
|
||||
Cwd = repo;
|
||||
Args = $"-c credential.helper=manager push ";
|
||||
if (isDelete) Args += "--delete ";
|
||||
Args += $"{remote} refs/tags/{tag}";
|
||||
}
|
||||
|
||||
public override void OnReadline(string line) {
|
||||
handler?.Invoke(line);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue