sf-git-merge-driver 1.6.1 → 1.8.0
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 +161 -27
- package/bin/merge-driver.cjs +39 -0
- package/lib/adapter/TxmlXmlParser.d.ts +13 -0
- package/lib/adapter/TxmlXmlParser.js +315 -0
- package/lib/adapter/TxmlXmlParser.js.map +1 -0
- package/lib/adapter/XmlParser.d.ts +4 -2
- package/lib/adapter/XmlSerializer.d.ts +2 -1
- package/lib/adapter/writer/XmlStreamWriter.d.ts +9 -0
- package/lib/adapter/writer/XmlStreamWriter.js +373 -0
- package/lib/adapter/writer/XmlStreamWriter.js.map +1 -0
- package/lib/bin/driver.d.ts +12 -0
- package/lib/bin/driver.js +124 -0
- package/lib/bin/driver.js.map +1 -0
- package/lib/commands/git/merge/driver/install.d.ts +24 -1
- package/lib/commands/git/merge/driver/install.js +118 -9
- package/lib/commands/git/merge/driver/install.js.map +1 -1
- package/lib/commands/git/merge/driver/run.d.ts +5 -0
- package/lib/commands/git/merge/driver/run.js +15 -2
- package/lib/commands/git/merge/driver/run.js.map +1 -1
- package/lib/commands/git/merge/driver/uninstall.d.ts +3 -1
- package/lib/commands/git/merge/driver/uninstall.js +18 -4
- package/lib/commands/git/merge/driver/uninstall.js.map +1 -1
- package/lib/constant/conflictConstant.d.ts +1 -0
- package/lib/constant/conflictConstant.js +3 -0
- package/lib/constant/conflictConstant.js.map +1 -1
- package/lib/constant/driverConstant.d.ts +0 -1
- package/lib/constant/driverConstant.js +0 -1
- package/lib/constant/driverConstant.js.map +1 -1
- package/lib/constant/gitConstant.d.ts +0 -1
- package/lib/constant/gitConstant.js +0 -1
- package/lib/constant/gitConstant.js.map +1 -1
- package/lib/constant/parserConstant.d.ts +0 -1
- package/lib/constant/parserConstant.js +0 -1
- package/lib/constant/parserConstant.js.map +1 -1
- package/lib/driver/MergeDriver.js +69 -16
- package/lib/driver/MergeDriver.js.map +1 -1
- package/lib/merger/JsonMerger.d.ts +1 -1
- package/lib/merger/JsonMerger.js +11 -4
- package/lib/merger/JsonMerger.js.map +1 -1
- package/lib/merger/MergeContext.d.ts +3 -3
- package/lib/merger/MergeOrchestrator.d.ts +1 -1
- package/lib/merger/MergeOrchestrator.js.map +1 -1
- package/lib/merger/MergeScenarioFactory.d.ts +1 -1
- package/lib/merger/MergeScenarioFactory.js.map +1 -1
- package/lib/merger/XmlMerger.d.ts +4 -4
- package/lib/merger/XmlMerger.js +26 -18
- package/lib/merger/XmlMerger.js.map +1 -1
- package/lib/merger/nodes/KeyedArrayIndex.d.ts +12 -0
- package/lib/merger/nodes/KeyedArrayIndex.js +24 -0
- package/lib/merger/nodes/KeyedArrayIndex.js.map +1 -1
- package/lib/merger/nodes/KeyedArrayMergeNode.js +4 -14
- package/lib/merger/nodes/KeyedArrayMergeNode.js.map +1 -1
- package/lib/merger/nodes/MergeNodeFactory.d.ts +2 -2
- package/lib/merger/nodes/MergeNodeFactory.js.map +1 -1
- package/lib/merger/nodes/OrderedKeyedArrayMergeStrategy.js +10 -9
- package/lib/merger/nodes/OrderedKeyedArrayMergeStrategy.js.map +1 -1
- package/lib/merger/nodes/PropertyMergeNode.d.ts +1 -1
- package/lib/merger/nodes/PropertyMergeNode.js +6 -4
- package/lib/merger/nodes/PropertyMergeNode.js.map +1 -1
- package/lib/merger/nodes/TextMergeNode.d.ts +1 -1
- package/lib/merger/nodes/TextMergeNode.js +3 -0
- package/lib/merger/nodes/TextMergeNode.js.map +1 -1
- package/lib/merger/strategies/ScenarioStrategy.js +24 -19
- package/lib/merger/strategies/ScenarioStrategy.js.map +1 -1
- package/lib/service/GitAttributesPlanner.d.ts +130 -0
- package/lib/service/GitAttributesPlanner.js +196 -0
- package/lib/service/GitAttributesPlanner.js.map +1 -0
- package/lib/service/InstallReports.d.ts +16 -0
- package/lib/service/InstallReports.js +113 -0
- package/lib/service/InstallReports.js.map +1 -0
- package/lib/service/InstallService.d.ts +72 -1
- package/lib/service/InstallService.js +162 -13
- package/lib/service/InstallService.js.map +1 -1
- package/lib/service/MetadataService.js +1 -1
- package/lib/service/MetadataService.js.map +1 -1
- package/lib/service/UninstallService.d.ts +30 -1
- package/lib/service/UninstallService.js +89 -21
- package/lib/service/UninstallService.js.map +1 -1
- package/lib/types/jsonTypes.d.ts +17 -0
- package/lib/types/jsonTypes.js +17 -1
- package/lib/types/jsonTypes.js.map +1 -1
- package/lib/types/mergeResult.d.ts +3 -3
- package/lib/types/mergeResult.js.map +1 -1
- package/lib/utils/LoggingDecorator.d.ts +1 -1
- package/lib/utils/LoggingDecorator.js +31 -15
- package/lib/utils/LoggingDecorator.js.map +1 -1
- package/lib/utils/LoggingService.d.ts +22 -10
- package/lib/utils/LoggingService.js +99 -34
- package/lib/utils/LoggingService.js.map +1 -1
- package/lib/utils/arrayUtils.d.ts +3 -3
- package/lib/utils/arrayUtils.js +15 -6
- package/lib/utils/arrayUtils.js.map +1 -1
- package/lib/utils/gitAttributesFile.d.ts +73 -0
- package/lib/utils/gitAttributesFile.js +156 -0
- package/lib/utils/gitAttributesFile.js.map +1 -0
- package/lib/utils/gitUtils.js +5 -2
- package/lib/utils/gitUtils.js.map +1 -1
- package/lib/utils/jsonEqual.d.ts +10 -0
- package/lib/utils/jsonEqual.js +45 -0
- package/lib/utils/jsonEqual.js.map +1 -0
- package/lib/utils/peekEol.d.ts +1 -0
- package/lib/utils/peekEol.js +32 -0
- package/lib/utils/peekEol.js.map +1 -0
- package/lib/utils/setUtils.d.ts +2 -2
- package/lib/utils/setUtils.js.map +1 -1
- package/messages/install.md +24 -2
- package/messages/run.md +2 -0
- package/messages/uninstall.md +10 -2
- package/npm-shrinkwrap.json +1546 -1589
- package/oclif.manifest.json +47 -8
- package/package.json +107 -23
- package/lib/adapter/FlxXmlParser.d.ts +0 -5
- package/lib/adapter/FlxXmlParser.js +0 -47
- package/lib/adapter/FlxXmlParser.js.map +0 -1
- package/lib/adapter/FxpXmlSerializer.d.ts +0 -10
- package/lib/adapter/FxpXmlSerializer.js +0 -106
- package/lib/adapter/FxpXmlSerializer.js.map +0 -1
- package/lib/merger/ConflictMarkerFormatter.d.ts +0 -14
- package/lib/merger/ConflictMarkerFormatter.js +0 -39
- package/lib/merger/ConflictMarkerFormatter.js.map +0 -1
package/README.md
CHANGED
|
@@ -94,6 +94,12 @@ cd my/sf/project
|
|
|
94
94
|
sf git merge driver install
|
|
95
95
|
```
|
|
96
96
|
|
|
97
|
+
> **Upgrading from a previous version:** re-run `sf git merge driver install` in each repository after upgrading. Recent releases route conflicts through a bundled standalone binary (~80 ms per file instead of ~600 ms via the oclif command) — a 200-file rebase drops from ~120 s to ~16 s of merge-driver overhead. Previously-installed `.git/config` entries keep working via the retained oclif command, but do not receive the speedup until reinstall.
|
|
98
|
+
>
|
|
99
|
+
> Re-installing also wires git's `%S` placeholder into conflict markers: the ancestor-marker label now reflects git's own label (typically a short SHA) instead of the static `base` string. See the CHANGELOG for the exact before/after.
|
|
100
|
+
>
|
|
101
|
+
> **Safe install on upgrade.** If another merge driver is already configured on one of our metadata globs (e.g. a different Salesforce tool added its own `.git/info/attributes` line), install now aborts with a conflict report instead of silently stacking up. Use `--on-conflict=skip` to leave those globs alone, `--on-conflict=overwrite` (or `--force`) to take them over — in which case uninstall will restore the originals from an annotation comment. Add `--dry-run` to preview any install/uninstall plan before writing.
|
|
102
|
+
|
|
97
103
|
### Integration in VsCode SFDX-Hardis
|
|
98
104
|
|
|
99
105
|
[SFDX-Hardis VS Code extension](https://marketplace.visualstudio.com/items?itemName=NicolasVuillamy.vscode-sfdx-hardis) has integrated the sf-git-merge-driver in its default dependencies, and offers a one click activation of the merge driver from the status bar, as shown below:
|
|
@@ -209,6 +215,68 @@ The plugin will add content in the file `$GIT_DIR/info/attributes` to enable the
|
|
|
209
215
|
This files need to be present for the plugin to be installed.
|
|
210
216
|
Ensure the repository is properly cloned / checked out in CI/CD context before installing the plugin.
|
|
211
217
|
|
|
218
|
+
## Advanced: direct binary invocation (for scripts)
|
|
219
|
+
|
|
220
|
+
Most users never invoke the driver directly — git does. But for scripted recovery
|
|
221
|
+
(e.g. replaying a merge after a botched rebase, batch-resolving conflicts in CI,
|
|
222
|
+
or diagnosing a specific file pair) you can call the bundled binary directly. It
|
|
223
|
+
has no sf CLI / oclif startup cost (~37 ms cold vs ~500 ms via `sf git merge driver run`,
|
|
224
|
+
which is why git itself also bypasses the sf CLI once `sf git merge driver install`
|
|
225
|
+
has been run).
|
|
226
|
+
|
|
227
|
+
Locate the binary from the sf-installed plugin (no separate `npm install -g` needed —
|
|
228
|
+
this is the same copy git uses, so there is no version-drift risk):
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
# Unix/Linux version — Resolve the plugin root from sf's plugin registry (user-installed plugins)
|
|
232
|
+
PLUGIN_ROOT=$(dirname "$(sf plugins inspect sf-git-merge-driver --json | jq -r '.[0].options.root')")/node_modules/sf-git-merge-driver
|
|
233
|
+
DRIVER="$PLUGIN_ROOT/bin/merge-driver.cjs"
|
|
234
|
+
|
|
235
|
+
# Powershell version — Resolve the plugin root from sf's plugin registry (user-installed plugins)
|
|
236
|
+
$DRIVER = Join-Path (Join-Path (Split-Path ((sf plugins inspect sf-git-merge-driver --json | ConvertFrom-Json)[0].options.root) -Parent) "node_modules/sf-git-merge-driver") "bin/merge-driver.cjs"
|
|
237
|
+
|
|
238
|
+
# Execution
|
|
239
|
+
# POSIX — the binary has a shebang and +x, so it's directly executable:
|
|
240
|
+
"$DRIVER" -O base.xml -A local.xml -B other.xml -P merged.xml
|
|
241
|
+
|
|
242
|
+
# Windows / anywhere shebangs aren't honoured, invoke via node explicitly:
|
|
243
|
+
node "$DRIVER" -O base.xml -A local.xml -B other.xml -P merged.xml
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
**Flags** (git's merge-driver `%O %A %B %P` convention):
|
|
247
|
+
|
|
248
|
+
- `-O` ancestor file, `-A` local file, `-B` other file, `-P` output file — the
|
|
249
|
+
merged result is written back over `-A` (matching git's merge-driver contract);
|
|
250
|
+
`-P` is accepted for compatibility but not used as the output target.
|
|
251
|
+
- `-L` conflict marker size (1–100, default 7).
|
|
252
|
+
- `-S` / `-X` / `-Y` conflict tag labels for ancestor / local / other.
|
|
253
|
+
|
|
254
|
+
**Exit codes** (scripts should branch on these, not on stderr content):
|
|
255
|
+
|
|
256
|
+
- `0` — clean merge, no conflict markers written.
|
|
257
|
+
- `1` — merge completed with conflict markers in the output.
|
|
258
|
+
- `2` — usage error (missing/unreadable file, bad flag, unsupported Node version).
|
|
259
|
+
|
|
260
|
+
**Example — batch-resolve all profile conflicts in the working tree:**
|
|
261
|
+
|
|
262
|
+
```bash
|
|
263
|
+
PLUGIN_ROOT=$(dirname "$(sf plugins inspect sf-git-merge-driver --json | jq -r '.[0].options.root')")/node_modules/sf-git-merge-driver
|
|
264
|
+
DRIVER="$PLUGIN_ROOT/bin/merge-driver.cjs"
|
|
265
|
+
|
|
266
|
+
for f in $(git diff --name-only --diff-filter=U | grep '\.profile-meta\.xml$'); do
|
|
267
|
+
git show :1:"$f" > /tmp/base.xml # :1: = common ancestor
|
|
268
|
+
git show :2:"$f" > /tmp/local.xml # :2: = our side
|
|
269
|
+
git show :3:"$f" > /tmp/other.xml # :3: = their side
|
|
270
|
+
node "$DRIVER" -O /tmp/base.xml -A /tmp/local.xml -B /tmp/other.xml -P /tmp/merged.xml || true
|
|
271
|
+
cp /tmp/local.xml "$f" # -A receives the merged (or conflict-marked) result
|
|
272
|
+
done
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
> `sf git merge driver run` is a thin oclif wrapper kept only for backward
|
|
276
|
+
> compatibility with `.git/config` entries generated by sf-git-merge-driver ≤ 1.5.
|
|
277
|
+
> It is deprecated and scheduled for removal in the next major release. Use the
|
|
278
|
+
> binary directly for scripts.
|
|
279
|
+
|
|
212
280
|
## Behavior when the merge driver does not know the key
|
|
213
281
|
|
|
214
282
|
If the merge driver encounters a list of elements (like fields in a profile, or permissions in a permission set) but does not know which field acts as the "key" (unique identifier) for that type, it will fallback to standard conflict behavior.
|
|
@@ -249,22 +317,28 @@ git merge ...
|
|
|
249
317
|
|
|
250
318
|
## `sf git merge driver disable`
|
|
251
319
|
|
|
252
|
-
Uninstalls the local git merge driver
|
|
320
|
+
Uninstalls the local git merge driver from the current project.
|
|
253
321
|
|
|
254
322
|
```
|
|
255
323
|
USAGE
|
|
256
|
-
$ sf git merge driver disable [--json] [--flags-dir <value>]
|
|
324
|
+
$ sf git merge driver disable [--json] [--flags-dir <value>] [--dry-run]
|
|
325
|
+
|
|
326
|
+
FLAGS
|
|
327
|
+
--dry-run Plan the uninstall without touching git config or .git/info/attributes. Exits 0; shows what would be
|
|
328
|
+
removed.
|
|
257
329
|
|
|
258
330
|
GLOBAL FLAGS
|
|
259
331
|
--flags-dir=<value> Import flag values from a directory.
|
|
260
332
|
--json Format output as json.
|
|
261
333
|
|
|
262
334
|
DESCRIPTION
|
|
263
|
-
Uninstalls the local git merge driver
|
|
335
|
+
Uninstalls the local git merge driver from the current project.
|
|
264
336
|
|
|
265
|
-
|
|
266
|
-
`.git/info/attributes
|
|
267
|
-
|
|
337
|
+
Removes the `merge.salesforce-source` section from `.git/config` and strips the driver's rules from
|
|
338
|
+
`.git/info/attributes`. Lines that combined the driver with user attributes (e.g. `*.profile-meta.xml text=auto
|
|
339
|
+
merge=salesforce-source`) are rewritten to keep the user attributes; only the `merge=` token is removed. If a previous
|
|
340
|
+
install used `--on-conflict=overwrite`, the original driver rule is restored from the annotation comment written at
|
|
341
|
+
install time. `--dry-run` previews the plan without writing.
|
|
268
342
|
|
|
269
343
|
ALIASES
|
|
270
344
|
$ sf git merge driver disable
|
|
@@ -273,26 +347,43 @@ EXAMPLES
|
|
|
273
347
|
Uninstall the driver for a given project:
|
|
274
348
|
|
|
275
349
|
$ sf git merge driver disable
|
|
350
|
+
|
|
351
|
+
Preview the changes that would be written:
|
|
352
|
+
|
|
353
|
+
$ sf git merge driver disable --dry-run
|
|
276
354
|
```
|
|
277
355
|
|
|
278
356
|
## `sf git merge driver enable`
|
|
279
357
|
|
|
280
|
-
Installs a local git merge driver for
|
|
358
|
+
Installs a local git merge driver for Salesforce metadata in the current project.
|
|
281
359
|
|
|
282
360
|
```
|
|
283
361
|
USAGE
|
|
284
|
-
$ sf git merge driver enable [--json] [--flags-dir <value>]
|
|
362
|
+
$ sf git merge driver enable [--json] [--flags-dir <value>] [--dry-run] [--on-conflict abort|skip|overwrite] [--force]
|
|
363
|
+
|
|
364
|
+
FLAGS
|
|
365
|
+
--dry-run Plan the install without writing to git config or .git/info/attributes. Exits 0; shows the
|
|
366
|
+
list of rules that would be added/skipped/conflict.
|
|
367
|
+
--force Alias for --on-conflict=overwrite. Non-interactive shortcut for CI.
|
|
368
|
+
--on-conflict=<option> [default: abort] How to handle patterns already owned by another merge driver in
|
|
369
|
+
.git/info/attributes. Default: abort (refuse to change anything).
|
|
370
|
+
<options: abort|skip|overwrite>
|
|
285
371
|
|
|
286
372
|
GLOBAL FLAGS
|
|
287
373
|
--flags-dir=<value> Import flag values from a directory.
|
|
288
374
|
--json Format output as json.
|
|
289
375
|
|
|
290
376
|
DESCRIPTION
|
|
291
|
-
Installs a local git merge driver for
|
|
377
|
+
Installs a local git merge driver for Salesforce metadata in the current project.
|
|
378
|
+
|
|
379
|
+
Registers the driver in `.git/config` and adds one merge rule per Salesforce metadata glob to `.git/info/attributes`.
|
|
380
|
+
Safe to re-run: install is idempotent, preserves any user attributes already on the globs, and dedupes legacy
|
|
381
|
+
duplicate rules silently.
|
|
292
382
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
the
|
|
383
|
+
If another merge driver is already configured on one of our globs, install aborts by default and lists the conflicts.
|
|
384
|
+
Pass `--on-conflict=skip` to leave those globs to the other driver, `--on-conflict=overwrite` (or `--force`) to take
|
|
385
|
+
them over (uninstall restores the originals), or run the command from a TTY to be prompted interactively. `--dry-run`
|
|
386
|
+
previews the plan without writing.
|
|
296
387
|
|
|
297
388
|
ALIASES
|
|
298
389
|
$ sf git merge driver enable
|
|
@@ -301,26 +392,48 @@ EXAMPLES
|
|
|
301
392
|
Install the driver for a given project:
|
|
302
393
|
|
|
303
394
|
$ sf git merge driver enable
|
|
395
|
+
|
|
396
|
+
Preview the changes that would be written:
|
|
397
|
+
|
|
398
|
+
$ sf git merge driver enable --dry-run
|
|
399
|
+
|
|
400
|
+
Take over conflicting globs non-interactively (for CI):
|
|
401
|
+
|
|
402
|
+
$ sf git merge driver enable --force
|
|
304
403
|
```
|
|
305
404
|
|
|
306
405
|
## `sf git merge driver install`
|
|
307
406
|
|
|
308
|
-
Installs a local git merge driver for
|
|
407
|
+
Installs a local git merge driver for Salesforce metadata in the current project.
|
|
309
408
|
|
|
310
409
|
```
|
|
311
410
|
USAGE
|
|
312
|
-
$ sf git merge driver install [--json] [--flags-dir <value>]
|
|
411
|
+
$ sf git merge driver install [--json] [--flags-dir <value>] [--dry-run] [--on-conflict abort|skip|overwrite]
|
|
412
|
+
[--force]
|
|
413
|
+
|
|
414
|
+
FLAGS
|
|
415
|
+
--dry-run Plan the install without writing to git config or .git/info/attributes. Exits 0; shows the
|
|
416
|
+
list of rules that would be added/skipped/conflict.
|
|
417
|
+
--force Alias for --on-conflict=overwrite. Non-interactive shortcut for CI.
|
|
418
|
+
--on-conflict=<option> [default: abort] How to handle patterns already owned by another merge driver in
|
|
419
|
+
.git/info/attributes. Default: abort (refuse to change anything).
|
|
420
|
+
<options: abort|skip|overwrite>
|
|
313
421
|
|
|
314
422
|
GLOBAL FLAGS
|
|
315
423
|
--flags-dir=<value> Import flag values from a directory.
|
|
316
424
|
--json Format output as json.
|
|
317
425
|
|
|
318
426
|
DESCRIPTION
|
|
319
|
-
Installs a local git merge driver for
|
|
427
|
+
Installs a local git merge driver for Salesforce metadata in the current project.
|
|
320
428
|
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
429
|
+
Registers the driver in `.git/config` and adds one merge rule per Salesforce metadata glob to `.git/info/attributes`.
|
|
430
|
+
Safe to re-run: install is idempotent, preserves any user attributes already on the globs, and dedupes legacy
|
|
431
|
+
duplicate rules silently.
|
|
432
|
+
|
|
433
|
+
If another merge driver is already configured on one of our globs, install aborts by default and lists the conflicts.
|
|
434
|
+
Pass `--on-conflict=skip` to leave those globs to the other driver, `--on-conflict=overwrite` (or `--force`) to take
|
|
435
|
+
them over (uninstall restores the originals), or run the command from a TTY to be prompted interactively. `--dry-run`
|
|
436
|
+
previews the plan without writing.
|
|
324
437
|
|
|
325
438
|
ALIASES
|
|
326
439
|
$ sf git merge driver enable
|
|
@@ -329,9 +442,17 @@ EXAMPLES
|
|
|
329
442
|
Install the driver for a given project:
|
|
330
443
|
|
|
331
444
|
$ sf git merge driver install
|
|
445
|
+
|
|
446
|
+
Preview the changes that would be written:
|
|
447
|
+
|
|
448
|
+
$ sf git merge driver install --dry-run
|
|
449
|
+
|
|
450
|
+
Take over conflicting globs non-interactively (for CI):
|
|
451
|
+
|
|
452
|
+
$ sf git merge driver install --force
|
|
332
453
|
```
|
|
333
454
|
|
|
334
|
-
_See code: [src/commands/git/merge/driver/install.ts](https://github.com/scolladon/sf-git-merge-driver/blob/v1.
|
|
455
|
+
_See code: [src/commands/git/merge/driver/install.ts](https://github.com/scolladon/sf-git-merge-driver/blob/v1.8.0/src/commands/git/merge/driver/install.ts)_
|
|
335
456
|
|
|
336
457
|
## `sf git merge driver run`
|
|
337
458
|
|
|
@@ -359,6 +480,9 @@ GLOBAL FLAGS
|
|
|
359
480
|
DESCRIPTION
|
|
360
481
|
Runs the merge driver for the specified files.
|
|
361
482
|
|
|
483
|
+
DEPRECATED — will be removed in the next major release. Run `sf git merge driver install` in the repository to upgrade
|
|
484
|
+
to the faster standalone binary driver.
|
|
485
|
+
|
|
362
486
|
Runs the merge driver for the specified files, handling the merge conflict resolution using Salesforce-specific merge
|
|
363
487
|
strategies. This command is typically called automatically by Git when a merge conflict is detected.
|
|
364
488
|
|
|
@@ -375,26 +499,32 @@ EXAMPLES
|
|
|
375
499
|
- output-file is the path to the file where the merged content will be written
|
|
376
500
|
```
|
|
377
501
|
|
|
378
|
-
_See code: [src/commands/git/merge/driver/run.ts](https://github.com/scolladon/sf-git-merge-driver/blob/v1.
|
|
502
|
+
_See code: [src/commands/git/merge/driver/run.ts](https://github.com/scolladon/sf-git-merge-driver/blob/v1.8.0/src/commands/git/merge/driver/run.ts)_
|
|
379
503
|
|
|
380
504
|
## `sf git merge driver uninstall`
|
|
381
505
|
|
|
382
|
-
Uninstalls the local git merge driver
|
|
506
|
+
Uninstalls the local git merge driver from the current project.
|
|
383
507
|
|
|
384
508
|
```
|
|
385
509
|
USAGE
|
|
386
|
-
$ sf git merge driver uninstall [--json] [--flags-dir <value>]
|
|
510
|
+
$ sf git merge driver uninstall [--json] [--flags-dir <value>] [--dry-run]
|
|
511
|
+
|
|
512
|
+
FLAGS
|
|
513
|
+
--dry-run Plan the uninstall without touching git config or .git/info/attributes. Exits 0; shows what would be
|
|
514
|
+
removed.
|
|
387
515
|
|
|
388
516
|
GLOBAL FLAGS
|
|
389
517
|
--flags-dir=<value> Import flag values from a directory.
|
|
390
518
|
--json Format output as json.
|
|
391
519
|
|
|
392
520
|
DESCRIPTION
|
|
393
|
-
Uninstalls the local git merge driver
|
|
521
|
+
Uninstalls the local git merge driver from the current project.
|
|
394
522
|
|
|
395
|
-
|
|
396
|
-
`.git/info/attributes
|
|
397
|
-
|
|
523
|
+
Removes the `merge.salesforce-source` section from `.git/config` and strips the driver's rules from
|
|
524
|
+
`.git/info/attributes`. Lines that combined the driver with user attributes (e.g. `*.profile-meta.xml text=auto
|
|
525
|
+
merge=salesforce-source`) are rewritten to keep the user attributes; only the `merge=` token is removed. If a previous
|
|
526
|
+
install used `--on-conflict=overwrite`, the original driver rule is restored from the annotation comment written at
|
|
527
|
+
install time. `--dry-run` previews the plan without writing.
|
|
398
528
|
|
|
399
529
|
ALIASES
|
|
400
530
|
$ sf git merge driver disable
|
|
@@ -403,9 +533,13 @@ EXAMPLES
|
|
|
403
533
|
Uninstall the driver for a given project:
|
|
404
534
|
|
|
405
535
|
$ sf git merge driver uninstall
|
|
536
|
+
|
|
537
|
+
Preview the changes that would be written:
|
|
538
|
+
|
|
539
|
+
$ sf git merge driver uninstall --dry-run
|
|
406
540
|
```
|
|
407
541
|
|
|
408
|
-
_See code: [src/commands/git/merge/driver/uninstall.ts](https://github.com/scolladon/sf-git-merge-driver/blob/v1.
|
|
542
|
+
_See code: [src/commands/git/merge/driver/uninstall.ts](https://github.com/scolladon/sf-git-merge-driver/blob/v1.8.0/src/commands/git/merge/driver/uninstall.ts)_
|
|
409
543
|
<!-- commandsstop -->
|
|
410
544
|
|
|
411
545
|
## Changelog
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
try { const v = process.versions.node.split(".").map(Number); if (v[0] > 22 || (v[0] === 22 && v[1] >= 8)) require("node:module").enableCompileCache(); } catch {}
|
|
3
|
+
"use strict";var Ee=Object.defineProperty;var ur=Object.getOwnPropertyDescriptor;var fr=Object.getOwnPropertyNames;var hr=Object.prototype.hasOwnProperty;var pr=(e,t)=>{for(var r in t)Ee(e,r,{get:t[r],enumerable:!0})},dr=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of fr(t))!hr.call(e,o)&&o!==r&&Ee(e,o,{get:()=>t[o],enumerable:!(n=ur(t,o))||n.enumerable});return e};var mr=e=>dr(Ee({},"__esModule",{value:!0}),e);var mn={};pr(mn,{assertNodeVersion:()=>rr,main:()=>or,parseArgs:()=>nr});module.exports=mr(mn);var Oe="base",Ce="ours",Te="theirs";function I(e,t,r,n){var o=arguments.length,s=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s}var ge=require("node:fs"),ye=require("node:fs/promises"),it=require("node:path"),Qt=require("node:stream/promises");function dt(e,t){"txml";t=t||{};var r=t.pos||0,n=!!t.keepComments,o=!!t.keepWhitespace,s="<",i=60,a=">",l=62,u=45,h=47,p=33,f=39,m=34,y=91,x=93;function ft(w){for(var b=[];e[r];)if(e.charCodeAt(r)==i){if(e.charCodeAt(r+1)===h){var P=r+2;r=e.indexOf(a,r);var k=e.substring(P,r);if(k.indexOf(w)==-1){var V=e.substring(0,r).split(`
|
|
4
|
+
`);throw new Error(`Unexpected close tag
|
|
5
|
+
Line: `+(V.length-1)+`
|
|
6
|
+
Column: `+(V[V.length-1].length+1)+`
|
|
7
|
+
Char: `+e[r])}return r+1&&(r+=1),b}else if(e.charCodeAt(r+1)===p){if(e.charCodeAt(r+2)==u){let Ae=r;for(;r!==-1&&!(e.charCodeAt(r)===l&&e.charCodeAt(r-1)==u&&e.charCodeAt(r-2)==u&&r!=-1);)r=e.indexOf(a,r+1);r===-1&&(r=e.length),n&&b.push(e.substring(Ae,r+1))}else if(e.charCodeAt(r+2)===y&&e.charCodeAt(r+8)===y&&e.substr(r+3,5).toLowerCase()==="cdata"){var _=e.indexOf("]]>",r);_==-1?(b.push(e.substr(r+9)),r=e.length):(b.push(e.substring(r+9,_)),r=_+3);continue}else{let Ae=r+1;r+=2;for(var F=!1;(e.charCodeAt(r)!==l||F===!0)&&e[r];)e.charCodeAt(r)===y?F=!0:F===!0&&e.charCodeAt(r)===x&&(F=!1),r++;b.push(e.substring(Ae,r))}r++;continue}var S=be();b.push(S),S.tagName[0]==="?"&&(b.push(...S.children),S.children=[])}else{var _e=sr();if(o)_e.length>0&&b.push(_e);else{var pt=_e.trim();pt.length>0&&b.push(pt)}r++}return b}function sr(){var w=r;return r=e.indexOf(s,r)-1,r===-2&&(r=e.length),e.slice(w,r+1)}var ir=`\r
|
|
8
|
+
>/= `;function ht(){for(var w=r;ir.indexOf(e[r])===-1&&e[r];)r++;return e.slice(w,r)}var ar=t.noChildNodes||["img","br","input","meta","link","hr"];function be(){r++;let w=ht(),b={},P=[];for(;e.charCodeAt(r)!==l&&e[r];){var k=e.charCodeAt(r);if(k>64&&k<91||k>96&&k<123){for(var V=ht(),_=e.charCodeAt(r);_&&_!==f&&_!==m&&!(_>64&&_<91||_>96&&_<123)&&_!==l;)r++,_=e.charCodeAt(r);if(_===f||_===m){var F=cr();if(r===-1)return{tagName:w,attributes:b,children:P}}else F=null,r--;b[V]=F}r++}if(e.charCodeAt(r-1)!==h)if(w=="script"){var S=r+1;r=e.indexOf("</script>",r),P=[e.slice(S,r)],r+=9}else if(w=="style"){var S=r+1;r=e.indexOf("</style>",r),P=[e.slice(S,r)],r+=8}else ar.indexOf(w)===-1?(r++,P=ft(w)):r++;else r++;return{tagName:w,attributes:b,children:P}}function cr(){var w=e[r],b=r+1;return r=e.indexOf(w,b),e.slice(b,r)}function lr(){var w=new RegExp("\\s"+t.attrName+`\\s*=['"]`+t.attrValue+`['"]`).exec(e);return w?w.index:-1}var N=null;if(t.attrValue!==void 0){t.attrName=t.attrName||"id";for(var N=[];(r=lr())!==-1;)r=e.lastIndexOf("<",r),r!==-1&&N.push(be()),e=e.substr(r),r=0}else t.parseNode?N=be():N=ft("");return t.filter&&(N=gt(N,t.filter)),t.simplify?mt(Array.isArray(N)?N:[N]):(t.setPos&&(N.pos=r),N)}function mt(e){var t={};if(!e.length)return"";if(e.length===1&&typeof e[0]=="string")return e[0];e.forEach(function(n){if(typeof n=="object"){t[n.tagName]||(t[n.tagName]=[]);var o=mt(n.children);t[n.tagName].push(o),Object.keys(n.attributes).length&&typeof o!="string"&&(o._attributes=n.attributes)}});for(var r in t)t[r].length==1&&(t[r]=t[r][0]);return t}function gt(e,t,r=0,n=""){var o=[];return e.forEach(function(s,i){if(typeof s=="object"&&t(s,i,r,n)&&o.push(s),s.children){var a=gt(s.children,t,r+1,(n?n+".":"")+i+"."+s.tagName);o=o.concat(a)}}),o}var yt=`<?xml version="1.0" encoding="UTF-8"?>
|
|
9
|
+
`,W="#xml__comment",B="__cdata",wt=" ";var gr=dt,At="@_",Z="#text",yr=/^xmlns(?::.+)?$/,wr=/^<!--([\s\S]*?)-->$/,Ne="\0cdata\0",br=/<!\[CDATA\[([\s\S]*?)\]\]>/g,_r=e=>e.replace(br,(t,r)=>{let n=r.replace(/&/g,"&").replace(/</g,"<");return`<${Ne}>${n}</${Ne}>`}),Ar=e=>e.replace(/</g,"<").replace(/&/g,"&"),bt=(e,t)=>{let r=null;for(let n=t;n<e.length;n++){let o=e[n];if(r!==null){o===r&&(r=null);continue}if(o==='"'||o==="'"){r=o;continue}if(o===">")return n}return-1},Er=e=>{let t=0,r=0;for(;r<e.length;){let n=e.indexOf("<",r);if(n<0)break;if(e.startsWith("<!--",n)){let i=e.indexOf("-->",n+4);if(i<0)throw new Error("XML parse error: unterminated comment");r=i+3;continue}if(e.startsWith("<!",n)){let i=bt(e,n+2);if(i<0)throw new Error("XML parse error: unterminated <! ... >");r=i+1;continue}if(e.startsWith("<?",n)){let i=e.indexOf("?>",n+2);if(i<0)throw new Error("XML parse error: unterminated <? ?>");r=i+2;continue}let o=bt(e,n+1);if(o<0)throw new Error("XML parse error: unterminated tag");let s=e.slice(n+1,o);s.startsWith("/")?t--:s.endsWith("/")||t++,r=o+1}if(t!==0)throw new Error(`XML parse error: tags unbalanced (final depth ${t.toString()})`)},Or=e=>{let t="",r=new Map,n=(o,s)=>{let i=r.get(o);i?i.push(s):r.set(o,[s])};for(let o of e){if(typeof o=="string"){let s=o.match(wr);if(s!==null){n(W,s[1]);continue}t+=o;continue}if(o.tagName===Ne){n(B,Ar(Cr(o)));continue}n(o.tagName,Et(o))}return{textBuf:t,grouped:r}},Cr=e=>{let t="";for(let r of e.children)typeof r=="string"&&(t+=r);return t},Tr=e=>{let t=Object.keys(e);return t.length===1&&t[0]===Z?e[Z]:e},Et=e=>{let t=e.children.length===0,r=Object.keys(e.attributes).length===0;if(t&&r)return"";let{textBuf:n,grouped:o}=Or(e.children),s={};for(let[i,a]of Object.entries(e.attributes))s[`${At}${i}`]=a;for(let[i,a]of o)s[i]=a.length===1?a[0]:a;return n.trim().length>0&&(s[Z]=n),t&&!r&&(s[Z]=""),Tr(s)},Nr=e=>{for(let t of e)if(typeof t!="string"&&t.tagName!=="?xml")return t},Lr=e=>{let t={},r={};for(let[n,o]of Object.entries(e.attributes))yr.test(n)?r[`${At}${n}`]=o:t[n]=o;return{rootAttrs:t,namespaces:r}},vr=e=>{if(!Array.isArray(e))throw new Error(`txml.parse: expected an array of nodes, got ${typeof e}`);return e},_t=e=>{let t=_r(e);Er(t);let r=vr(gr(t,{keepComments:!0})),n=Nr(r);if(n===void 0)return{content:{},namespaces:{}};let{rootAttrs:o,namespaces:s}=Lr(n),i={tagName:n.tagName,attributes:o,children:n.children};return{content:{[n.tagName]:Et(i)},namespaces:s}},Rr=async e=>{let t=[];for await(let r of e)t.push(typeof r=="string"?Buffer.from(r,"utf8"):r);return Buffer.concat(t).toString("utf8")},Q=class{parseString(t){return _t(t)}async parseStream(t){return _t(await Rr(t))}};var Se=require("node:events");var ee=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&"__conflict"in e&&e.__conflict===!0,Ot=(e,t,r)=>({__conflict:!0,local:Array.isArray(e)?e:[e],ancestor:Array.isArray(t)?t:[t],other:Array.isArray(r)?r:[r]});var Mt="#text",Me="@_",jt=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Mr=e=>e.replace(/--/g,"- -").replace(/-$/,"- "),jr=e=>e.replace(/\]\]>/g,"]]]]><![CDATA[>"),Le=e=>{let t="";for(let r=0;r<e.length;r++){let n=e[r];t+=` ${n[0]}="${n[1]}"`}return t},xr=e=>{let t=e.conflictMarkerSize;return{local:`${`
|
|
10
|
+
`}${"<".repeat(t)} ${e.localConflictTag}`,ancestor:`${"|".repeat(t)} ${e.ancestorConflictTag}`,separator:"=".repeat(t),other:`${">".repeat(t)} ${e.otherConflictTag}`}},M=(e,t)=>{e.buf+=e.endedWithGt?`${re(e.depth)}${t}`:t,e.endedWithGt=!1},Pr=(e,t)=>{e.buf+=e.endedWithGt?`${re(e.depth)}<![CDATA[${t}]]>`:`<![CDATA[${t}]]>`,e.endedWithGt=!0},Fr=(e,t)=>{e.buf+=`<!--${t}-->`,e.endedWithGt=!0},kr=(e,t,r)=>ee(t)?(Pe(e,t,r),!0):jt(t)?!1:(M(e,String(t)),!0),ve=(e,t,r)=>{if(t.length===0){M(e,`
|
|
11
|
+
`);return}xt(e,t,r)},Pe=(e,t,r)=>{M(e,r.local),ve(e,t.local,r),M(e,r.ancestor),ve(e,t.ancestor,r),M(e,r.separator),ve(e,t.other,r),M(e,r.other)},te=[],Ir=(e,t,r,n)=>{e.buf+=yt;let o=!0;for(let s=0;s<t.length;s++){let i=t[s];if(kr(e,i,n))continue;let a=i,l=Object.keys(a).sort();for(let u=0;u<l.length;u++){let h=l[u];if(h===":@")continue;let p=te;if(o){let f=Object.keys(r).sort(),m=new Array(f.length);for(let y=0;y<f.length;y++){let x=f[y];m[y]=[x.slice(Me.length),String(r[x])]}p=m,o=!1}je(e,h,a[h],p,n)}}},je=(e,t,r,n,o)=>{if(t===Mt){M(e,String(r));return}if(t===W){Fr(e,Mr(String(r)));return}if(t===B){let h=Array.isArray(r)?r.join(""):String(r);Pr(e,jr(h));return}if(r!==null&&typeof r=="object"&&!Array.isArray(r)&&ee(r)){Pe(e,r,o);return}let{attrs:s,children:i}=Dr(r),a=n===te?Le(s):Le(n)+Le(s);e.isFirstTopLevelAfterDecl?(e.buf+=`<${t}${a}>`,e.isFirstTopLevelAfterDecl=!1):e.buf+=`${re(e.depth)}<${t}${a}>`;let l=e.depth;e.depth=l+1;let u=e.endedWithGt;e.endedWithGt=!1,xt(e,i,o),e.endedWithGt?e.buf+=`${re(l)}</${t}>`:e.buf+=`</${t}>`,e.depth=l,e.endedWithGt=!0},xt=(e,t,r)=>{for(let n=0;n<t.length;n++){let o=t[n];if(ee(o)){Pe(e,o,r);continue}if(!jt(o)){M(e,String(o));continue}let s=Object.keys(o);if(s.length===1){let i=s[0];je(e,i,o[i],te,r);continue}s.sort();for(let i=0;i<s.length;i++){let a=s[i];je(e,a,o[a],te,r)}}},Dr=e=>{if(e==null)return{attrs:[],children:[]};if(typeof e!="object")return{attrs:[],children:[{[Mt]:e}]};if(Array.isArray(e))return{attrs:[],children:e};let t=[],r=[];for(let n of Object.keys(e).sort()){let o=e[n];if(n.startsWith(Me))t.push([n.slice(Me.length),String(o)]);else if(Array.isArray(o)&&n!==B&&n!==W)for(let s of o)r.push({[n]:s});else r.push({[n]:o})}return{attrs:t,children:r}},Ct=[],re=e=>{let t=Ct[e];return t===void 0&&(t=`
|
|
12
|
+
${wt.repeat(e)}`,Ct[e]=t),t},xe=class{buf="";markers;constructor(t){this.markers=["<".repeat(t.conflictMarkerSize),"|".repeat(t.conflictMarkerSize),"=".repeat(t.conflictMarkerSize),">".repeat(t.conflictMarkerSize)]}push(t){let r=[],n=t;for(;;){let o=n.indexOf(`
|
|
13
|
+
`);if(o<0){this.buf+=n;break}this.buf+=n.slice(0,o),this.flushLine(r,!0),n=n.slice(o+1)}return r.join("")}end(){let t=[];return this.flushLine(t,!1),t.join("")}flushLine(t,r){let n=this.buf;this.buf="";let o=/^([ \t]+)(.*)$/.exec(n);o!==null&&this.markers.some(s=>o[2].startsWith(s))&&(n=o[2]),!/^[ \t]*$/.test(n)&&t.push(r?`${n}
|
|
14
|
+
`:n)}},Tt=(e,t)=>t===`
|
|
15
|
+
`?e:e.replace(/\r?\n/g,t),Re=16*1024,ne=class{config;constructor(t){this.config=t}async writeTo(t,r,n,o=`
|
|
16
|
+
`,s=!0){if(r.length===0)return;let i=xr(this.config),a={buf:"",depth:0,endedWithGt:!1,isFirstTopLevelAfterDecl:!0};if(Ir(a,r,n,i),!s){let p=Tt(a.buf,o);t.write(p)||await(0,Se.once)(t,"drain");return}let l=new xe(this.config),u="",h=async()=>{let p=Tt(u,o);u="",t.write(p)||await(0,Se.once)(t,"drain")};for(let p=0;p<a.buf.length;p+=Re)u+=l.push(a.buf.slice(p,p+Re)),u.length>=Re&&await h();u+=l.end(),await h()}};var oe=require("node:fs"),se=require("node:os"),Fe=require("node:path");var Pt="sf-git-merge-driver";function Kr(e){return typeof e=="function"?e():e}function D(e,...t){let r=t.map(n=>typeof n=="function"?n:()=>n);return()=>e.reduce((n,o,s)=>n+o+(s<r.length?r[s]():""),"")}var L={trace:10,debug:20,info:30,warn:40,error:50,fatal:60},Ft=L.warn;function $r(e){if(!e)return Ft;let t=Number(e);if(Number.isInteger(t)&&t>=0)return t;let r=e.toLowerCase();return r in L?L[r]:Ft}var It=$r(process.env.SF_LOG_LEVEL??process.env.SFDX_LOG_LEVEL),Dt=e=>e>=It,Kt=L,Gr=process.env.SF_LOG_STDERR==="true",Vr=(0,se.hostname)(),Wr=process.pid,$t=(0,Fe.join)((0,se.homedir)(),".sf"),kt=!1;function Br(){if(!kt){kt=!0;try{(0,oe.mkdirSync)($t,{recursive:!0})}catch{}}}function Xr(){let e=new Date,t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),n=String(e.getDate()).padStart(2,"0");return(0,Fe.join)($t,`sf-${t}-${r}-${n}.log`)}function Ur(e,t,r){let n={level:e,time:Date.now(),pid:Wr,hostname:Vr,name:Pt,msg:t};r!==void 0&&(n.meta=r);let o=`${JSON.stringify(n)}
|
|
17
|
+
`;Br();try{(0,oe.appendFileSync)(Xr(),o)}catch{}Gr&&process.stderr.write(o)}function X(e,t,r){e<It||Ur(e,String(Kr(t)),r)}var v={trace(e,t){X(L.trace,e,t)},debug(e,t){X(L.debug,e,t)},info(e,t){X(L.info,e,t)},warn(e,t){X(L.warn,e,t)},error(e,t){X(L.error,e,t)}};var Yr=Dt(Kt.trace);function K(e){return function(t,r,n){if(!Yr)return;let o=n.value;n.value=function(...s){v.trace(D`${e}.${r}: entry`);let i=()=>o.call(this,...s);if(o.constructor.name==="AsyncFunction")return i().then(a=>(v.trace(D`${e}.${r}: exit`),a),a=>{throw v.trace(D`${e}.${r}: exit (error)`),a});try{let a=i();return v.trace(D`${e}.${r}: exit`),a}catch(a){throw v.trace(D`${e}.${r}: exit (error)`),a}}}}var O=e=>Array.isArray(e)?{}:e;var $=(e,...t)=>{for(let r of t)for(let n of r)e.push(n)},Gt=(e,t)=>{let r=new Set(t),n=e.filter(i=>r.has(i)),o=new Set(e),s=t.filter(i=>o.has(i));if(n.length!==s.length)return!1;for(let i=0;i<n.length;i++)if(n[i]!==s[i])return!1;return!0},ie=(e,t)=>{let r=e.length,n=t.length;if(r===0||n===0)return[];let o=n+1,s=new Int32Array((r+1)*o);for(let u=1;u<=r;u++){let h=(u-1)*o,p=u*o;for(let f=1;f<=n;f++)if(e[u-1]===t[f-1])s[p+f]=s[h+(f-1)]+1;else{let m=s[h+f],y=s[p+(f-1)];s[p+f]=m>=y?m:y}}let i=[],a=r,l=n;for(;a>0&&l>0;)e[a-1]===t[l-1]?(i.push(e[a-1]),a--,l--):s[(a-1)*o+l]>s[a*o+(l-1)]?a--:l--;return i.reverse(),i};var zr=[],Hr={output:zr,hasConflict:!1},C=e=>{if(e.length===1)return e[0];let t=[],r=!1;for(let n of e)$(t,n.output),r=r||n.hasConflict;return{output:t,hasConflict:r}},d=e=>e.length===0?Hr:{output:e,hasConflict:!1},A=e=>({output:e,hasConflict:!0});var U=(e,t)=>e.output.length>0?{output:[{[t]:e.output}],hasConflict:e.hasConflict}:d([{[t]:[]}]),Y=(e,t)=>{let r=e==null?[]:Array.isArray(e)?e:[e];return d(t?[{[t]:r}]:r)};var g;(function(e){e[e.NONE=0]="NONE",e[e.OTHER_ONLY=1]="OTHER_ONLY",e[e.LOCAL_ONLY=2]="LOCAL_ONLY",e[e.LOCAL_AND_OTHER=3]="LOCAL_AND_OTHER",e[e.ANCESTOR_ONLY=4]="ANCESTOR_ONLY",e[e.ANCESTOR_AND_OTHER=5]="ANCESTOR_AND_OTHER",e[e.ANCESTOR_AND_LOCAL=6]="ANCESTOR_AND_LOCAL",e[e.ALL=7]="ALL"})(g||(g={}));var ke=e=>e==null?!1:typeof e=="string"||Array.isArray(e)?e.length>0:typeof e=="object"?Object.keys(e).length>0:!0,ae=(e,t,r)=>{let n=g.NONE;return ke(e)&&(n|=g.ANCESTOR_ONLY),ke(t)&&(n|=g.LOCAL_ONLY),ke(r)&&(n|=g.OTHER_ONLY),n};var z=class{static getKeyFieldExtractor(t){return t in Vt?Vt[t]:void 0}static isOrderedAttribute(t){return qr.has(t)}},qr=new Set(["customValue","standardValue","value","values","filterItems","summaryFilterItems"]),c=(e,t)=>String(e[t]),Ie=e=>{let t=c(e,"field"),r=c(e,"operation"),n=c(e,"value"),o=c(e,"valueField");return[t,r,n,o].filter(s=>s!==String(void 0)).join(".")},Vt={labels:e=>c(e,"fullName"),applicationVisibilities:e=>c(e,"application"),categoryGroupVisibilities:e=>c(e,"dataCategoryGroup"),classAccesses:e=>c(e,"apexClass"),customMetadataTypeAccesses:e=>c(e,"name"),customPermissions:e=>c(e,"name"),customSettingAccesses:e=>c(e,"name"),externalDataSourceAccesses:e=>c(e,"externalDataSource"),fieldPermissions:e=>c(e,"field"),flowAccesses:e=>c(e,"flow"),layoutAssignments:e=>{let t=c(e,"layout"),r=c(e,"recordType");return[t,r].filter(n=>n!==String(void 0)).join(".")},loginFlows:e=>c(e,"friendlyname"),loginHours:e=>typeof e=="object"&&e!==null?Object.keys(e).join(","):"",loginIpRanges:e=>{let t=c(e,"startAddress"),r=c(e,"endAddress");return`${t}-${r}`},objectPermissions:e=>c(e,"object"),pageAccesses:e=>c(e,"apexPage"),profileActionOverrides:e=>c(e,"actionName"),recordTypeVisibilities:e=>c(e,"recordType"),tabVisibilities:e=>c(e,"tab"),userPermissions:e=>c(e,"name"),dataspaceScopes:e=>c(e,"dataspaceScope"),emailRoutingAddressAccesses:e=>c(e,"name"),externalCredentialPrincipalAccesses:e=>c(e,"externalCredentialPrincipal"),sharingCriteriaRules:e=>c(e,"fullName"),sharingGuestRules:e=>c(e,"fullName"),sharingOwnerRules:e=>c(e,"fullName"),sharingTerritoryRules:e=>c(e,"fullName"),criteriaItems:Ie,filterItems:Ie,summaryFilterItems:Ie,valueSettings:e=>c(e,"valueName"),alerts:e=>c(e,"fullName"),recipients:e=>c(e,"type"),fieldUpdates:e=>c(e,"fullName"),flowActions:e=>c(e,"fullName"),flowInputs:e=>c(e,"name"),flowAutomation:e=>c(e,"fullName"),knowledgePublishes:e=>c(e,"fullName"),outboundMessages:e=>c(e,"fullName"),rules:e=>c(e,"fullName"),actions:e=>c(e,"name"),send:e=>c(e,"fullName"),tasks:e=>c(e,"fullName"),assignmentRule:e=>c(e,"fullName"),autoResponseRule:e=>c(e,"fullName"),escalationRule:e=>c(e,"fullName"),marketingAppExtActions:e=>c(e,"apiName"),marketingAppExtActivities:e=>c(e,"fullName"),matchingRules:e=>c(e,"fullName"),matchingRuleItems:e=>{let t=c(e,"fieldName"),r=c(e,"matchingMethod");return`${t}-${r}`},customValue:e=>c(e,"fullName"),standardValue:e=>c(e,"fullName"),valueTranslation:e=>c(e,"masterLabel"),botBlocks:e=>c(e,"fullName"),botBlockVersions:e=>c(e,"fullName"),botDialogs:e=>c(e,"developerName"),botSteps:e=>c(e,"stepIdentifier"),botMessages:e=>c(e,"messageIdentifier"),botVariableOperation:e=>c(e,"variableOperationIdentifier"),botTemplates:e=>c(e,"fullName"),bots:e=>c(e,"fullName"),botVersions:e=>c(e,"fullName"),conversationMessageDefinitions:e=>c(e,"name"),constantValueTranslations:e=>c(e,"name"),customApplications:e=>c(e,"name"),customLabels:e=>c(e,"name"),customPageWebLinks:e=>c(e,"name"),customTabs:e=>c(e,"name"),desFieldTemplateMessages:e=>c(e,"name"),flowDefinitions:e=>c(e,"fullName"),flows:e=>c(e,"fullName"),identityVerificationCustomFieldLabels:e=>c(e,"name"),pipelineInspMetricConfigs:e=>c(e,"name"),prompts:e=>c(e,"name"),promptVersions:e=>c(e,"name"),quickActions:e=>c(e,"name"),reportTypes:e=>c(e,"name"),sections:e=>{let t=c(e,"name"),r=c(e,"section");return[t,r].filter(n=>n!==String(void 0))[0]},columns:e=>c(e,"name"),scontrols:e=>c(e,"name"),caseValues:e=>{let t=c(e,"article"),r=c(e,"caseType"),n=c(e,"plural"),o=c(e,"possessive");return[t,r,n,o].filter(s=>s!==String(void 0)).join(".")},fieldSets:e=>c(e,"name"),fields:e=>c(e,"name"),picklistValues:e=>c(e,"masterLabel"),values:e=>c(e,"fullName"),value:e=>c(e,"fullName"),layouts:e=>c(e,"layout"),quickActionParametersTranslation:e=>c(e,"name"),recordTypes:e=>c(e,"name"),sharingReasons:e=>c(e,"name"),standardFields:e=>c(e,"name"),validationRules:e=>c(e,"name"),webLinks:e=>c(e,"name"),workflowTasks:e=>c(e,"name"),types:e=>c(e,"name")};var De=e=>Array.isArray(e)?e.length===0:Object.keys(e).length===0,E=(e,t,r)=>{let n=De(e)?{}:e,o=De(t)?{}:t,s=De(r)?{}:r;return Ot(n,o,s)};var ce=(e,t)=>{let r=new Map;for(let n of e){let o=t(n);r.set(o,n)}return r},Wt=(e,t,r,n)=>{let o=new Set,s=new Map,i=new Map,a=new Map,l=(u,h)=>{for(let p of u){let f=p,m=n(f);h.set(m,f),o.add(m)}};return l(e,s),l(t,i),l(r,a),{keyedAncestor:s,keyedLocal:i,keyedOther:a,allKeys:o}};function T(e,t){let r=[[e,t]];for(;r.length>0;){let[n,o]=r.pop();if(n===o)continue;if(n===null||o===null||typeof n!="object"||typeof o!="object")return!1;if(Array.isArray(n)){if(!Array.isArray(o)||n.length!==o.length)return!1;for(let l=n.length-1;l>=0;l--)r.push([n[l],o[l]]);continue}if(Array.isArray(o))return!1;let s=n,i=o,a=Object.keys(s);if(a.length!==Object.keys(i).length)return!1;for(let l of a){if(!(l in i))return!1;r.push([s[l],i[l]])}}return!0}var Bt=(e,t)=>{if(e.size!==t.size)return!1;for(let r of e)if(!t.has(r))return!1;return!0},Ke=(e,t)=>{for(let r of e)if(t.has(r))return!0;return!1};var Jr=(e,t,r)=>{let n=new Set(e),o=new Set(t),s=new Set(r);return{localDeleted:new Set(e.filter(i=>!o.has(i))),otherDeleted:new Set(e.filter(i=>!s.has(i))),localAdded:new Set(t.filter(i=>!n.has(i))),otherAdded:new Set(r.filter(i=>!n.has(i))),allKeys:new Set([...e,...t,...r])}},le=class{ancestor;local;other;attribute;keyField;constructor(t,r,n,o,s){this.ancestor=t,this.local=r,this.other=n,this.attribute=o,this.keyField=s}merge(t){let r=this.buildArrayMergeState(),n=this.analyzeOrderings(r);return n.canMerge?n.localMoved.size>0||n.otherMoved.size>0?this.processDivergedOrderings(t,r,n):this.processWithSpine(t,r):this.buildFullArrayConflict(t,r)}buildArrayMergeState(){let t=this.ancestor.map(o=>this.keyField(o)),r=this.local.map(o=>this.keyField(o)),n=this.other.map(o=>this.keyField(o));return{ancestorKeys:t,localKeys:r,otherKeys:n,ancestorMap:ce(this.ancestor,this.keyField),localMap:ce(this.local,this.keyField),otherMap:ce(this.other,this.keyField),ancestorPos:new Map(t.map((o,s)=>[o,s])),localPos:new Map(r.map((o,s)=>[o,s])),otherPos:new Map(n.map((o,s)=>[o,s])),ancestorSet:new Set(t)}}analyzeOrderings(t){if(Gt(t.localKeys,t.otherKeys))return{canMerge:!0,localMoved:new Set,otherMoved:new Set};let r=this.getMovedElements(t,t.localPos),n=this.getMovedElements(t,t.otherPos);return Ke(r,n)?{canMerge:!1,localMoved:r,otherMoved:n}:r.size===0&&n.size===0?{canMerge:!1,localMoved:r,otherMoved:n}:{canMerge:!0,localMoved:r,otherMoved:n}}getMovedElements(t,r){let n=new Set;for(let o=0;o<t.ancestorKeys.length;o++){let s=t.ancestorKeys[o],i=r.get(s);if(i!==void 0)for(let a=o+1;a<t.ancestorKeys.length;a++){let l=t.ancestorKeys[a],u=r.get(l);u!==void 0&&i>u&&(n.add(s),n.add(l))}}return n}processDivergedOrderings(t,r,n){let o=this.computeMergedKeyOrder(r,n);return o===null?this.buildFullArrayConflict(t,r):this.processKeyOrder(t,r,o)}computeMergedKeyOrder(t,r){let{localMoved:n,otherMoved:o}=r,s=t.localKeys.filter(f=>n.has(f)),i=t.otherKeys.filter(f=>o.has(f)),a=t.localKeys.filter(f=>!n.has(f)&&!t.ancestorSet.has(f)),l=t.otherKeys.filter(f=>!o.has(f)&&!t.ancestorSet.has(f)&&!t.localMap.has(f));if(a.length>0&&l.length>0)return null;let u=[],h=!1,p=!1;for(let f of t.ancestorKeys)n.has(f)?h||($(u,s),h=!0):o.has(f)?p||($(u,i),p=!0):u.push(f);return $(u,a,l),u}processWithSpine(t,r){let n=ie(ie(r.ancestorKeys,r.localKeys),ie(r.ancestorKeys,r.otherKeys));return this.processSpine(t,n,r)}processKeyOrder(t,r,n){let o=[];for(let s of n){let i=this.mergeElementWithPresenceCheck(t,s,r);i&&i.output.length>0&&o.push(i)}return C(o)}mergeElementWithPresenceCheck(t,r,n){let o=n.ancestorMap.has(r),s=n.localMap.has(r),i=n.otherMap.has(r);return o&&s&&i?this.mergeElement(t,r,n):this.mergeGapElement(t,r,n)}wrapKeys(t,r){return t.map(n=>({[this.attribute]:r.get(n)}))}buildFullArrayConflict(t,r){return A([E(this.wrapKeys(r.localKeys,r.localMap),this.wrapKeys(r.ancestorKeys,r.ancestorMap),this.wrapKeys(r.otherKeys,r.otherMap))])}processSpine(t,r,n){let o=[],s=0,i=0,a=0;for(let u of r){let h=n.ancestorPos.get(u),p=n.localPos.get(u),f=n.otherPos.get(u),m={ancestor:n.ancestorKeys.slice(s,h),local:n.localKeys.slice(i,p),other:n.otherKeys.slice(a,f)};o.push(this.mergeGap(t,m,n)),o.push(this.mergeElement(t,u,n)),s=h+1,i=p+1,a=f+1}let l={ancestor:n.ancestorKeys.slice(s),local:n.localKeys.slice(i),other:n.otherKeys.slice(a)};return o.push(this.mergeGap(t,l,n)),C(o)}mergeGap(t,r,n){let o=Jr(r.ancestor,r.local,r.other),s=this.detectGapConflict(t,r,o,n);return s||this.mergeGapElements(t,o,n)}detectGapConflict(t,r,n,o){let{localDeleted:s,otherDeleted:i,localAdded:a,otherAdded:l}=n,u=s.size>0&&i.size>0&&!Bt(s,i),h=a.size>0&&l.size>0&&!Ke(a,l);return u||h?this.buildGapConflict(t,r,o):null}buildGapConflict(t,r,n){return A([E(this.wrapKeys(r.local,n.localMap),this.wrapKeys(r.ancestor,n.ancestorMap),this.wrapKeys(r.other,n.otherMap))])}mergeGapElements(t,r,n){let o=[];for(let s of r.allKeys){let i=this.mergeGapElement(t,s,n);i&&o.push(i)}return C(o)}mergeGapElement(t,r,n){let o=n.ancestorMap.get(r),s=n.localMap.get(r),i=n.otherMap.get(r);return o!==void 0?s===void 0?i===void 0||T(o,i)?null:this.buildElementConflict(t,null,o,i):T(o,s)?null:this.buildElementConflict(t,s,o,null):s!==void 0&&i!==void 0?T(s,i)?d([this.wrapElement(s)]):this.buildElementConflict(t,s,null,i):d([this.wrapElement(s??i)])}wrapElement(t){return{[this.attribute]:t}}mergeElement(t,r,n){let o=n.ancestorMap.get(r),s=n.localMap.get(r),i=n.otherMap.get(r);return T(o,i)&&s?d([this.wrapElement(s)]):T(o,s)&&i?d([this.wrapElement(i)]):T(s,i)?d([this.wrapElement(s)]):this.buildElementConflict(t,s,o,i)}buildElementConflict(t,r,n,o){let s=i=>i?this.wrapElement(i):{};return A([E(s(r),s(n),s(o))])}};var $e=class{ancestor;local;other;attribute;constructor(t,r,n,o){this.ancestor=t,this.local=r,this.other=n,this.attribute=o}merge(t){return A([E({[this.attribute]:this.local},{[this.attribute]:this.ancestor},{[this.attribute]:this.other})])}},Ge=class{ancestor;local;other;attribute;keyField;constructor(t,r,n,o,s){this.ancestor=t,this.local=r,this.other=n,this.attribute=o,this.keyField=s}merge(t){let{keyedAncestor:r,keyedLocal:n,keyedOther:o,allKeys:s}=Wt(this.ancestor,this.local,this.other,this.keyField),i=[],a=new R(t,j);for(let l of Array.from(s).sort()){let u=a.merge(r.get(l)??{},n.get(l)??{},o.get(l)??{},this.attribute);u.output.length>0&&i.push({output:[{[this.attribute]:u.output}],hasConflict:u.hasConflict})}return C(i)}},ue=class{ancestor;local;other;attribute;keyField;isOrdered;constructor(t,r,n,o,s,i){this.ancestor=t,this.local=r,this.other=n,this.attribute=o,this.keyField=s,this.isOrdered=i}merge(t){return this.keyField?(this.isOrdered?new le(this.ancestor,this.local,this.other,this.attribute,this.keyField):new Ge(this.ancestor,this.local,this.other,this.attribute,this.keyField)).merge(t):new $e(this.ancestor,this.local,this.other,this.attribute).merge(t)}};var G=(...e)=>{let t=new Set;for(let r of e)if(r!=null)for(let n of Object.keys(r))t.add(n);return[...t].sort()};var fe=class{ancestor;local;other;attribute;constructor(t,r,n,o){this.ancestor=t,this.local=r,this.other=n,this.attribute=o}merge(t){let r=O(this.ancestor),n=O(this.local),o=O(this.other),s=G(this.ancestor,this.local,this.other),i=[];for(let l of s){let h=j.createNode(r[l],n[l],o[l],l).merge(t);i.push(h)}let a=C(i);return a.output.length===0?d([]):U(a,this.attribute)}};var Zr=(e,t)=>String(e).localeCompare(String(t)),he=class{ancestor;local;other;attribute;constructor(t,r,n,o){this.ancestor=t,this.local=r,this.other=n,this.attribute=o}merge(t){let r=new Set(this.local),n=new Set(this.other),o=new Set(this.ancestor),s=new Set;for(let a of this.ancestor)r.has(a)&&n.has(a)&&s.add(a);for(let a of this.local)o.has(a)||s.add(a);for(let a of this.other)o.has(a)||s.add(a);let i=[...s].sort(Zr).map(a=>a==null?{}:{[this.attribute]:a});return d(i)}};var Ve=class{handle({objOther:t}){return d([t])}},We=class{handle({objLocal:t}){return d([t])}},Be=class{handle({objLocal:t,objOther:r,local:n,other:o}){return n===o?d([t]):A([E(t,{},r)])}},Xe=class{handle({objAncestor:t,objOther:r,ancestor:n,other:o}){return n!==o?A([E({},t,r)]):d([])}},Ue=class{handle({objAncestor:t,objLocal:r,ancestor:n,local:o}){return n!==o?A([E(r,t,{})]):d([])}},Ye=class{handle({objAncestor:t,objLocal:r,objOther:n,ancestor:o,local:s,other:i}){return o===s?d([n]):o===i?d([r]):s===i?d([r]):A([E(r,t,n)])}},ze=class{handle(){return d([])}},He=class{handle(){return d([])}},Qr={[g.NONE]:new He,[g.OTHER_ONLY]:new Ve,[g.LOCAL_ONLY]:new We,[g.LOCAL_AND_OTHER]:new Be,[g.ANCESTOR_AND_OTHER]:new Xe,[g.ANCESTOR_AND_LOCAL]:new Ue,[g.ALL]:new Ye,[g.ANCESTOR_ONLY]:new ze},Xt=e=>Qr[e];var qe=(e,t)=>e==null?{}:{[t]:e},pe=class{ancestor;local;other;attribute;constructor(t,r,n,o){this.ancestor=t,this.local=r,this.other=n,this.attribute=o}merge(t){let r=qe(this.ancestor,this.attribute),n=qe(this.local,this.attribute),o=qe(this.other,this.attribute),s=ae(r,n,o);return Xt(s).handle({config:t,objAncestor:r,objLocal:n,objOther:o,ancestor:this.ancestor,local:this.local,other:this.other})}};var Ut=e=>e==null?[]:Array.isArray(e)?e:[e],Yt=e=>typeof e=="object"&&e!==null,en=(...e)=>e.some(Yt),tn=(...e)=>e.some(t=>Array.isArray(t)&&t.every(r=>typeof r=="string")),rn=e=>Yt(e)&&!Array.isArray(e),nn=(e,t)=>{let r=e.some(rn),n=e.some(Array.isArray);return!t&&r&&!n},Je=class{createNode(t,r,n,o){if(tn(t,r,n)){let[i,a,l]=[t,r,n].map(Ut);return new he(i,a,l,o)}let s=z.getKeyFieldExtractor(o);if(nn([t,r,n],s!==void 0))return new fe(t,r,n,o);if(en(t,r,n)){let[i,a,l]=[t,r,n].map(Ut);return new ue(i,a,l,o,s,z.isOrderedAttribute(o))}return new pe(t,r,n,o)}},j=new Je;var de=class{mergeChildren(t,r){let n=t.local,o=t.other,s=O(n),i=O(o),a=r===void 0?void 0:O(r),l=G(r??{},n,o),u=[];for(let p of l){let m=t.nodeFactory.createNode(a===void 0?void 0:a[p],s[p],i[p],p).merge(t.config);u.push(m)}let h=C(u);return t.rootKey?U(h,t.rootKey.name):h}},me=class{execute(t){let r=this.getTarget(t),n=T(t.ancestor,r);return t.rootKey?this.executeWithRootKey(t,t.rootKey,r,n):this.executeWithoutRootKey(t,r,n)}executeWithRootKey(t,r,n,o){let{name:s}=r,i=this.getExistsInSecondary(r);if(!i&&o)return d([]);if(!i){let a={[s]:n},l={[s]:t.ancestor};return A(this.buildConflict(t,a,l))}return U(this.executeNested(t),s)}executeWithoutRootKey(t,r,n){return n?d([]):t.attribute?this.executeWithAttribute(t,t.attribute):A(this.buildConflict(t,r,t.ancestor))}executeNested(t){return new R(t.config,t.nodeFactory).merge(t.ancestor,t.local,t.other)}executeWithAttribute(t,r){let n=new R(t.config,t.nodeFactory),o=this.mergeTarget(n,t),s=n.merge({},t.ancestor,{},void 0),i={[r]:o.output},a={[r]:s.output};return A(this.buildConflict(t,i,a))}},Ze=class{execute(t){return d([])}},Qe=class{execute(t){return Y(t.other,t.rootKey?.name)}},et=class{execute(t){return Y(t.local,t.rootKey?.name)}},tt=class extends de{execute(t){let r=t.local,n=t.other;return T(r,n)?Y(r,t.rootKey?.name):this.mergeChildren(t,void 0)}},rt=class{execute(t){if(t.rootKey){let{name:r,existsInLocal:n,existsInOther:o}=t.rootKey;return n||o?d([{[r]:[]}]):d([])}return d([])}},nt=class extends me{getTarget(t){return t.local}getExistsInSecondary(t){return t.existsInOther}buildConflict(t,r,n){return[E(r,n,{})]}mergeTarget(t,r){return t.merge({},r.local,{},void 0)}},ot=class extends me{getTarget(t){return t.other}getExistsInSecondary(t){return t.existsInLocal}buildConflict(t,r,n){return[E({},n,r)]}mergeTarget(t,r){return t.merge({},{},r.other,void 0)}},st=class extends de{execute(t){return T(t.ancestor,t.local)&&T(t.local,t.other)?Y(t.local,t.rootKey?.name):this.mergeChildren(t,t.ancestor)}},on={[g.ALL]:new st,[g.ANCESTOR_AND_LOCAL]:new nt,[g.ANCESTOR_AND_OTHER]:new ot,[g.ANCESTOR_ONLY]:new rt,[g.LOCAL_AND_OTHER]:new tt,[g.LOCAL_ONLY]:new et,[g.NONE]:new Ze,[g.OTHER_ONLY]:new Qe},zt=e=>on[e];var R=class{config;nodeFactory;constructor(t,r=j){this.config=t,this.nodeFactory=r}merge(t,r,n,o,s){let i=ae(t,r,n),a=zt(i),l={config:this.config,ancestor:t,local:r,other:n,attribute:o,nodeFactory:this.nodeFactory,rootKey:s};return a.execute(l)}};var H=class{orchestrator;constructor(t){this.orchestrator=new R(t,j)}mergeThreeWay(t,r,n){let o=O(t),s=O(r),i=O(n),a=[],l=G(t,r,n);for(let h of l){let p=this.orchestrator.merge(o[h],s[h],i[h],void 0,{name:h,existsInLocal:h in s,existsInOther:h in i});a.push(p)}let u=C(a);return{output:u.output,hasConflict:u.hasConflict}}};I([K("JsonMerger")],H.prototype,"mergeThreeWay",null);var sn=(...e)=>Object.assign({},...e),q=class{parser;writer;jsonMerger;constructor(t){this.parser=new Q,this.writer=new ne(t),this.jsonMerger=new H(t)}async mergeThreeWay(t,r,n,o,s=`
|
|
18
|
+
`){let i=await Promise.allSettled([this.parser.parseStream(t),this.parser.parseStream(r),this.parser.parseStream(n)]),a=i.find(m=>m.status==="rejected");if(a)throw a.reason;let[l,u,h]=i.map(m=>m.value),p=sn(l.namespaces,u.namespaces,h.namespaces),f=this.jsonMerger.mergeThreeWay(l.content,u.content,h.content);return f.output.length&&await this.writer.writeTo(o,f.output,p,s,f.hasConflict),{hasConflict:f.hasConflict}}};I([K("XmlMerger")],q.prototype,"mergeThreeWay",null);var qt=require("node:fs/promises"),an=`\r
|
|
19
|
+
`,cn=`
|
|
20
|
+
`,Ht=4096,ln=10,un=13,Jt=async e=>{let t=await(0,qt.open)(e,"r");try{let r=Buffer.alloc(Ht),{bytesRead:n}=await t.read(r,0,Ht,0),o=r.subarray(0,n),s=o.indexOf(ln);return s>0&&o[s-1]===un?an:cn}finally{await t.close()}};var fn=".sf-merge-tmp",hn="1.8.0",Zt=()=>{},pn=async e=>{try{await(0,ye.unlink)(e)}catch{}},J=class{config;constructor(t){this.config=t}async mergeFiles(t,r,n){let o=(0,it.normalize)(r),s=o+fn,i=[],a;v.info(`pipeline=streaming v=${hn}`);try{let l=await Jt(o),[u,h,p]=[t,r,n].map(it.normalize).map(y=>{let x=(0,ge.createReadStream)(y);return x.on("error",Zt),x});i.push(u,h,p),a=(0,ge.createWriteStream)(s),a.on("error",Zt);let f=new q(this.config),{hasConflict:m}=await f.mergeThreeWay(u,h,p,a,l);return a.end(),await(0,Qt.finished)(a),await(0,ye.rename)(s,o),m}catch(l){if(l!==null&&typeof l=="object"&&l.code==="ENOENT")throw l;return v.error("Merge failed; leaving ours unchanged",l),!0}finally{for(let l of i)l.destroy();a?.destroy(),await pn(s)}}};I([K("MergeDriver")],J.prototype,"mergeFiles",null);var dn=`Usage: sf-git-merge-driver -O <ancestor> -A <local> -B <other> -P <output> [-L n] [-S tag] [-X tag] [-Y tag]
|
|
21
|
+
|
|
22
|
+
Flags:
|
|
23
|
+
-O ancestor file (required, must exist)
|
|
24
|
+
-A local/ours file (required, must exist; merged result is written back here)
|
|
25
|
+
-B other/theirs file (required, must exist)
|
|
26
|
+
-P output file (required, must exist; accepted per git contract)
|
|
27
|
+
-L conflict marker size (integer 1-${100}, default ${7})
|
|
28
|
+
-S ancestor conflict tag (default ${Oe})
|
|
29
|
+
-X local conflict tag (default ${Ce})
|
|
30
|
+
-Y other conflict tag (default ${Te})
|
|
31
|
+
--version Print version and exit
|
|
32
|
+
--help Show this message and exit
|
|
33
|
+
`,lt=2,ut=1,at=0;function rr(e){Number(e.split(".")[0])<20&&(process.stderr.write(`sf-git-merge-driver requires Node.js >= 20 (got ${e})
|
|
34
|
+
`),process.exit(lt))}var we=e=>e instanceof Error?e.message:String(e),er=new Set(["-O","-A","-B","-P","-L","-S","-X","-Y"]);function nr(e){let t={},r=0;for(;r<e.length;){let f=e[r];if(!er.has(f))throw new Error(`unknown argument: ${f}`);let m=e[r+1];if(m===void 0||er.has(m))throw new Error(`missing value for ${f}`);t[f]=m,r+=2}let n=f=>{let m=t[f];if(m===void 0)throw new Error(`missing required flag: ${f}`);return m},o=(f,m)=>{let y=t[f];return y===void 0||y===""?m:y},s=n("-O"),i=n("-A"),a=n("-B"),l=n("-P"),u=t["-L"],h=7;if(u!==void 0&&u!==""){let f=Number(u);if(!Number.isInteger(f)||f<1||f>100)throw new Error(`-L must be an integer 1-${100} (got '${u}')`);h=f}let p={conflictMarkerSize:h,ancestorConflictTag:o("-S",Oe),localConflictTag:o("-X",Ce),otherConflictTag:o("-Y",Te)};return{ancestorFile:s,localFile:i,otherFile:a,outputFile:l,config:p}}async function or(e){if(e.includes("--version"))return process.stdout.write(`1.8.0
|
|
35
|
+
`),at;if(e.includes("--help"))return process.stdout.write(dn),at;let t;try{t=nr(e)}catch(r){return process.stderr.write(`sf-git-merge-driver: ${we(r)}
|
|
36
|
+
`),lt}try{return await new J(t.config).mergeFiles(t.ancestorFile,t.localFile,t.otherFile)?ut:at}catch(r){return r&&typeof r=="object"&&r.code==="ENOENT"?(process.stderr.write(`sf-git-merge-driver: ${we(r)}
|
|
37
|
+
`),lt):(process.stderr.write(`sf-git-merge-driver: ${we(r)}
|
|
38
|
+
`),ut)}}rr(process.versions.node),or(process.argv.slice(2)).then(e=>process.exit(e),e=>{process.stderr.write(`sf-git-merge-driver: ${we(e)}
|
|
39
|
+
`),process.exit(ut)});0&&(module.exports={assertNodeVersion,main,parseArgs});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Readable } from 'node:stream';
|
|
2
|
+
import type { NormalisedParseResult, XmlParser } from './XmlParser.js';
|
|
3
|
+
export interface TNode {
|
|
4
|
+
readonly tagName: string;
|
|
5
|
+
readonly attributes: Readonly<Record<string, string>>;
|
|
6
|
+
readonly children: ReadonlyArray<TNode | string>;
|
|
7
|
+
}
|
|
8
|
+
export declare const sentinelTextOf: (node: TNode) => string;
|
|
9
|
+
export declare const parsedToTNodes: (raw: unknown) => ReadonlyArray<TNode | string>;
|
|
10
|
+
export declare class TxmlXmlParser implements XmlParser {
|
|
11
|
+
parseString(xml: string): NormalisedParseResult;
|
|
12
|
+
parseStream(source: Readable): Promise<NormalisedParseResult>;
|
|
13
|
+
}
|