Implement first iteration of file diffing
[?]
Dec 30, 2020, 3:02 AM
ODRMVURU4WGZNYNFTK4ZR6YVA4V4R6EL2OK3PJLYE2HJJEMNISSQCDependencies
- [2]
VP6KWIRTAdd inline icons for commands on SCM view - [3]
IBRKAWNMMoved utility modules into their own folder - [4]
6ONRFFRGFirst pass of file decorations - [5]
EJYTCVNQAdd stderr to error message when pijul CLI command fails - [6]
H6KYVQ2QAdd a class to represent resources - [7]
FAMBRMO7Add command to open file to source control resources - [8]
ZGMIJNFVCreate pijul.ts for executing commands using the Pijul CLI - [9]
YUVLBWV3Populate resource groups for unrecorded and untracked changes - [*]
B4SKYP3YAdd repository model and add steps to initialize it - [*]
ILH3GIVTAdd command centre and refresh/init commands - [*]
6H4B4UJQAdd commands to open repo and global pijul configuration files - [*]
NCBEWRYEInitialize Repository
Change contents
- edit in src/repository.ts at line 92
this.disposables.push(workspace.registerTextDocumentContentProvider('pijul', this.repository)); - replacement in src/pijul.ts at line 5
import { CancellationToken, TextDocument, Uri, workspace } from 'vscode';import { CancellationToken, TextDocument, TextDocumentContentProvider, Uri, workspace } from 'vscode'; - replacement in src/pijul.ts at line 135
export class Repository {export class Repository implements TextDocumentContentProvider { - edit in src/pijul.ts at line 150
* Implementation of the TextDocumentContentProvider, uses the `pijul reset <file> --dry-run` CLI command* to get the last recorded version of the file at the given URI, which VS Code can open as a text document.* @param uri The URI, with scheme 'pijul', which will be used to retrieve the last recorded version of the file* @param token A cancellation token for stopping the asynchronous child process execution*/async provideTextDocumentContent (uri: Uri, token: CancellationToken): Promise<string> {// return stdout, which is the last recorded version of the filereturn (await this._pijul.exec(this.repositoryRoot, ['reset', uri.path, '--dry-run'], { cancellationToken: token })).stdout;}/** - edit in src/commands.ts at line 203
}}/*** Open a diff comparison between a file and its last recorded version* @param resourceStates The resources to open*/@command('pijul.openDiff')async openDiff (...resourceStates: SourceControlResourceState[]): Promise<void> {for await (const resourceState of resourceStates) {const pijulUri = resourceState.resourceUri.with({ scheme: 'pijul' });await commands.executeCommand('vscode.diff', pijulUri, resourceState.resourceUri); - edit in package.json at line 81
"command": "pijul.openDiff","title": "Open Diff","category": "Pijul","icon": "$(diff)"},{ - replacement in package.json at line 198
},}, - edit in package.json at line 202
"group": "first"},{"command": "pijul.openDiff","when": "scmProvider == pijul && scmResourceGroup == changed",