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 package org.eclipse.jgit.api;
44
45 import java.util.List;
46 import java.util.Map;
47
48 import org.eclipse.jgit.merge.ResolveMerger.MergeFailureReason;
49 import org.eclipse.jgit.revwalk.RevCommit;
50
51
52
53
54 public class RebaseResult {
55
56
57
58 public enum Status {
59
60
61
62 OK {
63 @Override
64 public boolean isSuccessful() {
65 return true;
66 }
67 },
68
69
70
71 ABORTED {
72 @Override
73 public boolean isSuccessful() {
74 return false;
75 }
76 },
77
78
79
80 STOPPED {
81 @Override
82 public boolean isSuccessful() {
83 return false;
84 }
85 },
86
87
88
89
90
91 EDIT {
92 @Override
93 public boolean isSuccessful() {
94 return false;
95 }
96 },
97
98
99
100 FAILED {
101 @Override
102 public boolean isSuccessful() {
103 return false;
104 }
105 },
106
107
108
109
110
111
112 UNCOMMITTED_CHANGES {
113 @Override
114 public boolean isSuccessful() {
115 return false;
116 }
117 },
118
119
120
121 CONFLICTS {
122 @Override
123 public boolean isSuccessful() {
124 return false;
125 }
126 },
127
128
129
130 UP_TO_DATE {
131 @Override
132 public boolean isSuccessful() {
133 return true;
134 }
135 },
136
137
138
139 FAST_FORWARD {
140 @Override
141 public boolean isSuccessful() {
142 return true;
143 }
144 },
145
146
147
148
149
150
151 NOTHING_TO_COMMIT {
152 @Override
153 public boolean isSuccessful() {
154 return false;
155 }
156 },
157
158
159
160
161
162 INTERACTIVE_PREPARED {
163 @Override
164 public boolean isSuccessful() {
165 return false;
166 }
167 },
168
169
170
171
172
173
174 STASH_APPLY_CONFLICTS {
175 @Override
176 public boolean isSuccessful() {
177 return true;
178 }
179 };
180
181
182
183
184 public abstract boolean isSuccessful();
185 }
186
187 static final RebaseResultl#RebaseResult">RebaseResult OK_RESULT = new RebaseResult(Status.OK);
188
189 static final RebaseResultaseResult">RebaseResult ABORTED_RESULT = new RebaseResult(Status.ABORTED);
190
191 static final RebaseResultResult">RebaseResult UP_TO_DATE_RESULT = new RebaseResult(
192 Status.UP_TO_DATE);
193
194 static final RebaseResultsult">RebaseResult FAST_FORWARD_RESULT = new RebaseResult(
195 Status.FAST_FORWARD);
196
197 static final RebaseResult>RebaseResult NOTHING_TO_COMMIT_RESULT = new RebaseResult(
198 Status.NOTHING_TO_COMMIT);
199
200 static final RebaseResultaseResult INTERACTIVE_PREPARED_RESULT = new RebaseResult(
201 Status.INTERACTIVE_PREPARED);
202
203 static final RebaseResultaseResult STASH_APPLY_CONFLICTS_RESULT = new RebaseResult(
204 Status.STASH_APPLY_CONFLICTS);
205
206 private final Status status;
207
208 private final RevCommit currentCommit;
209
210 private Map<String, MergeFailureReason> failingPaths;
211
212 private List<String> conflicts;
213
214 private List<String> uncommittedChanges;
215
216 private RebaseResult(Status status) {
217 this.status = status;
218 currentCommit = null;
219 }
220
221 private RebaseResult(Status status, RevCommit commit) {
222 this.status = status;
223 currentCommit = commit;
224 }
225
226
227
228
229
230
231
232
233
234 static RebaseResult result(RebaseResult.Status status,
235 RevCommit commit) {
236 return new RebaseResult(status, commit);
237 }
238
239
240
241
242
243
244
245
246 static RebaseResult failed(
247 Map<String, MergeFailureReason> failingPaths) {
248 RebaseResult result = new RebaseResult(Status.FAILED);
249 result.failingPaths = failingPaths;
250 return result;
251 }
252
253
254
255
256
257
258
259
260 static RebaseResult conflicts(List<String> conflicts) {
261 RebaseResult result = new RebaseResult(Status.CONFLICTS);
262 result.conflicts = conflicts;
263 return result;
264 }
265
266
267
268
269
270
271
272
273
274 static RebaseResult uncommittedChanges(List<String> uncommittedChanges) {
275 RebaseResult result = new RebaseResult(Status.UNCOMMITTED_CHANGES);
276 result.uncommittedChanges = uncommittedChanges;
277 return result;
278 }
279
280
281
282
283
284
285 public Status getStatus() {
286 return status;
287 }
288
289
290
291
292
293
294
295
296
297
298 public RevCommit getCurrentCommit() {
299 return currentCommit;
300 }
301
302
303
304
305
306
307
308
309
310
311 public Map<String, MergeFailureReason> getFailingPaths() {
312 return failingPaths;
313 }
314
315
316
317
318
319
320
321 public List<String> getConflicts() {
322 return conflicts;
323 }
324
325
326
327
328
329
330
331
332 public List<String> getUncommittedChanges() {
333 return uncommittedChanges;
334 }
335
336 }