.remote-state
folder. It comprises all files’ history..remote-state/history.ftd
-- record remote-state: file-history list history:
src-cr
field.-- record file-history: caption filename: file-edit-data list file-edit: -- record file-edit-data: caption or body message: integer timestamp: integer version: optional string author: option integer src-cr: string operation:
Actual content is stored in the file system based on .remote-state/<file-name-without-last-extension>.<version>.<extension>
.
Also, the version number starts with 1 for every file, and is incremented by one for every change in that file. Delete also increments the version number.
-- record clone-state: workspace-entry list workspace: -- record workspace-entry: caption filename: optional boolean deleted: integer version:
.clone-state
folder. Workspace information is stored in .clone-state/workspace.ftd
.We detect a file is updated locally by finding the version for every file in workspace.ftd
, and then comparing the local file with the .history/<filename>.<version>.<ext>
. If the content is different file is considered modified.
Say file is file.ftd, and its current version on remote is v1. On sync remote will get version (v1) and new content of file (file.ftd). Remote sees it’s own version of the file, let’s consider it’s also v1, so remote computes v2, and stored the new content of the file.
Remote returns latest file.v2.ftd
content, and clone stores it in .remote-state
, and updates the .clone-state/workspace.ftd
and file.ftd
in workspace.
If file.ftd
was modified by someone else in the meanwhile, and the remote state has already moved to v2, remote does a three way merge between v1 version of file.ftd as “base”, and v2 as “theirs” and the current content as “ours”.
In non conflicting state the file content is simply updated. Remote computes a v3, and returns the merged content to clone, clone adds it to .remote-state folder, and updates the workspace.ftd and file.ftd’s content in the workspace.
.remote-state
folder. workspace.ftd
and file.ftd
in workspace are not modified. This conflict, then, can be resolved by clone using fpm resolve-conflict <file>
.workspace.ftd
and the content of file.ftd
for that version as “base”, and the latest version of file.ftd
in .remote-state
as “theirs”, and the content of file.ftd
in the workspace as “ours” and perform three way merge, and if the merge fails, we know there is conflict.fpm rm <file>
command has been run, this sets deleted in workspace.ftd
entry, we send this information to remote on fpm sync
, and our version number. remote will see our version numbers match, so remote will create a new version number to mark deletion of the file, and update the .remote-state/history.ftd
. And the clone will delete the entry from .clone-state/workspace.ftd
.Remote again see two different version numbers, on delete we increase the version number, and reject the changes, as delete and edit are not cleanly merge-abe using three way merge operation.
Clone will show the conflict message.