diff options
author | Jameson Miller <jamill@microsoft.com> | 2014-03-04 21:49:03 +0400 |
---|---|---|
committer | Jameson Miller <jamill@microsoft.com> | 2014-04-09 23:50:56 +0400 |
commit | c7e11bbff588c0f2b84b3f9dbdfaf2e5ef00cf91 (patch) | |
tree | 4dffa25352dc5035a7282c15625c1fb861a6a238 /LibGit2Sharp/MergeOptions.cs | |
parent | fb978a053562c6d14f5dd46f265f159f215ea1b0 (diff) |
Introduce new merge functionality, including Pull, merge options, and
merging branches.
This includes a refactoring of the merge logic to support the new
scenarios. New functionality includes:
- Deprecate Network.Fetchheads, Repository.MergeHeads as these should be
internal only.
- Introduce ability to pull the configured upstream branch for the current
branch
- Introduce ability to merge a branch into the current branch.
- Introduce options to control merge behavior. The current exposed options
include whether to commit the merge commit and the allowed merge types.
Diffstat (limited to 'LibGit2Sharp/MergeOptions.cs')
-rw-r--r-- | LibGit2Sharp/MergeOptions.cs | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/LibGit2Sharp/MergeOptions.cs b/LibGit2Sharp/MergeOptions.cs new file mode 100644 index 00000000..49096dbd --- /dev/null +++ b/LibGit2Sharp/MergeOptions.cs @@ -0,0 +1,54 @@ + +namespace LibGit2Sharp +{ + /// <summary> + /// Options controlling Merge behavior. + /// </summary> + public class MergeOptions + { + /// <summary> + /// Initializes a new instance of the <see cref="MergeOptions"/> class. + /// By default, a fast-forward merge will be performed if possible, and + /// if a merge commit is created, then it will be commited. + /// </summary> + public MergeOptions() + { + CommitOnSuccess = true; + } + + /// <summary> + /// Commit the merge if the merge is successful and this is a non-fast-forward merge. + /// If this is a fast-forward merge, then there is no merge commit and this option + /// will not affect the merge. + /// </summary> + public virtual bool CommitOnSuccess { get; set; } + + /// <summary> + /// The type of merge to perform. + /// </summary> + public virtual FastForwardStrategy FastForwardStrategy { get; set; } + } + + /// <summary> + /// Strategy used for merging. + /// </summary> + public enum FastForwardStrategy + { + /// <summary> + /// Default fast-forward strategy. This will perform a fast-forward merge + /// if possible, otherwise will perform a non-fast-forward merge that + /// results in a merge commit. + /// </summary> + Default = 0, + + /// <summary> + /// Do not fast-forward. Always creates a merge commit. + /// </summary> + NoFastFoward = 1, /* GIT_MERGE_NO_FASTFORWARD */ + + /// <summary> + /// Only perform fast-forward merges. + /// </summary> + FastForwardOnly = 2, /* GIT_MERGE_FASTFORWARD_ONLY */ + } +} |