sf-git-merge-driver 1.2.1-dev-137.18569178375-1 → 1.2.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 CHANGED
@@ -1,65 +1,144 @@
1
1
  # Salesforce Metadata Git Merge Driver
2
2
 
3
- [![License](https://img.shields.io/badge/License-MIT-blue)]()
4
- [![Compatibility](https://img.shields.io/badge/Windows%20%7C%20Mac%20%7C%20Linux-Supported-success)]()
3
+ A custom Git merge driver designed specifically for Salesforce metadata files. This tool helps resolve merge conflicts in Salesforce XML metadata files by understanding their structure and intelligently merging changes.
5
4
 
6
- An intelligent Git merge driver specifically designed for Salesforce metadata files. **Eliminates hours** of manual merge conflicts resolution.
5
+ ## Features
7
6
 
8
- ![Demo GIF](./docs/media/demo-sf-git-merge-driver.gif)
7
+ - Intelligent merging of Salesforce XML metadata files
8
+ - Handles complex metadata structures like arrays with unique identifiers
9
+ - Supports both local and global installation
10
+ - Easy to use with SFDX CLI plugin commands
11
+ - Warning: as of now it does not preserve the order of items that are order dependant like valuesets
9
12
 
10
- ## Why use this plugin?
13
+ ## Installation
11
14
 
12
- - **Saves time**: No more manual XML conflict resolution
13
- - **Zero-config**: Works immediately after installation
14
- - **Reliable**: Understands Salesforce metadata structure
15
- - **Transparent**: Seamless Git workflow integration
15
+ ```bash
16
+ sf plugins install sf-git-merge-driver
17
+ ```
18
+
19
+ ## Usage
16
20
 
17
- ## How it works
21
+ <!-- commands -->
22
+ * [`sf git merge driver install`](#sf-git-merge-driver-install)
23
+ * [`sf git merge driver run`](#sf-git-merge-driver-run)
24
+ * [`sf git merge driver uninstall`](#sf-git-merge-driver-uninstall)
18
25
 
19
- ```mermaid
20
- sequenceDiagram
21
- participant Dev
22
- participant Git
23
- participant MergeDriver
26
+ ## `sf git merge driver install`
27
+
28
+ Installs a local git merge driver for the given org and branch.
24
29
 
25
- Dev->>Git: git merge
26
- Git->>MergeDriver: Detects XML conflict
27
- MergeDriver->>MergeDriver: Analyzes metadata structure
28
- MergeDriver->>MergeDriver: Smart merging
29
- MergeDriver->>Git: Returns merged result
30
- Git->>Dev: Clean commit (no conflicts)
31
30
  ```
31
+ USAGE
32
+ $ sf git merge driver install [--json] [--flags-dir <value>]
32
33
 
33
- ## Installation (30 seconds)
34
+ GLOBAL FLAGS
35
+ --flags-dir=<value> Import flag values from a directory.
36
+ --json Format output as json.
34
37
 
35
- ```bash
36
- # Install plugin (one time, global)
37
- sf plugins install sf-git-merge-driver
38
+ DESCRIPTION
39
+ Installs a local git merge driver for the given org and branch.
40
+
41
+ Installs a local git merge driver for the given org and branch, by updating the `.git/info/attributes` files in the
42
+ project, creating a new merge driver configuration in the `.git/config` of the project, and installing the binary in
43
+ the node_modules/.bin directory.
38
44
 
39
- # Configure merge driver in your project (one time, local per project)
40
- cd my/sf/project
41
- sf git merge driver install
45
+ EXAMPLES
46
+ Install the driver for a given project:
47
+
48
+ $ sf git merge driver install
42
49
  ```
43
50
 
44
- ## Usage
51
+ _See code: [src/commands/git/merge/driver/install.ts](https://github.com/scolladon/sf-git-merge-driver/blob/v1.2.1/src/commands/git/merge/driver/install.ts)_
45
52
 
46
- The merge driver activates **automatically** for conflicts on:
47
- - [Full list of supported metadata](#configuration)
53
+ ## `sf git merge driver run`
48
54
 
49
- **No additional steps required!** Works during normal Git operations:
50
- ```bash
51
- git pull # Conflicts resolved automatically
52
- git merge # Same here
55
+ Runs the merge driver for the specified files.
56
+
57
+ ```
58
+ USAGE
59
+ $ sf git merge driver run -O <value> -A <value> -B <value> -P <value> [--json] [--flags-dir <value>] [-L <value>] [-S
60
+ <value>] [-X <value>] [-Y <value>]
61
+
62
+ FLAGS
63
+ -A, --local-file=<value> (required) path to our version of the file
64
+ -B, --other-file=<value> (required) path to their version of the file
65
+ -L, --conflict-marker-size=<value> [default: 7] number of characters to show for conflict markers
66
+ -O, --ancestor-file=<value> (required) path to the common ancestor version of the file
67
+ -P, --output-file=<value> (required) path to the file where the merged content will be written
68
+ -S, --ancestor-conflict-tag=<value> [default: BASE] string used to tag ancestor version in conflicts
69
+ -X, --local-conflict-tag=<value> [default: LOCAL] string used to tag local version in conflicts
70
+ -Y, --other-conflict-tag=<value> [default: REMOTE] string used to tag other version in conflicts
71
+
72
+ GLOBAL FLAGS
73
+ --flags-dir=<value> Import flag values from a directory.
74
+ --json Format output as json.
75
+
76
+ DESCRIPTION
77
+ Runs the merge driver for the specified files.
78
+
79
+ Runs the merge driver for the specified files, handling the merge conflict resolution using Salesforce-specific merge
80
+ strategies. This command is typically called automatically by Git when a merge conflict is detected.
81
+
82
+ EXAMPLES
83
+ Run the merge driver for conflicting files:
84
+
85
+ $ sf git merge driver run --ancestor-file=<value> --local-file=<value> --other-file=<value> \
86
+ --output-file=<value>
87
+
88
+ Where:
89
+ - ancestor-file is the path to the common ancestor version of the file
90
+ - local-file is the path to our version of the file
91
+ - other-file is the path to their version of the file
92
+ - output-file is the path to the file where the merged content will be written
53
93
  ```
54
94
 
95
+ _See code: [src/commands/git/merge/driver/run.ts](https://github.com/scolladon/sf-git-merge-driver/blob/v1.2.1/src/commands/git/merge/driver/run.ts)_
96
+
97
+ ## `sf git merge driver uninstall`
98
+
99
+ Uninstalls the local git merge driver for the given org and branch.
100
+
101
+ ```
102
+ USAGE
103
+ $ sf git merge driver uninstall [--json] [--flags-dir <value>]
104
+
105
+ GLOBAL FLAGS
106
+ --flags-dir=<value> Import flag values from a directory.
107
+ --json Format output as json.
108
+
109
+ DESCRIPTION
110
+ Uninstalls the local git merge driver for the given org and branch.
111
+
112
+ Uninstalls the local git merge driver for the given org and branch, by removing the merge driver content in the
113
+ `.git/info/attributes` files in the project, deleting the merge driver configuration from the `.git/config` of the
114
+ project, and removing the installed binary from the node_modules/.bin directory.
115
+
116
+ EXAMPLES
117
+ Uninstall the driver for a given project:
118
+
119
+ $ sf git merge driver uninstall
120
+ ```
121
+
122
+ _See code: [src/commands/git/merge/driver/uninstall.ts](https://github.com/scolladon/sf-git-merge-driver/blob/v1.2.1/src/commands/git/merge/driver/uninstall.ts)_
123
+ <!-- commandsstop -->
124
+
125
+ ## How It Works
126
+
127
+ The merge driver works by:
128
+ 1. Converting XML to JSON for easier processing
129
+ 2. Using a specialized three-way merge algorithm that understands Salesforce metadata structures
130
+ 3. Intelligently resolving conflicts based on metadata type
131
+ 4. Converting the merged result back to properly formatted XML
132
+
55
133
  ## Configuration
56
134
 
57
- Configured for these metadata files by default:
58
- ```gitattributes
59
- *.profile-meta.xml merge=salesforce-source
60
- *.permissionset-meta.xml merge=salesforce-source
135
+ The driver is configured to work with `.xml` files by default. The installation adds the following to the `.git/info/attributes` file (so it is discrete for the current repo):
136
+
137
+ ```
61
138
  *.labels-meta.xml merge=salesforce-source
62
139
  *.label-meta.xml merge=salesforce-source
140
+ *.profile-meta.xml merge=salesforce-source
141
+ *.permissionset-meta.xml merge=salesforce-source
63
142
  *.applicationVisibility-meta.xml merge=salesforce-source
64
143
  *.classAccess-meta.xml merge=salesforce-source
65
144
  *.customMetadataTypeAccess-meta.xml merge=salesforce-source
@@ -105,7 +184,7 @@ Configured for these metadata files by default:
105
184
  *.objectTranslation-meta.xml merge=salesforce-source
106
185
  ```
107
186
 
108
- ## Troubleshooting
187
+ ## Debugging
109
188
 
110
189
  The plugin uses the [Salesforce CLI logging system](https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_dev_cli_log_messages.htm) to log information.
111
190
  You can control the logging level by setting the `SF_LOG_LEVEL` environment variable.
@@ -125,6 +204,7 @@ GIT_TRACE=true
125
204
  git merge ...
126
205
  ```
127
206
 
207
+
128
208
  ## Changelog
129
209
 
130
210
  [changelog.md](CHANGELOG.md) is available for consultation.
@@ -140,7 +220,7 @@ Versioning follows [SemVer](http://semver.org/) specification.
140
220
 
141
221
  ## Contributing
142
222
 
143
- Contributions are what make the trailblazer community such an amazing place. We regard this component as a way to inspire and learn from others. Any contributions you make are **appreciated**.
223
+ Contributions are what make the trailblazer community such an amazing place. I regard this component as a way to inspire and learn from others. Any contributions you make are **appreciated**.
144
224
 
145
225
  See [contributing.md](CONTRIBUTING.md) for sgd contribution principles.
146
226