blob: 8b1a103bc7644c07a9802e789f34d13d8d2811b9 (
plain)
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
114
115
116
117
118
119
120
121
122
123
124
|
using LibGit2Sharp.Core;
using LibGit2Sharp.Handlers;
namespace LibGit2Sharp
{
/// <summary>
/// Options controlling Revert behavior.
/// </summary>
public sealed class RevertOptions : IConvertableToGitCheckoutOpts
{
/// <summary>
/// Initializes a new instance of the <see cref="RevertOptions"/> class.
/// By default the revert will be committed if there are no conflicts.
/// </summary>
public RevertOptions()
{
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 changes if there are no conflicts and the revert results
/// in changes.
/// <para>
/// Following command line behavior, if the revert results in no
/// changes, then Revert will cleanup the repository state if
/// <see cref="CommitOnSuccess"/> is true (i.e. the repository
/// will not be left in a "revert in progress" state).
/// If <see cref="CommitOnSuccess"/> is false and there are no
/// changes to revert, then the repository will be left in
/// the "revert in progress" state.
/// </para>
/// </summary>
public bool CommitOnSuccess { get; set; }
/// <summary>
/// When reverting a merge commit, the parent number to consider as
/// mainline, starting from offset 1.
/// <para>
/// As a merge commit has multiple parents, reverting 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
}
}
|