diff options
author | Jameson Miller <jamill@microsoft.com> | 2013-02-12 19:10:28 +0400 |
---|---|---|
committer | nulltoken <emeric.fermas@gmail.com> | 2013-02-14 18:12:10 +0400 |
commit | 188b68ba4a8e998dfa5d946b01af50a3cf8d80e3 (patch) | |
tree | 1cef2dfcb9de3511148742d7dfbe20fb3c45cf5a /LibGit2Sharp/BranchCollection.cs | |
parent | e808fb6db5d9c831b3b64782ace5508641870926 (diff) |
Introduce Repositories.Branches.Update()
Diffstat (limited to 'LibGit2Sharp/BranchCollection.cs')
-rw-r--r-- | LibGit2Sharp/BranchCollection.cs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/LibGit2Sharp/BranchCollection.cs b/LibGit2Sharp/BranchCollection.cs index 84481070..46226063 100644 --- a/LibGit2Sharp/BranchCollection.cs +++ b/LibGit2Sharp/BranchCollection.cs @@ -190,6 +190,24 @@ namespace LibGit2Sharp return this[newName]; } + /// <summary> + /// Update properties of a branch. + /// </summary> + /// <param name="branch">The branch to update.</param> + /// <param name="actions">Delegate to perform updates on the branch.</param> + /// <returns>The updated branch.</returns> + public virtual Branch Update(Branch branch, params Action<BranchUpdater>[] actions) + { + var updater = new BranchUpdater(repo, branch); + + foreach (Action<BranchUpdater> action in actions) + { + action(updater); + } + + return this[branch.Name]; + } + private static bool LooksLikeABranchName(string referenceName) { return referenceName == "HEAD" || |