diff options
author | Brendan Forster <brendan@github.com> | 2015-05-10 13:59:39 +0300 |
---|---|---|
committer | nulltoken <emeric.fermas@gmail.com> | 2015-05-15 20:31:45 +0300 |
commit | 0cfa9230e00d340805223a81a165769fb72a744c (patch) | |
tree | 322f29d7e1d24e9d9850ad6d4979f87a4e678f4a | |
parent | 1f9d9ddb2b7b2591a9109eb42b9dca222333417d (diff) |
Drop optional parameters in Network.cs
-rw-r--r-- | LibGit2Sharp/Network.cs | 186 |
1 files changed, 171 insertions, 15 deletions
diff --git a/LibGit2Sharp/Network.cs b/LibGit2Sharp/Network.cs index 49d80d3d..a0216f9b 100644 --- a/LibGit2Sharp/Network.cs +++ b/LibGit2Sharp/Network.cs @@ -46,9 +46,25 @@ namespace LibGit2Sharp /// </para> /// </summary> /// <param name="remote">The <see cref="Remote"/> to list from.</param> - /// <param name="credentialsProvider">The optional <see cref="Func{Credentials}"/> used to connect to remote repository.</param> /// <returns>The references in the <see cref="Remote"/> repository.</returns> - public virtual IEnumerable<DirectReference> ListReferences(Remote remote, CredentialsHandler credentialsProvider = null) + public virtual IEnumerable<DirectReference> ListReferences(Remote remote) + { + return ListReferences(remote, null); + } + + /// <summary> + /// List references in a <see cref="Remote"/> repository. + /// <para> + /// When the remote tips are ahead of the local ones, the retrieved + /// <see cref="DirectReference"/>s may point to non existing + /// <see cref="GitObject"/>s in the local repository. In that + /// case, <see cref="DirectReference.Target"/> will return <c>null</c>. + /// </para> + /// </summary> + /// <param name="remote">The <see cref="Remote"/> to list from.</param> + /// <param name="credentialsProvider">The <see cref="Func{Credentials}"/> used to connect to remote repository.</param> + /// <returns>The references in the <see cref="Remote"/> repository.</returns> + public virtual IEnumerable<DirectReference> ListReferences(Remote remote, CredentialsHandler credentialsProvider) { Ensure.ArgumentNotNull(remote, "remote"); @@ -120,10 +136,38 @@ namespace LibGit2Sharp /// Fetch from the <see cref="Remote"/>. /// </summary> /// <param name="remote">The remote to fetch</param> + public virtual void Fetch(Remote remote) + { + Fetch(remote, (FetchOptions)null, null); + } + + /// <summary> + /// Fetch from the <see cref="Remote"/>. + /// </summary> + /// <param name="remote">The remote to fetch</param> + /// <param name="options"><see cref="FetchOptions"/> controlling fetch behavior</param> + public virtual void Fetch(Remote remote, FetchOptions options) + { + Fetch(remote, options, null); + } + + /// <summary> + /// Fetch from the <see cref="Remote"/>. + /// </summary> + /// <param name="remote">The remote to fetch</param> + /// <param name="logMessage">Message to use when updating the reflog.</param> + public virtual void Fetch(Remote remote, string logMessage) + { + Fetch(remote, (FetchOptions)null, logMessage); + } + + /// <summary> + /// Fetch from the <see cref="Remote"/>. + /// </summary> + /// <param name="remote">The remote to fetch</param> /// <param name="options"><see cref="FetchOptions"/> controlling fetch behavior</param> /// <param name="logMessage">Message to use when updating the reflog.</param> - public virtual void Fetch(Remote remote, FetchOptions options = null, - string logMessage = null) + public virtual void Fetch(Remote remote, FetchOptions options, string logMessage) { Ensure.ArgumentNotNull(remote, "remote"); @@ -138,10 +182,41 @@ namespace LibGit2Sharp /// </summary> /// <param name="remote">The remote to fetch</param> /// <param name="refspecs">Refspecs to use, replacing the remote's fetch refspecs</param> + public virtual void Fetch(Remote remote, IEnumerable<string> refspecs) + { + Fetch(remote, refspecs, null, null); + } + + /// <summary> + /// Fetch from the <see cref="Remote"/>, using custom refspecs. + /// </summary> + /// <param name="remote">The remote to fetch</param> + /// <param name="refspecs">Refspecs to use, replacing the remote's fetch refspecs</param> + /// <param name="options"><see cref="FetchOptions"/> controlling fetch behavior</param> + public virtual void Fetch(Remote remote, IEnumerable<string> refspecs, FetchOptions options) + { + Fetch(remote, refspecs, options, null); + } + + /// <summary> + /// Fetch from the <see cref="Remote"/>, using custom refspecs. + /// </summary> + /// <param name="remote">The remote to fetch</param> + /// <param name="refspecs">Refspecs to use, replacing the remote's fetch refspecs</param> + /// <param name="logMessage">Message to use when updating the reflog.</param> + public virtual void Fetch(Remote remote, IEnumerable<string> refspecs, string logMessage) + { + Fetch(remote, refspecs, null, logMessage); + } + + /// <summary> + /// Fetch from the <see cref="Remote"/>, using custom refspecs. + /// </summary> + /// <param name="remote">The remote to fetch</param> + /// <param name="refspecs">Refspecs to use, replacing the remote's fetch refspecs</param> /// <param name="options"><see cref="FetchOptions"/> controlling fetch behavior</param> /// <param name="logMessage">Message to use when updating the reflog.</param> - public virtual void Fetch(Remote remote, IEnumerable<string> refspecs, FetchOptions options = null, - string logMessage = null) + public virtual void Fetch(Remote remote, IEnumerable<string> refspecs, FetchOptions options, string logMessage) { Ensure.ArgumentNotNull(remote, "remote"); Ensure.ArgumentNotNull(refspecs, "refspecs"); @@ -159,13 +234,53 @@ namespace LibGit2Sharp /// </summary> /// <param name="url">The url to fetch from</param> /// <param name="refspecs">The list of resfpecs to use</param> + public virtual void Fetch( + string url, + IEnumerable<string> refspecs) + { + Fetch(url, refspecs, null, null); + } + + /// <summary> + /// Fetch from a url with a set of fetch refspecs + /// </summary> + /// <param name="url">The url to fetch from</param> + /// <param name="refspecs">The list of resfpecs to use</param> + /// <param name="options"><see cref="FetchOptions"/> controlling fetch behavior</param> + public virtual void Fetch( + string url, + IEnumerable<string> refspecs, + FetchOptions options) + { + Fetch(url, refspecs, options, null); + } + + /// <summary> + /// Fetch from a url with a set of fetch refspecs + /// </summary> + /// <param name="url">The url to fetch from</param> + /// <param name="refspecs">The list of resfpecs to use</param> + /// <param name="logMessage">Message to use when updating the reflog.</param> + public virtual void Fetch( + string url, + IEnumerable<string> refspecs, + string logMessage) + { + Fetch(url, refspecs, null, logMessage); + } + + /// <summary> + /// Fetch from a url with a set of fetch refspecs + /// </summary> + /// <param name="url">The url to fetch from</param> + /// <param name="refspecs">The list of resfpecs to use</param> /// <param name="options"><see cref="FetchOptions"/> controlling fetch behavior</param> /// <param name="logMessage">Message to use when updating the reflog.</param> public virtual void Fetch( string url, IEnumerable<string> refspecs, - FetchOptions options = null, - string logMessage = null) + FetchOptions options, + string logMessage) { Ensure.ArgumentNotNull(url, "url"); Ensure.ArgumentNotNull(refspecs, "refspecs"); @@ -184,16 +299,33 @@ namespace LibGit2Sharp /// <param name="remote">The <see cref="Remote"/> to push to.</param> /// <param name="objectish">The source objectish to push.</param> /// <param name="destinationSpec">The reference to update on the remote.</param> + public virtual void Push( + Remote remote, + string objectish, + string destinationSpec) + { + Ensure.ArgumentNotNull(objectish, "objectish"); + Ensure.ArgumentNotNullOrEmptyString(destinationSpec, "destinationSpec"); + + Push(remote, string.Format(CultureInfo.InvariantCulture, + "{0}:{1}", objectish, destinationSpec)); + } + + /// <summary> + /// Push the objectish to the destination reference on the <see cref="Remote"/>. + /// </summary> + /// <param name="remote">The <see cref="Remote"/> to push to.</param> + /// <param name="objectish">The source objectish to push.</param> + /// <param name="destinationSpec">The reference to update on the remote.</param> /// <param name="pushOptions"><see cref="PushOptions"/> controlling push behavior</param> public virtual void Push( Remote remote, string objectish, string destinationSpec, - PushOptions pushOptions = null) + PushOptions pushOptions) { - Ensure.ArgumentNotNull(remote, "remote"); Ensure.ArgumentNotNull(objectish, "objectish"); - Ensure.ArgumentNotNullOrEmptyString(destinationSpec, destinationSpec); + Ensure.ArgumentNotNullOrEmptyString(destinationSpec, "destinationSpec"); Push(remote, string.Format(CultureInfo.InvariantCulture, "{0}:{1}", objectish, destinationSpec), pushOptions); @@ -204,13 +336,25 @@ namespace LibGit2Sharp /// </summary> /// <param name="remote">The <see cref="Remote"/> to push to.</param> /// <param name="pushRefSpec">The pushRefSpec to push.</param> + public virtual void Push( + Remote remote, + string pushRefSpec) + { + Ensure.ArgumentNotNullOrEmptyString(pushRefSpec, "pushRefSpec"); + + Push(remote, new[] { pushRefSpec }); + } + /// <summary> + /// Push specified reference to the <see cref="Remote"/>. + /// </summary> + /// <param name="remote">The <see cref="Remote"/> to push to.</param> + /// <param name="pushRefSpec">The pushRefSpec to push.</param> /// <param name="pushOptions"><see cref="PushOptions"/> controlling push behavior</param> public virtual void Push( Remote remote, string pushRefSpec, - PushOptions pushOptions = null) + PushOptions pushOptions) { - Ensure.ArgumentNotNull(remote, "remote"); Ensure.ArgumentNotNullOrEmptyString(pushRefSpec, "pushRefSpec"); Push(remote, new[] { pushRefSpec }, pushOptions); @@ -221,11 +365,23 @@ namespace LibGit2Sharp /// </summary> /// <param name="remote">The <see cref="Remote"/> to push to.</param> /// <param name="pushRefSpecs">The pushRefSpecs to push.</param> + public virtual void Push( + Remote remote, + IEnumerable<string> pushRefSpecs) + { + Push(remote, pushRefSpecs, null); + } + + /// <summary> + /// Push specified references to the <see cref="Remote"/>. + /// </summary> + /// <param name="remote">The <see cref="Remote"/> to push to.</param> + /// <param name="pushRefSpecs">The pushRefSpecs to push.</param> /// <param name="pushOptions"><see cref="PushOptions"/> controlling push behavior</param> public virtual void Push( Remote remote, IEnumerable<string> pushRefSpecs, - PushOptions pushOptions = null) + PushOptions pushOptions) { Ensure.ArgumentNotNull(remote, "remote"); Ensure.ArgumentNotNull(pushRefSpecs, "pushRefSpecs"); @@ -276,7 +432,7 @@ namespace LibGit2Sharp Branch currentBranch = repository.Head; - if(!currentBranch.IsTracking) + if (!currentBranch.IsTracking) { throw new LibGit2SharpException("There is no tracking information for the current branch."); } |