mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-21 04:04:59 +00:00
refactor: rewrite checkout/create branch with submodules
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
e446e97f28
commit
0f6c8976af
8 changed files with 136 additions and 65 deletions
|
@ -11,18 +11,27 @@ namespace SourceGit.Commands
|
|||
Context = repo;
|
||||
}
|
||||
|
||||
public bool Branch(string branch)
|
||||
public bool Branch(string branch, bool force)
|
||||
{
|
||||
Args = $"checkout --progress {branch}";
|
||||
var option = force ? "--force" : string.Empty;
|
||||
Args = $"checkout {option} --progress {branch}";
|
||||
return Exec();
|
||||
}
|
||||
|
||||
public bool Branch(string branch, string basedOn)
|
||||
public bool Branch(string branch, string basedOn, bool force)
|
||||
{
|
||||
var option = force ? "--force" : string.Empty;
|
||||
Args = $"checkout --progress -b {branch} {basedOn}";
|
||||
return Exec();
|
||||
}
|
||||
|
||||
public bool Commit(string commitId, bool force)
|
||||
{
|
||||
var option = force ? "--force" : string.Empty;
|
||||
Args = $"checkout {option} --detach --progress {commitId}";
|
||||
return Exec();
|
||||
}
|
||||
|
||||
public bool UseTheirs(List<string> files)
|
||||
{
|
||||
var builder = new StringBuilder();
|
||||
|
@ -56,11 +65,5 @@ namespace SourceGit.Commands
|
|||
Args = $"checkout --no-overlay {revision} -- \"{file}\"";
|
||||
return Exec();
|
||||
}
|
||||
|
||||
public bool Commit(string commitId)
|
||||
{
|
||||
Args = $"checkout --detach --progress {commitId}";
|
||||
return Exec();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue