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 box
this.sourceControl.acceptInputCommand = { command: 'pijul.record', title: 'record', arguments: [this.sourceControl] };
// TODO: Add quick diff provider
// TODO: Add input validation
this.disposables.push(this.sourceControl);
// TODO: Set input box placeholder
// TODO: Create resource groups
this.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);
}
}