-
Notifications
You must be signed in to change notification settings - Fork 894
/
Copy pathMergeTreeResult.cs
62 lines (54 loc) · 1.71 KB
/
MergeTreeResult.cs
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
using System.Collections.Generic;
namespace LibGit2Sharp
{
/// <summary>
/// The results of a merge of two trees.
/// </summary>
public class MergeTreeResult
{
/// <summary>
/// Needed for mocking purposes.
/// </summary>
protected MergeTreeResult()
{ }
internal MergeTreeResult(IEnumerable<Conflict> conflicts)
{
this.Status = MergeTreeStatus.Conflicts;
this.Conflicts = conflicts;
}
internal MergeTreeResult(Tree tree)
{
this.Status = MergeTreeStatus.Succeeded;
this.Tree = tree;
this.Conflicts = new List<Conflict>();
}
/// <summary>
/// The status of the merge.
/// </summary>
public virtual MergeTreeStatus Status { get; private set; }
/// <summary>
/// The resulting tree of the merge.
/// <para>This will return <code>null</code> if the merge has been unsuccessful due to conflicts.</para>
/// </summary>
public virtual Tree Tree { get; private set; }
/// <summary>
/// The resulting conflicts from the merge.
/// <para>This will return <code>null</code> if the merge was successful and there were no conflicts.</para>
/// </summary>
public virtual IEnumerable<Conflict> Conflicts { get; private set; }
}
/// <summary>
/// The status of what happened as a result of a merge.
/// </summary>
public enum MergeTreeStatus
{
/// <summary>
/// Merge succeeded.
/// </summary>
Succeeded,
/// <summary>
/// Merge resulted in conflicts.
/// </summary>
Conflicts,
}
}