sf-git-merge-driver 1.4.0-dev-159.21320251314-1 → 1.4.0-dev-159.21331490438-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/lib/merger/strategies/AbstractAncestorStrategy.d.ts +12 -0
- package/lib/merger/strategies/AbstractAncestorStrategy.js +39 -0
- package/lib/merger/strategies/AbstractAncestorStrategy.js.map +1 -0
- package/lib/merger/strategies/AncestorAndLocalStrategy.d.ts +7 -5
- package/lib/merger/strategies/AncestorAndLocalStrategy.js +10 -32
- package/lib/merger/strategies/AncestorAndLocalStrategy.js.map +1 -1
- package/lib/merger/strategies/AncestorAndOtherStrategy.d.ts +7 -5
- package/lib/merger/strategies/AncestorAndOtherStrategy.js +10 -32
- package/lib/merger/strategies/AncestorAndOtherStrategy.js.map +1 -1
- package/lib/merger/strategies/ScenarioStrategyFactory.js +16 -10
- package/lib/merger/strategies/ScenarioStrategyFactory.js.map +1 -1
- package/lib/merger/strategies/TextMergeStrategy.d.ts +2 -1
- package/npm-shrinkwrap.json +856 -135
- package/oclif.manifest.json +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -279,7 +279,7 @@ EXAMPLES
|
|
|
279
279
|
$ sf git merge driver install
|
|
280
280
|
```
|
|
281
281
|
|
|
282
|
-
_See code: [src/commands/git/merge/driver/install.ts](https://github.com/scolladon/sf-git-merge-driver/blob/v1.4.0-dev-159.
|
|
282
|
+
_See code: [src/commands/git/merge/driver/install.ts](https://github.com/scolladon/sf-git-merge-driver/blob/v1.4.0-dev-159.21331490438-1/src/commands/git/merge/driver/install.ts)_
|
|
283
283
|
|
|
284
284
|
## `sf git merge driver run`
|
|
285
285
|
|
|
@@ -323,7 +323,7 @@ EXAMPLES
|
|
|
323
323
|
- output-file is the path to the file where the merged content will be written
|
|
324
324
|
```
|
|
325
325
|
|
|
326
|
-
_See code: [src/commands/git/merge/driver/run.ts](https://github.com/scolladon/sf-git-merge-driver/blob/v1.4.0-dev-159.
|
|
326
|
+
_See code: [src/commands/git/merge/driver/run.ts](https://github.com/scolladon/sf-git-merge-driver/blob/v1.4.0-dev-159.21331490438-1/src/commands/git/merge/driver/run.ts)_
|
|
327
327
|
|
|
328
328
|
## `sf git merge driver uninstall`
|
|
329
329
|
|
|
@@ -353,7 +353,7 @@ EXAMPLES
|
|
|
353
353
|
$ sf git merge driver uninstall
|
|
354
354
|
```
|
|
355
355
|
|
|
356
|
-
_See code: [src/commands/git/merge/driver/uninstall.ts](https://github.com/scolladon/sf-git-merge-driver/blob/v1.4.0-dev-159.
|
|
356
|
+
_See code: [src/commands/git/merge/driver/uninstall.ts](https://github.com/scolladon/sf-git-merge-driver/blob/v1.4.0-dev-159.21331490438-1/src/commands/git/merge/driver/uninstall.ts)_
|
|
357
357
|
<!-- commandsstop -->
|
|
358
358
|
## Changelog
|
|
359
359
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { JsonArray, JsonObject } from '../../types/jsonTypes.js';
|
|
2
|
+
import type { MergeResult } from '../../types/mergeResult.js';
|
|
3
|
+
import type { MergeContext } from '../MergeContext.js';
|
|
4
|
+
import type { ScenarioStrategy } from './ScenarioStrategy.js';
|
|
5
|
+
export declare abstract class AbstractAncestorStrategy implements ScenarioStrategy {
|
|
6
|
+
execute(context: MergeContext): MergeResult;
|
|
7
|
+
protected abstract getTarget(context: MergeContext): unknown;
|
|
8
|
+
protected abstract getExistsInSecondary(context: MergeContext): boolean;
|
|
9
|
+
protected abstract buildConflict(context: MergeContext, targetObj: JsonObject | JsonArray, ancestorObj: JsonObject | JsonArray): JsonArray;
|
|
10
|
+
private executeNested;
|
|
11
|
+
protected abstract executeWithAttribute(context: MergeContext): MergeResult;
|
|
12
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { deepEqual } from 'fast-equals';
|
|
2
|
+
import { noConflict, withConflict } from '../../types/mergeResult.js';
|
|
3
|
+
import { MergeOrchestrator } from '../MergeOrchestrator.js';
|
|
4
|
+
import { extractContent, toJsonArray, wrapWithRootKey, } from '../nodes/nodeUtils.js';
|
|
5
|
+
export class AbstractAncestorStrategy {
|
|
6
|
+
execute(context) {
|
|
7
|
+
const target = this.getTarget(context);
|
|
8
|
+
const targetUnchanged = deepEqual(context.ancestor, target);
|
|
9
|
+
if (context.rootKey) {
|
|
10
|
+
const { name } = context.rootKey;
|
|
11
|
+
const existsInSecondary = this.getExistsInSecondary(context);
|
|
12
|
+
if (!existsInSecondary && targetUnchanged) {
|
|
13
|
+
return noConflict([]);
|
|
14
|
+
}
|
|
15
|
+
if (!existsInSecondary && !targetUnchanged) {
|
|
16
|
+
const targetObj = {
|
|
17
|
+
[name]: toJsonArray(target),
|
|
18
|
+
};
|
|
19
|
+
const ancestorObj = {
|
|
20
|
+
[name]: toJsonArray(context.ancestor),
|
|
21
|
+
};
|
|
22
|
+
return withConflict(this.buildConflict(context, targetObj, ancestorObj));
|
|
23
|
+
}
|
|
24
|
+
return wrapWithRootKey(this.executeNested(context), name);
|
|
25
|
+
}
|
|
26
|
+
if (targetUnchanged) {
|
|
27
|
+
return noConflict([]);
|
|
28
|
+
}
|
|
29
|
+
if (context.attribute) {
|
|
30
|
+
return this.executeWithAttribute(context);
|
|
31
|
+
}
|
|
32
|
+
return withConflict(this.buildConflict(context, extractContent(toJsonArray(target)), extractContent(toJsonArray(context.ancestor))));
|
|
33
|
+
}
|
|
34
|
+
executeNested(context) {
|
|
35
|
+
const orchestrator = new MergeOrchestrator(context.config, context.nodeFactory);
|
|
36
|
+
return orchestrator.merge(context.ancestor, context.local, context.other);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=AbstractAncestorStrategy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AbstractAncestorStrategy.js","sourceRoot":"","sources":["../../../src/merger/strategies/AbstractAncestorStrategy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAGvC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAErE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,EACL,cAAc,EACd,WAAW,EACX,eAAe,GAChB,MAAM,uBAAuB,CAAA;AAG9B,MAAM,OAAgB,wBAAwB;IAC5C,OAAO,CAAC,OAAqB;QAC3B,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAA;QACtC,MAAM,eAAe,GAAG,SAAS,CAAC,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;QAE3D,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;YACpB,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,OAAO,CAAA;YAChC,MAAM,iBAAiB,GAAG,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAA;YAE5D,IAAI,CAAC,iBAAiB,IAAI,eAAe,EAAE,CAAC;gBAC1C,OAAO,UAAU,CAAC,EAAE,CAAC,CAAA;YACvB,CAAC;YAED,IAAI,CAAC,iBAAiB,IAAI,CAAC,eAAe,EAAE,CAAC;gBAC3C,MAAM,SAAS,GAAG;oBAChB,CAAC,IAAI,CAAC,EAAE,WAAW,CAAC,MAAgC,CAAC;iBACtD,CAAA;gBACD,MAAM,WAAW,GAAG;oBAClB,CAAC,IAAI,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,QAAkC,CAAC;iBAChE,CAAA;gBACD,OAAO,YAAY,CAAC,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC,CAAA;YAC1E,CAAC;YAED,OAAO,eAAe,CAAC,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,CAAA;QAC3D,CAAC;QAED,IAAI,eAAe,EAAE,CAAC;YACpB,OAAO,UAAU,CAAC,EAAE,CAAC,CAAA;QACvB,CAAC;QAED,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;YACtB,OAAO,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAA;QAC3C,CAAC;QAED,OAAO,YAAY,CACjB,IAAI,CAAC,aAAa,CAChB,OAAO,EACP,cAAc,CAAC,WAAW,CAAC,MAAgC,CAAC,CAAC,EAC7D,cAAc,CAAC,WAAW,CAAC,OAAO,CAAC,QAAkC,CAAC,CAAC,CACxE,CACF,CAAA;IACH,CAAC;IAYO,aAAa,CAAC,OAAqB;QACzC,MAAM,YAAY,GAAG,IAAI,iBAAiB,CACxC,OAAO,CAAC,MAAM,EACd,OAAO,CAAC,WAAW,CACpB,CAAA;QACD,OAAO,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,CAAA;IAC3E,CAAC;CAGF"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import type { JsonArray, JsonObject } from '../../types/jsonTypes.js';
|
|
1
2
|
import type { MergeResult } from '../../types/mergeResult.js';
|
|
2
3
|
import type { MergeContext } from '../MergeContext.js';
|
|
3
|
-
import
|
|
4
|
-
export declare class AncestorAndLocalStrategy
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
import { AbstractAncestorStrategy } from './AbstractAncestorStrategy.js';
|
|
5
|
+
export declare class AncestorAndLocalStrategy extends AbstractAncestorStrategy {
|
|
6
|
+
protected getTarget(context: MergeContext): unknown;
|
|
7
|
+
protected getExistsInSecondary(context: MergeContext): boolean;
|
|
8
|
+
protected buildConflict(context: MergeContext, targetObj: JsonObject, ancestorObj: JsonObject): JsonArray;
|
|
9
|
+
protected executeWithAttribute(context: MergeContext): MergeResult;
|
|
8
10
|
}
|
|
@@ -1,38 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { noConflict, withConflict } from '../../types/mergeResult.js';
|
|
1
|
+
import { withConflict } from '../../types/mergeResult.js';
|
|
3
2
|
import { buildConflictMarkers } from '../ConflictMarkerBuilder.js';
|
|
4
3
|
import { MergeOrchestrator } from '../MergeOrchestrator.js';
|
|
5
|
-
import {
|
|
6
|
-
export class AncestorAndLocalStrategy {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
if (context.rootKey) {
|
|
10
|
-
const { name, existsInOther } = context.rootKey;
|
|
11
|
-
if (!existsInOther && localUnchanged) {
|
|
12
|
-
return noConflict([]);
|
|
13
|
-
}
|
|
14
|
-
if (!existsInOther && !localUnchanged) {
|
|
15
|
-
const localObj = {
|
|
16
|
-
[name]: toJsonArray(context.local),
|
|
17
|
-
};
|
|
18
|
-
const ancestorObj = {
|
|
19
|
-
[name]: toJsonArray(context.ancestor),
|
|
20
|
-
};
|
|
21
|
-
return withConflict(buildConflictMarkers(context.config, localObj, ancestorObj, {}));
|
|
22
|
-
}
|
|
23
|
-
return wrapWithRootKey(this.executeNested(context), name);
|
|
24
|
-
}
|
|
25
|
-
if (localUnchanged) {
|
|
26
|
-
return noConflict([]);
|
|
27
|
-
}
|
|
28
|
-
if (context.attribute) {
|
|
29
|
-
return this.executeWithAttribute(context);
|
|
30
|
-
}
|
|
31
|
-
return withConflict(buildConflictMarkers(context.config, extractContent(toJsonArray(context.local)), extractContent(toJsonArray(context.ancestor)), {}));
|
|
4
|
+
import { AbstractAncestorStrategy } from './AbstractAncestorStrategy.js';
|
|
5
|
+
export class AncestorAndLocalStrategy extends AbstractAncestorStrategy {
|
|
6
|
+
getTarget(context) {
|
|
7
|
+
return context.local;
|
|
32
8
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
9
|
+
getExistsInSecondary(context) {
|
|
10
|
+
return context.rootKey ? context.rootKey.existsInOther : false;
|
|
11
|
+
}
|
|
12
|
+
buildConflict(context, targetObj, ancestorObj) {
|
|
13
|
+
return buildConflictMarkers(context.config, targetObj, ancestorObj, {});
|
|
36
14
|
}
|
|
37
15
|
executeWithAttribute(context) {
|
|
38
16
|
const orchestrator = new MergeOrchestrator(context.config, context.nodeFactory);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AncestorAndLocalStrategy.js","sourceRoot":"","sources":["../../../src/merger/strategies/AncestorAndLocalStrategy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AncestorAndLocalStrategy.js","sourceRoot":"","sources":["../../../src/merger/strategies/AncestorAndLocalStrategy.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAA;AAElE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAA;AAExE,MAAM,OAAO,wBAAyB,SAAQ,wBAAwB;IAC1D,SAAS,CAAC,OAAqB;QACvC,OAAO,OAAO,CAAC,KAAK,CAAA;IACtB,CAAC;IAES,oBAAoB,CAAC,OAAqB;QAClD,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAA;IAChE,CAAC;IAES,aAAa,CACrB,OAAqB,EACrB,SAAqB,EACrB,WAAuB;QAEvB,OAAO,oBAAoB,CAAC,OAAO,CAAC,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,EAAE,CAAC,CAAA;IACzE,CAAC;IAES,oBAAoB,CAAC,OAAqB;QAClD,MAAM,YAAY,GAAG,IAAI,iBAAiB,CACxC,OAAO,CAAC,MAAM,EACd,OAAO,CAAC,WAAW,CACpB,CAAA;QACD,MAAM,WAAW,GAAG,YAAY,CAAC,KAAK,CAAC,EAAE,EAAE,OAAO,CAAC,KAAK,EAAE,EAAE,EAAE,SAAS,CAAC,CAAA;QACxE,MAAM,cAAc,GAAG,YAAY,CAAC,KAAK,CACvC,EAAE,EACF,OAAO,CAAC,QAAQ,EAChB,EAAE,EACF,SAAS,CACV,CAAA;QAED,MAAM,SAAS,GAAG,EAAE,CAAC,OAAO,CAAC,SAAU,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,CAAA;QAC9D,MAAM,YAAY,GAAG,EAAE,CAAC,OAAO,CAAC,SAAU,CAAC,EAAE,cAAc,CAAC,MAAM,EAAE,CAAA;QAEpE,OAAO,YAAY,CACjB,oBAAoB,CAAC,OAAO,CAAC,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,EAAE,CAAC,CAClE,CAAA;IACH,CAAC;CACF"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import type { JsonArray, JsonObject } from '../../types/jsonTypes.js';
|
|
1
2
|
import type { MergeResult } from '../../types/mergeResult.js';
|
|
2
3
|
import type { MergeContext } from '../MergeContext.js';
|
|
3
|
-
import
|
|
4
|
-
export declare class AncestorAndOtherStrategy
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
import { AbstractAncestorStrategy } from './AbstractAncestorStrategy.js';
|
|
5
|
+
export declare class AncestorAndOtherStrategy extends AbstractAncestorStrategy {
|
|
6
|
+
protected getTarget(context: MergeContext): unknown;
|
|
7
|
+
protected getExistsInSecondary(context: MergeContext): boolean;
|
|
8
|
+
protected buildConflict(context: MergeContext, targetObj: JsonObject | JsonArray, ancestorObj: JsonObject | JsonArray): JsonArray;
|
|
9
|
+
protected executeWithAttribute(context: MergeContext): MergeResult;
|
|
8
10
|
}
|
|
@@ -1,38 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { noConflict, withConflict } from '../../types/mergeResult.js';
|
|
1
|
+
import { withConflict } from '../../types/mergeResult.js';
|
|
3
2
|
import { buildConflictMarkers } from '../ConflictMarkerBuilder.js';
|
|
4
3
|
import { MergeOrchestrator } from '../MergeOrchestrator.js';
|
|
5
|
-
import {
|
|
6
|
-
export class AncestorAndOtherStrategy {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
if (context.rootKey) {
|
|
10
|
-
const { name, existsInLocal } = context.rootKey;
|
|
11
|
-
if (!existsInLocal && otherUnchanged) {
|
|
12
|
-
return noConflict([]);
|
|
13
|
-
}
|
|
14
|
-
if (!existsInLocal && !otherUnchanged) {
|
|
15
|
-
const ancestorObj = {
|
|
16
|
-
[name]: toJsonArray(context.ancestor),
|
|
17
|
-
};
|
|
18
|
-
const otherObj = {
|
|
19
|
-
[name]: toJsonArray(context.other),
|
|
20
|
-
};
|
|
21
|
-
return withConflict(buildConflictMarkers(context.config, {}, ancestorObj, otherObj));
|
|
22
|
-
}
|
|
23
|
-
return wrapWithRootKey(this.executeNested(context), name);
|
|
24
|
-
}
|
|
25
|
-
if (otherUnchanged) {
|
|
26
|
-
return noConflict([]);
|
|
27
|
-
}
|
|
28
|
-
if (context.attribute) {
|
|
29
|
-
return this.executeWithAttribute(context);
|
|
30
|
-
}
|
|
31
|
-
return withConflict(buildConflictMarkers(context.config, {}, extractContent(toJsonArray(context.ancestor)), extractContent(toJsonArray(context.other))));
|
|
4
|
+
import { AbstractAncestorStrategy } from './AbstractAncestorStrategy.js';
|
|
5
|
+
export class AncestorAndOtherStrategy extends AbstractAncestorStrategy {
|
|
6
|
+
getTarget(context) {
|
|
7
|
+
return context.other;
|
|
32
8
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
9
|
+
getExistsInSecondary(context) {
|
|
10
|
+
return context.rootKey ? context.rootKey.existsInLocal : false;
|
|
11
|
+
}
|
|
12
|
+
buildConflict(context, targetObj, ancestorObj) {
|
|
13
|
+
return buildConflictMarkers(context.config, {}, ancestorObj, targetObj);
|
|
36
14
|
}
|
|
37
15
|
executeWithAttribute(context) {
|
|
38
16
|
const orchestrator = new MergeOrchestrator(context.config, context.nodeFactory);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AncestorAndOtherStrategy.js","sourceRoot":"","sources":["../../../src/merger/strategies/AncestorAndOtherStrategy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AncestorAndOtherStrategy.js","sourceRoot":"","sources":["../../../src/merger/strategies/AncestorAndOtherStrategy.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAA;AAElE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAA;AAExE,MAAM,OAAO,wBAAyB,SAAQ,wBAAwB;IAC1D,SAAS,CAAC,OAAqB;QACvC,OAAO,OAAO,CAAC,KAAK,CAAA;IACtB,CAAC;IAES,oBAAoB,CAAC,OAAqB;QAClD,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAA;IAChE,CAAC;IAES,aAAa,CACrB,OAAqB,EACrB,SAAiC,EACjC,WAAmC;QAEnC,OAAO,oBAAoB,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,EAAE,WAAW,EAAE,SAAS,CAAC,CAAA;IACzE,CAAC;IAES,oBAAoB,CAAC,OAAqB;QAClD,MAAM,YAAY,GAAG,IAAI,iBAAiB,CACxC,OAAO,CAAC,MAAM,EACd,OAAO,CAAC,WAAW,CACpB,CAAA;QACD,MAAM,cAAc,GAAG,YAAY,CAAC,KAAK,CACvC,EAAE,EACF,OAAO,CAAC,QAAQ,EAChB,EAAE,EACF,SAAS,CACV,CAAA;QACD,MAAM,WAAW,GAAG,YAAY,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,KAAK,EAAE,SAAS,CAAC,CAAA;QAExE,MAAM,YAAY,GAAG,EAAE,CAAC,OAAO,CAAC,SAAU,CAAC,EAAE,cAAc,CAAC,MAAM,EAAE,CAAA;QACpE,MAAM,SAAS,GAAG,EAAE,CAAC,OAAO,CAAC,SAAU,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,CAAA;QAE9D,OAAO,YAAY,CACjB,oBAAoB,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,EAAE,YAAY,EAAE,SAAS,CAAC,CAClE,CAAA;IACH,CAAC;CACF"}
|
|
@@ -7,17 +7,23 @@ import { LocalAndOtherStrategy } from './LocalAndOtherStrategy.js';
|
|
|
7
7
|
import { LocalOnlyStrategy } from './LocalOnlyStrategy.js';
|
|
8
8
|
import { NoneStrategy } from './NoneStrategy.js';
|
|
9
9
|
import { OtherOnlyStrategy } from './OtherOnlyStrategy.js';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
10
|
+
let strategies = null;
|
|
11
|
+
const getStrategies = () => {
|
|
12
|
+
if (!strategies) {
|
|
13
|
+
strategies = {
|
|
14
|
+
[MergeScenario.NONE]: new NoneStrategy(),
|
|
15
|
+
[MergeScenario.OTHER_ONLY]: new OtherOnlyStrategy(),
|
|
16
|
+
[MergeScenario.LOCAL_ONLY]: new LocalOnlyStrategy(),
|
|
17
|
+
[MergeScenario.LOCAL_AND_OTHER]: new LocalAndOtherStrategy(),
|
|
18
|
+
[MergeScenario.ANCESTOR_ONLY]: new AncestorOnlyStrategy(),
|
|
19
|
+
[MergeScenario.ANCESTOR_AND_OTHER]: new AncestorAndOtherStrategy(),
|
|
20
|
+
[MergeScenario.ANCESTOR_AND_LOCAL]: new AncestorAndLocalStrategy(),
|
|
21
|
+
[MergeScenario.ALL]: new AllPresentStrategy(),
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
return strategies;
|
|
19
25
|
};
|
|
20
26
|
export const getScenarioStrategy = (scenario) => {
|
|
21
|
-
return
|
|
27
|
+
return getStrategies()[scenario];
|
|
22
28
|
};
|
|
23
29
|
//# sourceMappingURL=ScenarioStrategyFactory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScenarioStrategyFactory.js","sourceRoot":"","sources":["../../../src/merger/strategies/ScenarioStrategyFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAC5D,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAA;AACxE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAA;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAG1D,
|
|
1
|
+
{"version":3,"file":"ScenarioStrategyFactory.js","sourceRoot":"","sources":["../../../src/merger/strategies/ScenarioStrategyFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAC5D,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAA;AACxE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAA;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAG1D,IAAI,UAAU,GAAmD,IAAI,CAAA;AAErE,MAAM,aAAa,GAAG,GAA4C,EAAE;IAClE,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,UAAU,GAAG;YACX,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,IAAI,YAAY,EAAE;YACxC,CAAC,aAAa,CAAC,UAAU,CAAC,EAAE,IAAI,iBAAiB,EAAE;YACnD,CAAC,aAAa,CAAC,UAAU,CAAC,EAAE,IAAI,iBAAiB,EAAE;YACnD,CAAC,aAAa,CAAC,eAAe,CAAC,EAAE,IAAI,qBAAqB,EAAE;YAC5D,CAAC,aAAa,CAAC,aAAa,CAAC,EAAE,IAAI,oBAAoB,EAAE;YACzD,CAAC,aAAa,CAAC,kBAAkB,CAAC,EAAE,IAAI,wBAAwB,EAAE;YAClE,CAAC,aAAa,CAAC,kBAAkB,CAAC,EAAE,IAAI,wBAAwB,EAAE;YAClE,CAAC,aAAa,CAAC,GAAG,CAAC,EAAE,IAAI,kBAAkB,EAAE;SAC9C,CAAA;IACH,CAAC;IACD,OAAO,UAAU,CAAA;AACnB,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,QAAuB,EACL,EAAE;IACpB,OAAO,aAAa,EAAE,CAAC,QAAQ,CAAC,CAAA;AAClC,CAAC,CAAA"}
|
|
@@ -2,7 +2,7 @@ import type { MergeConfig } from '../../types/conflictTypes.js';
|
|
|
2
2
|
import type { JsonObject } from '../../types/jsonTypes.js';
|
|
3
3
|
import type { MergeResult } from '../../types/mergeResult.js';
|
|
4
4
|
import { MergeScenario } from '../../types/mergeScenario.js';
|
|
5
|
-
|
|
5
|
+
interface TextMergeStrategy {
|
|
6
6
|
handle(config: MergeConfig, objAncestor: JsonObject, objLocal: JsonObject, objOther: JsonObject, ancestor: unknown, local: unknown, other: unknown): MergeResult;
|
|
7
7
|
}
|
|
8
8
|
export declare class OtherOnlyStrategy implements TextMergeStrategy {
|
|
@@ -30,3 +30,4 @@ export declare class NoneStrategy implements TextMergeStrategy {
|
|
|
30
30
|
handle(): MergeResult;
|
|
31
31
|
}
|
|
32
32
|
export declare const getTextMergeStrategy: (scenario: MergeScenario) => TextMergeStrategy;
|
|
33
|
+
export {};
|