* Fix #1056 and add author and license metadata types * Transcript demonstrating that the codebase is empty at first
2.2 KiB
Resolving edit conflicts in ucm
.> builtins.merge
The ucm
tool tracks edits to hashes in an object called a patch. When patches get merged, sometimes those patches will have conflicting edits. The replace.term
command helps resolve such conflicts.
First, let's make a new namespace, example.resolve
:
.> cd example.resolve
Now let's add a term named a.foo
:
a.foo = 42
.example.resolve> add
We'll fork the namespace a
into a new namespace b
, so we can edit the two concurrently.
.example.resolve> fork a b
We'll also make a second fork c
which we'll use as the target for our patch later.
.example.resolve> fork a c
Now let's make a change to foo
in the a
namespace:
.example.resolve> cd a
foo = 43
.example.resolve.a> update
And make a different change in the b
namespace:
.example.resolve> cd .example.resolve.b
foo = 44
.example.resolve.b> update
The a
and b
namespaces now each contain a patch named patch
. We can view these:
.example.resolve.b> cd .example.resolve
.example.resolve> view.patch a.patch
.example.resolve> view.patch b.patch
Let's now merge these namespaces into c
:
.example.resolve> merge a c
.example.resolve> merge b c
The namespace c
now has an edit conflict, since the term foo
was edited in two different ways.
.example.resolve> cd c
.example.resolve.c> todo
We see that #44954ulpdf
(the original hash of a.foo
) got replaced with both the #8e68dvpr0a
and #jdqoenu794
.
We can resolve this conflict by picking one of the terms as the "winner":
.example.resolve.c> replace.term #44954ulpdf #8e68dvpr0a
This changes the merged c.patch
so that only the edit from #44954ulpdf to #8e68dvpr0a remains:
.example.resolve.c> view.patch
We still have a remaining name conflict since it just so happened that both of the definitions in the edits were named foo
.
.example.resolve.c> todo
We can resolve the name conflict by deleting one of the names.
.example.resolve.c> delete.term foo#jdqoenu794
And that's how you resolve edit conflicts with UCM.