$darkmode
Elektra 0.11.0
|
kdb-cmerge - Join three key sets together
kdb cmerge [OPTIONS] our their base result
our
their
base
keysetkdb cmerge
can incorporate changes from two modified versions (our and their) into a common preceding version (base) of a key set. This lets you merge the sets of changes represented by the two newer key sets. This is called a three-way merge between key sets.
On success the resulting keyset will be saved to mergepath.
On unresolved conflicts nothing will be changed.
This tool currently exists alongside kdb merge
until it is completely ready to supersede it. At this moment, cmerge will be renamed to merge.
The options of kdb cmerge
are:
-f
, --force
: overwrite existing keys in result
-v
, --verbose
: give additional informationStrategies offer fine grained control over conflict handling. The option is:
-s <name>
, --strategy <name>
: which is used to specify a strategy to use in case of a conflictStrategies have their own man page which can be accessed with man elektra-cmerge-strategies
.
The result of the merge is stored in result
.
You can think of the three-way merge as subtracting base from their and adding the result to our, or as merging into our the changes that would turn base into their. Thus, it behaves exactly as the GNU diff3 tool. These three versions of the KeySet are:
base
: The base
KeySet is the original version of the key set.our
: The our
KeySet represents the user's current version of the KeySet.base
for every key you changed.their
: The their
KeySet usually represents the default version of a KeySet (usually the package maintainer's version).base
for every key someone has changed.The three-way merge works by comparing the our
KeySet and the their
KeySet to the base
KeySet. By looking for differences in these KeySets, a new KeySet called result
is created that represents a merge of these KeySets.
Conflicts occur when a key has a different value in all three key sets or when only base differs. When all three values for a key differ, we call this an overlap. Different merge strategies exist to resolve those conflicts.
To complete a simple merge of three KeySets:
````ssh kdb set user:/base "A" #> Create a new key user:/base with string "A" kdb set user:/their "A" #> Create a new key user:/their with string "A" kdb set user:/our "B" #> Create a new key user:/our with string "B" kdb cmerge user:/our user:/their user:/base user:/result kdb get user:/result #>B
```