1
2
3
4
5
6
7
8
9
10 package org.eclipse.jgit.api;
11
12 import java.util.List;
13 import java.util.Map;
14
15 import org.eclipse.jgit.lib.Ref;
16 import org.eclipse.jgit.merge.ResolveMerger.MergeFailureReason;
17 import org.eclipse.jgit.revwalk.RevCommit;
18
19
20
21
22 public class CherryPickResult {
23
24
25
26
27 public enum CherryPickStatus {
28
29 OK {
30 @Override
31 public String toString() {
32 return "Ok";
33 }
34 },
35
36 FAILED {
37 @Override
38 public String toString() {
39 return "Failed";
40 }
41 },
42
43 CONFLICTING {
44 @Override
45 public String toString() {
46 return "Conflicting";
47 }
48 }
49 }
50
51 private final CherryPickStatus status;
52
53 private final RevCommit newHead;
54
55 private final List<Ref> cherryPickedRefs;
56
57 private final Map<String, MergeFailureReason> failingPaths;
58
59
60
61
62
63
64
65
66
67 public CherryPickResult(RevCommit newHead, List<Ref> cherryPickedRefs) {
68 this.status = CherryPickStatus.OK;
69 this.newHead = newHead;
70 this.cherryPickedRefs = cherryPickedRefs;
71 this.failingPaths = null;
72 }
73
74
75
76
77
78
79
80
81
82 public CherryPickResult(Map<String, MergeFailureReason> failingPaths) {
83 this.status = CherryPickStatus.FAILED;
84 this.newHead = null;
85 this.cherryPickedRefs = null;
86 this.failingPaths = failingPaths;
87 }
88
89 private CherryPickResult(CherryPickStatus status) {
90 this.status = status;
91 this.newHead = null;
92 this.cherryPickedRefs = null;
93 this.failingPaths = null;
94 }
95
96
97
98
99
100 public static final CherryPickResultml#CherryPickResult">CherryPickResult CONFLICT = new CherryPickResult(
101 CherryPickStatus.CONFLICTING);
102
103
104
105
106
107
108 public CherryPickStatus getStatus() {
109 return status;
110 }
111
112
113
114
115
116
117
118
119 public RevCommit getNewHead() {
120 return newHead;
121 }
122
123
124
125
126
127
128
129
130 public List<Ref> getCherryPickedRefs() {
131 return cherryPickedRefs;
132 }
133
134
135
136
137
138
139
140
141
142 public Map<String, MergeFailureReason> getFailingPaths() {
143 return failingPaths;
144 }
145 }