diff options
author | Jameson Miller <jamill@microsoft.com> | 2014-04-22 17:25:49 +0400 |
---|---|---|
committer | Jameson Miller <jamill@microsoft.com> | 2014-05-03 07:03:28 +0400 |
commit | 90155789aedd51bc8f2ccb122f48977bc0fccc66 (patch) | |
tree | 4ee1020c8e6b75552193894fbaa547d54275efad /LibGit2Sharp/Branch.cs | |
parent | 81cb7603bd106ab6d9eefda97dbebe56039d35bb (diff) |
Update Checkout and Merge options
Checkout methods now use CheckoutOptions
Merge now takes several options:
- Option to specify what is checked out for file conflicts.
- Report CheckoutProgress and CheckoutNotify
- Option to specify MergeFileFavor
Updates for code review feedback
Diffstat (limited to 'LibGit2Sharp/Branch.cs')
-rw-r--r-- | LibGit2Sharp/Branch.cs | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/LibGit2Sharp/Branch.cs b/LibGit2Sharp/Branch.cs index e13c5c57..1e64b8b9 100644 --- a/LibGit2Sharp/Branch.cs +++ b/LibGit2Sharp/Branch.cs @@ -233,9 +233,37 @@ namespace LibGit2Sharp /// <param name="checkoutModifiers">Options controlling checkout behavior.</param> /// <param name="onCheckoutProgress">Callback method to report checkout progress updates through.</param> /// <param name="checkoutNotificationOptions"><see cref="CheckoutNotificationOptions"/> to manage checkout notifications.</param> + [Obsolete("This overload will be removed in the next release. Please use Branch.Checkout(CheckoutOptions, Signature) instead.")] public virtual void Checkout(CheckoutModifiers checkoutModifiers, CheckoutProgressHandler onCheckoutProgress, CheckoutNotificationOptions checkoutNotificationOptions) { - repo.Checkout(this, checkoutModifiers, onCheckoutProgress, checkoutNotificationOptions); + var options = new CheckoutOptions + { + CheckoutModifiers = checkoutModifiers, + OnCheckoutProgress = onCheckoutProgress, + }; + + if (checkoutNotificationOptions != null) + { + options.OnCheckoutNotify = checkoutNotificationOptions.CheckoutNotifyHandler; + options.CheckoutNotifyFlags = checkoutNotificationOptions.NotifyFlags; + } + + Checkout(options, null); + } + + /// <summary> + /// Checkout the tip commit of this <see cref="Branch"/> object with + /// <see cref="CheckoutOptions"/> parameter specifying checkout + /// behavior. If this commit is the current tip of the branch, will + /// checkout the named branch. Otherwise, will checkout the tip + /// commit as a detached HEAD. + /// </summary> + /// <param name="options"><see cref="CheckoutOptions"/> controlling checkout behavior.</param> + /// <param name="signature">Identity for use when updating the reflog.</param> + public virtual void Checkout(CheckoutOptions options, Signature signature = null) + { + Ensure.ArgumentNotNull(options, "options"); + repo.Checkout(this, options, signature); } private Branch ResolveTrackedBranch() |