This repository was archived by the owner on Feb 3, 2023. It is now read-only.
forked from libgit2/libgit2sharp
-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathCherryPickOptions.cs
More file actions
113 lines (96 loc) · 4.03 KB
/
Copy pathCherryPickOptions.cs
File metadata and controls
113 lines (96 loc) · 4.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
using LibGit2Sharp.Core;
using LibGit2Sharp.Handlers;
namespace LibGit2Sharp
{
/// <summary>
/// Options controlling CherryPick behavior.
/// </summary>
public sealed class CherryPickOptions : IConvertableToGitCheckoutOpts
{
/// <summary>
/// Initializes a new instance of the <see cref="CherryPickOptions"/> class.
/// By default the cherry pick will be committed if there are no conflicts.
/// </summary>
public CherryPickOptions()
{
CommitOnSuccess = true;
FindRenames = true;
// TODO: libgit2 should provide reasonable defaults for these
// values, but it currently does not.
RenameThreshold = 50;
TargetLimit = 200;
}
/// <summary>
/// The Flags specifying what conditions are
/// reported through the OnCheckoutNotify delegate.
/// </summary>
public CheckoutNotifyFlags CheckoutNotifyFlags { get; set; }
/// <summary>
/// Delegate that checkout progress will be reported through.
/// </summary>
public CheckoutProgressHandler OnCheckoutProgress { get; set; }
/// <summary>
/// Delegate that checkout will notify callers of
/// certain conditions. The conditions that are reported is
/// controlled with the CheckoutNotifyFlags property.
/// </summary>
public CheckoutNotifyHandler OnCheckoutNotify { get; set; }
/// <summary>
/// Commit the cherry pick if the cherry pick is successful.
/// </summary>
public bool CommitOnSuccess { get; set; }
/// <summary>
/// When cherry picking a merge commit, the parent number to consider as
/// mainline, starting from offset 1.
/// <para>
/// As a merge commit has multiple parents, cherry picking a merge commit
/// will reverse all the changes brought in by the merge except for
/// one parent's line of commits. The parent to preserve is called the
/// mainline, and must be specified by its number (i.e. offset).
/// </para>
/// </summary>
public int Mainline { get; set; }
/// <summary>
/// How to handle conflicts encountered during a merge.
/// </summary>
public MergeFileFavor MergeFileFavor { get; set; }
/// <summary>
/// How Checkout should handle writing out conflicting index entries.
/// </summary>
public CheckoutFileConflictStrategy FileConflictStrategy { get; set; }
/// <summary>
/// Find renames. Default is true.
/// </summary>
public bool FindRenames { get; set; }
/// <summary>
/// Similarity to consider a file renamed (default 50). If
/// `FindRenames` is enabled, added files will be compared
/// with deleted files to determine their similarity. Files that are
/// more similar than the rename threshold (percentage-wise) will be
/// treated as a rename.
/// </summary>
public int RenameThreshold;
/// <summary>
/// Maximum similarity sources to examine for renames (default 200).
/// If the number of rename candidates (add / delete pairs) is greater
/// than this value, inexact rename detection is aborted.
///
/// This setting overrides the `merge.renameLimit` configuration value.
/// </summary>
public int TargetLimit;
#region IConvertableToGitCheckoutOpts
CheckoutCallbacks IConvertableToGitCheckoutOpts.GenerateCallbacks()
{
return CheckoutCallbacks.From(OnCheckoutProgress, OnCheckoutNotify);
}
CheckoutStrategy IConvertableToGitCheckoutOpts.CheckoutStrategy
{
get
{
return CheckoutStrategy.GIT_CHECKOUT_SAFE |
GitCheckoutOptsWrapper.CheckoutStrategyFromFileConflictStrategy(FileConflictStrategy);
}
}
#endregion IConvertableToGitCheckoutOpts
}
}