Apply/retrieve diff patches in the CI build mirror service
The information sent in the mirror service from the FE code are going to be diffs. We need a safe way to get and apply them from the actual repo the mirror service is watching.
We also need to test if incremental diffs are better than differential diffs (the total diff change). If we use incremental diffs we will send less information and the communication will be faster, but we'll have to deal with sync problems.
Proposal:
-
We are going to implement to main endpoints:
files
andrepository
. -
Files
endpoint will accept the following actions:-
DELETE
: although we can delete files using diff patches, the whole content of the removed file is going along with the patch. Enabling and endpoint, that can remove a file using only its relative path can speed things up. -
PATCH
: will apply the differential diff patch and also delete files. The way we are planning this is:- Reset the repository for any existing changes
- Apply the patch
-
-
Repository
endpoint. This endpoint will be used toreset
the repository. It will be mainly used when the userdiscard all changes
in the Web IDE.
Regarding incremental diffs, it is really hard to sustain them. Mainly because the user will be able to modify, at the same time, the file. The workflow, in this case, can be really complicated, and it will involve a delay in the communication workflow:
- The web IDE sends an incremental diff
- The service checks if it can be cleanly applied
- If it can't be, then we need to communicate that to the web IDE.
- The web IDE will have to send the complete diff.
For simplicity, at least for this first iteration, we're going to use differential diffs.