mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-30 08:34:59 +00:00
feature<Dashboard>: add context menu "Tracking" to change upstream of selected local branch
This commit is contained in:
parent
5e6ef8abcb
commit
19bccbecf6
4 changed files with 66 additions and 6 deletions
|
@ -153,6 +153,19 @@ namespace SourceGit.Git {
|
|||
if (errs != null) App.RaiseError(errs);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Change upstream
|
||||
/// </summary>
|
||||
/// <param name="repo"></param>
|
||||
/// <param name="upstream"></param>
|
||||
public void SetUpstream(Repository repo, string upstream) {
|
||||
var errs = repo.RunCommand($"branch {Name} -u {upstream}", null);
|
||||
if (errs != null) App.RaiseError(errs);
|
||||
|
||||
repo.Branches(true);
|
||||
repo.OnBranchChanged?.Invoke();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete branch.
|
||||
/// </summary>
|
||||
|
|
|
@ -835,6 +835,18 @@ namespace SourceGit.Git {
|
|||
return cachedBranches;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get all remote branches
|
||||
/// </summary>
|
||||
/// <returns>All remote branches</returns>
|
||||
public List<Branch> RemoteBranches() {
|
||||
var ret = new List<Branch>();
|
||||
foreach (var b in cachedBranches) {
|
||||
if (!b.IsLocal) ret.Add(b);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get current branch
|
||||
/// </summary>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue