mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-22 12:45:00 +00:00
enhance: Git LFS supports (#209)
* add a new context menu to push local LFS object to selected remote * supports to choose remote for fetch/pull/push/lock/unlock actions * auto select remote if there's only one remote
This commit is contained in:
parent
f18ecf53eb
commit
0c21bcd06a
14 changed files with 359 additions and 59 deletions
|
@ -55,14 +55,19 @@ namespace SourceGit.Commands
|
|||
return new SubCmd(_repo, $"lfs track {opt} \"{pattern}\"", null).Exec();
|
||||
}
|
||||
|
||||
public void Fetch(Action<string> outputHandler)
|
||||
public void Fetch(string remote, Action<string> outputHandler)
|
||||
{
|
||||
new SubCmd(_repo, $"lfs fetch", outputHandler).Exec();
|
||||
new SubCmd(_repo, $"lfs fetch {remote}", outputHandler).Exec();
|
||||
}
|
||||
|
||||
public void Pull(Action<string> outputHandler)
|
||||
public void Pull(string remote, Action<string> outputHandler)
|
||||
{
|
||||
new SubCmd(_repo, $"lfs pull", outputHandler).Exec();
|
||||
new SubCmd(_repo, $"lfs pull {remote}", outputHandler).Exec();
|
||||
}
|
||||
|
||||
public void Push(string remote, Action<string> outputHandler)
|
||||
{
|
||||
new SubCmd(_repo, $"lfs push {remote}", outputHandler).Exec();
|
||||
}
|
||||
|
||||
public void Prune(Action<string> outputHandler)
|
||||
|
@ -70,10 +75,10 @@ namespace SourceGit.Commands
|
|||
new SubCmd(_repo, "lfs prune", outputHandler).Exec();
|
||||
}
|
||||
|
||||
public List<Models.LFSLock> Locks()
|
||||
public List<Models.LFSLock> Locks(string remote)
|
||||
{
|
||||
var locks = new List<Models.LFSLock>();
|
||||
var cmd = new SubCmd(_repo, "lfs locks", null);
|
||||
var cmd = new SubCmd(_repo, $"lfs locks --remote={remote}", null);
|
||||
var rs = cmd.ReadToEnd();
|
||||
if (rs.IsSuccess)
|
||||
{
|
||||
|
@ -96,21 +101,21 @@ namespace SourceGit.Commands
|
|||
return locks;
|
||||
}
|
||||
|
||||
public bool Lock(string file)
|
||||
public bool Lock(string remote, string file)
|
||||
{
|
||||
return new SubCmd(_repo, $"lfs lock \"{file}\"", null).Exec();
|
||||
return new SubCmd(_repo, $"lfs lock --remote={remote} \"{file}\"", null).Exec();
|
||||
}
|
||||
|
||||
public bool Unlock(string file, bool force)
|
||||
public bool Unlock(string remote, string file, bool force)
|
||||
{
|
||||
var opt = force ? "-f" : "";
|
||||
return new SubCmd(_repo, $"lfs unlock {opt} \"{file}\"", null).Exec();
|
||||
return new SubCmd(_repo, $"lfs unlock --remote={remote} {opt} \"{file}\"", null).Exec();
|
||||
}
|
||||
|
||||
public bool Unlock(long id, bool force)
|
||||
public bool Unlock(string remote, long id, bool force)
|
||||
{
|
||||
var opt = force ? "-f" : "";
|
||||
return new SubCmd(_repo, $"lfs unlock {opt} --id={id}", null).Exec();
|
||||
return new SubCmd(_repo, $"lfs unlock --remote={remote} {opt} --id={id}", null).Exec();
|
||||
}
|
||||
|
||||
private readonly string _repo;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue