forked from steveukx/git-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MergeSummary.ts
37 lines (29 loc) · 847 Bytes
/
MergeSummary.ts
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
import { MergeConflict, MergeConflictDeletion, MergeDetail, MergeResultStatus } from '../../../typings';
export class MergeSummaryConflict implements MergeConflict {
constructor(
public readonly reason: string,
public readonly file: string | null = null,
public readonly meta?: MergeConflictDeletion,
) {
}
toString() {
return `${this.file}:${this.reason}`;
}
}
export class MergeSummaryDetail implements MergeDetail {
public conflicts: MergeConflict[] = [];
public merges: string[] = [];
public result: MergeResultStatus = 'success';
get failed() {
return this.conflicts.length > 0;
}
get reason() {
return this.result;
}
toString() {
if (this.conflicts.length) {
return `CONFLICTS: ${this.conflicts.join(', ')}`;
}
return 'OK';
}
}