Add remotes view on the SCM panel
[?]
Jan 13, 2021, 6:37 PM
3FBABWSMIDOX2CITKFYHRBFW2EM3P37KPYDT44ACUP73MRJ5AXZQCDependencies
- [2]
6S7IH4SQDelay refresh event to avoid pristine locking issue - [3]
VC2RHYTFHide views on SCM panel when extension isn't activated - [4]
TPJNM4C4Show only the changes which are not in the current channel on the channel view - [*]
L3VOQYAFAdd changelog view to the source control panel - [*]
B4SKYP3YAdd repository model and add steps to initialize it - [*]
VT237HUJAdd tree view for channels - [*]
ZGMIJNFVCreate pijul.ts for executing commands using the Pijul CLI - [*]
L44OILGKAdd reset command to resource state context menu - [*]
NCBEWRYEInitialize Repository
Change contents
- file addition: remotes.ts[6.8]
import { Event, TreeDataProvider, TreeItem, TreeItemCollapsibleState } from 'vscode';import { PijulRemote, Repository } from '../pijul';/*** The Changelog provider class is a Treedata provider which provides* TreeData for the `pijul.views.changelog` TreeView*/export class RemotesViewProvider implements TreeDataProvider<PijulRemote> {/*** Create a new ChangelogViewProvider instance* @param repository*/constructor (private readonly repository: Repository,public readonly onDidChangeTreeData?: Event<void>) {}/*** Convert a PijulRemote into a TreeItem* @param element*/getTreeItem (element: PijulRemote): TreeItem | Thenable<TreeItem> {return {label: element.url,collapsibleState: TreeItemCollapsibleState.None,contextValue: 'PijulRemote'};}/*** Get the children of the element or the root if no element is passed* @param element An optional element to get the children of*/async getChildren (element?: PijulRemote): Promise<PijulRemote[] | null | undefined> {if (element) {// Remotes don't have childrenreturn null;} else {let children;// Retry if the pristine is locked. TODO: More robust solutionwhile (!children) {try {children = await this.repository.getRemotes();} catch (err) {if (!(err instanceof Error) || !err.message.includes('Pristine locked')) {throw err;}}}return children;}}} - edit in src/repository.ts at line 10
import { RemotesViewProvider } from './views/remotes'; - edit in src/repository.ts at line 112
this.disposables.push(window.registerTreeDataProvider('pijul.views.remotes', new RemotesViewProvider(this.repository, debounceEvent(this.onDidRefreshStatus, 200)))); - edit in src/pijul.ts at line 470
}/*** Get the remotes of this repository with `pijul remote`*/async getRemotes (): Promise<PijulRemote[]> {return (await this._pijul.exec(this.repositoryRoot, ['remote'])).stdout.split(/\r?\n/).map(l => new PijulRemote(l.trim())); - edit in src/pijul.ts at line 637
) {}}/*** Class representing a remote repository*/export class PijulRemote {/*** Create a new instance of a PijulRemote object* @param url The url of the remote*/constructor (public readonly url: string - edit in package.json at line 499
},{"id": "pijul.views.remotes","name": "Remotes","contextualTitle": "Pijul","visibility": "visible","when": "config.pijul.enabled && pijul.activated"