Add repository model and add steps to initialize it
[?]
Dec 24, 2020, 1:20 AM
B4SKYP3Y5R7UPPGLLZV7OK3SIN4TRAJ3IL6FS3T7ZFZF5HTEQARQCDependencies
- [2]
4PN3R2LYFix lint/style issues - [3]
TKKT6D4CAdd failure loop to installation selection - [4]
WHFIIX4YImprove documentation and add Pijul installation configuration - [5]
WW67NYZVConfigure eslint for JS standard formatting - [6]
3N3RS66TCreate pijul output channel and configure activation events - [*]
NCBEWRYEInitialize Repository
Change contents
- file addition: repository.ts[8.104980]
import { Disposable, OutputChannel, scm, SourceControl, SourceControlResourceGroup, Uri } from 'vscode';import { Repository as BaseRepository } from './pijul';import { dispose } from './utils/disposableUtils';export class Repository {private readonly sourceControl: SourceControl;private disposables: Disposable[] = [];private readonly unrecordedChangesGroup: SourceControlResourceGroup;private readonly untrackedGroup: SourceControlResourceGroup;constructor (private readonly repository: BaseRepository,private readonly outputChannel: OutputChannel) {const root = Uri.file(repository.root);this.sourceControl = scm.createSourceControl('pijul', 'Pijul', root);// Add command to accept message in source control input boxthis.sourceControl.acceptInputCommand = { command: 'pijul.record', title: 'record', arguments: [this.sourceControl] };// TODO: Add quick diff provider// TODO: Add input validationthis.disposables.push(this.sourceControl);// TODO: Set input box placeholder// TODO: Create resource groupsthis.unrecordedChangesGroup = this.sourceControl.createResourceGroup('unrecordedChanges', 'Unrecorded Changes');this.untrackedGroup = this.sourceControl.createResourceGroup('untracked', 'Untracked Changes');this.disposables.push(this.unrecordedChangesGroup);this.disposables.push(this.untrackedGroup);this.untrackedGroup.hideWhenEmpty = true;console.log('Created Repository');}/*** Dispose all of this repository's disposable resources*/dispose (): void {this.disposables = dispose(this.disposables);}} - edit in src/extension.ts at line 4
import { Pijul } from './pijul';import { Repository } from './repository'; - replacement in src/extension.ts at line 14
if (path == null) {if (!path) { - replacement in src/extension.ts at line 72
if (code != null || tokens[0] !== 'pijul') {if (code || tokens[0] !== 'pijul') { - replacement in src/extension.ts at line 89
await vscode.window.showInformationMessage('Pijul repository detected in workspace, extension has been activated.');vscode.window.showInformationMessage('Pijul repository detected in workspace, extension has been activated.'); - replacement in src/extension.ts at line 121
// const pijul = new Pijul(pijulInfo);const pijul = new Pijul(pijulInfo);const root = vscode.workspace.workspaceFolders?.[0]?.uri?.path ?? '';const repository = new Repository(pijul.open(root, root + '.pijul'), outputChannel);console.log(repository);