tahoe-lafs / magic-folder

Tahoe-LAFS-based file synchronization
Other
25 stars 7 forks source link

Conflict resolution via filesystem #754

Open meejah opened 2 months ago

meejah commented 2 months ago

There is currently no way to resolve a conflict via changes to the filesystem (even after #725 is landed).

We need a specification and documentation as well an implementation (that works alongside the HTTP API introduced in #752).

As a user who has noticed that a file is in conflict, I wish to manipulate the conflicted file to contain the changes I want and finalize this decision by deleting the conflict-marker files.

As a user who has a file in conflict, I will indicate that I want "my" version by deleting all the conflict-markers.

As a user who has a file in conflict, I will indicate that I want "their" version my moving the conflict-marker over top of the original file (and deleting any other conflict markers).

meejah commented 2 months ago

Let us say that we have a file "foo" that starts out with content "initial".

Our side edits it to contain: "meejah was here". The other side ("yarrow") edits "foo" to contain: "To light a candle is to cast a shadow."

When these two edits collide, our filesystem might look like:

./tiny-texts/
    foo
    foo.conflict-yarrow

To accept Yarrow's edits, we might use the incantation mv foo.conflict-yarrow foo which does two things at once: makes the contents match Yarrow's side, and deletes the conflict-marker files. To make the final result our content, we can invoke rm foo.conflict-yarrow (deleting all the conflict-markers).

For the most-complex case, we can edit "foo" to contain e.g. "Meejah lit a candle and cast a shadow" and then delete the conflict-marker.

meejah commented 2 months ago

The proposal here should work for the examples above: https://github.com/tahoe-lafs/magic-folder/blob/main/docs/proposed/conflict-api.rst#resolve-a-conflict ... so we need an implementation of that.