[Feat] Create VSCode SourceControl based on reading `writable` from `OverlayFS`
Description
From the investigation spurred by #8 (closed), we identified a potentially simpler solution to powering a ISourceControl
implementation that reads from the writable
part of the BrowserFS based OverlayFS
(introduced !18 (merged)).
With this new FileSystem, we had to remove the old SourceControl implementation. Let's reintroduce it!
We'll handle "committing" in a separate issue.
Iteration Guide
- First, we'll want to this TODO and stub with an actual
ISourceControl
implementation with tests.
export interface WebIdeSourceControlOptions {
writable: FileSystem, //BrowserFS.FileSystem
readable: FileSystem,
repoRootPath: string
}
export class WebIdeSourceControl implements ISourceControl {
constructor(opt: WebIdeSourceControlOptions) { }
status() {
// Here's a possible algorithm for this:
// 1. Read `.deletedFiles.log` in `writable` (if exists) and parse. Treat each entry as "deleted" file statuses.
// 2. Recursively read all files in the `repoRootPath` in `writable`. For each file:
// a. If file was assumed to be deleted (based on `.deletedFiles.log`), remove "deleted" file status.
// b. If file does not exist in `readable`, add "new" file status.
// c. ElseIf `writable` file content is different than `readable` file content, add "modified" file status.
// 3. Return statuses.
}
}
- Hook this new
ISourceControl
implementation returned fromcreateSystems
into VSCode. Look at the VSCode extension API docs and commit 7f00b4f5 for how to interact with VSCode's Source Code. Add a call to set this up within the extension'smain
.
Edited by Paul Slaughter