diff options
-rw-r--r-- | LibGit2Sharp/NetworkExtensions.cs | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/LibGit2Sharp/NetworkExtensions.cs b/LibGit2Sharp/NetworkExtensions.cs index cf769c95..4efc53f0 100644 --- a/LibGit2Sharp/NetworkExtensions.cs +++ b/LibGit2Sharp/NetworkExtensions.cs @@ -14,12 +14,24 @@ namespace LibGit2Sharp /// </summary> /// <param name="network">The <see cref="Network"/> being worked with.</param> /// <param name="branch">The branch to push.</param> + /// <exception cref="LibGit2SharpException">Throws if either the Remote or the UpstreamBranchCanonicalName is not set.</exception> + public static void Push( + this Network network, + Branch branch) + { + network.Push(new[] { branch }); + } + /// <summary> + /// Push the specified branch to its tracked branch on the remote. + /// </summary> + /// <param name="network">The <see cref="Network"/> being worked with.</param> + /// <param name="branch">The branch to push.</param> /// <param name="pushOptions"><see cref="PushOptions"/> controlling push behavior</param> /// <exception cref="LibGit2SharpException">Throws if either the Remote or the UpstreamBranchCanonicalName is not set.</exception> public static void Push( this Network network, Branch branch, - PushOptions pushOptions = null) + PushOptions pushOptions) { network.Push(new[] { branch }, pushOptions); } @@ -29,12 +41,25 @@ namespace LibGit2Sharp /// </summary> /// <param name="network">The <see cref="Network"/> being worked with.</param> /// <param name="branches">The branches to push.</param> + /// <exception cref="LibGit2SharpException">Throws if either the Remote or the UpstreamBranchCanonicalName is not set.</exception> + public static void Push( + this Network network, + IEnumerable<Branch> branches) + { + network.Push(branches, null); + } + + /// <summary> + /// Push the specified branches to their tracked branches on the remote. + /// </summary> + /// <param name="network">The <see cref="Network"/> being worked with.</param> + /// <param name="branches">The branches to push.</param> /// <param name="pushOptions"><see cref="PushOptions"/> controlling push behavior</param> /// <exception cref="LibGit2SharpException">Throws if either the Remote or the UpstreamBranchCanonicalName is not set.</exception> public static void Push( this Network network, IEnumerable<Branch> branches, - PushOptions pushOptions = null) + PushOptions pushOptions) { var enumeratedBranches = branches as IList<Branch> ?? branches.ToList(); |