List channel changes under each channel in Channels view

[?]
Jan 11, 2021, 8:49 PM
USPPMDII5BK5SBT4DCD7TETL2YSPZ2CVXREPKNPGQUU3SKFONM4AC

Dependencies

  • [2] J6DDODYY Update views to refresh with the rest of the repository state
  • [3] LL5PNIAB Add command for switching to a given channel
  • [4] HF3NERPZ Add cache for changes and add change dependencies to log
  • [5] FM2OUEL7 Change log parsing regex for better handling of multi-line messages
  • [6] GGYKE3DV Enforce documentation on every Function, Method, and Class
  • [7] L3VOQYAF Add changelog view to the source control panel
  • [8] VT237HUJ Add tree view for channels
  • [9] OXW4KMVU Add QuickDiffProvider
  • [10] 64J6B76F Add command to rename channels
  • [*] ZGMIJNFV Create pijul.ts for executing commands using the Pijul CLI

Change contents

  • replacement in src/views/channels.ts at line 1
    [6.14][2.0:86](),[2.86][6.94:147](),[6.94][6.94:147]()
    import { Event, TreeDataProvider, TreeItem, TreeItemCollapsibleState } from 'vscode';
    import { PijulChannel, Repository } from '../pijul';
    [6.14]
    [6.147]
    import { Event, TreeDataProvider, TreeItem, TreeItemCollapsibleState, Uri } from 'vscode';
    import { PijulChange, PijulChannel, Repository } from '../pijul';
  • replacement in src/views/channels.ts at line 8
    [6.277][6.277:355]()
    export class ChannelsViewProvider implements TreeDataProvider<PijulChannel> {
    [6.277]
    [6.355]
    export class ChannelsViewProvider implements TreeDataProvider<PijulChannel | PijulChange> {
  • replacement in src/views/channels.ts at line 22
    [6.574][6.574:826](),[6.826][3.0:148](),[3.148][6.861:868](),[6.861][6.861:868]()
    getTreeItem (element: PijulChannel): TreeItem | Thenable<TreeItem> {
    return {
    id: element.name,
    label: element.name,
    description: element.isCurrent ? 'Current' : undefined,
    collapsibleState: TreeItemCollapsibleState.None,
    // Different context menu options for current and inactive channels
    contextValue: 'pijulChannel' + (element.isCurrent ? 'Current' : '')
    };
    [6.574]
    [6.868]
    getTreeItem (element: PijulChannel | PijulChange): TreeItem | Thenable<TreeItem> {
    if (element instanceof PijulChannel) {
    return {
    id: element.name,
    label: element.name,
    description: element.isCurrent ? 'Current' : undefined,
    collapsibleState: element.isCurrent ? TreeItemCollapsibleState.None : TreeItemCollapsibleState.Collapsed,
    // Different context menu options for current and inactive channels
    contextValue: 'pijulChannel' + (element.isCurrent ? 'Current' : '')
    };
    } else {
    return {
    label: element.message,
    description: `${element.author.name}, ${element.date.toISOString()}`,
    collapsibleState: TreeItemCollapsibleState.None,
    contextValue: 'pijulChange',
    tooltip: `${element.hash}\nRecorded by ${element.author.fullName ?? element.author.name} at ${element.date.toISOString()}\n\n\t${element.message}\n`,
    command: {
    command: 'vscode.open',
    title: 'Open Change TOML',
    arguments: [Uri.parse('pijul-change:' + element.hash)]
    }
    };
    }
  • replacement in src/views/channels.ts at line 52
    [6.1018][6.1018:1109]()
    async getChildren (element?: PijulChannel): Promise<PijulChannel[] | null | undefined> {
    [6.1018]
    [6.1109]
    async getChildren (element?: PijulChannel | PijulChange): Promise<Array<PijulChannel | PijulChange> | null | undefined> {
  • replacement in src/views/channels.ts at line 55
    [6.1166][6.1166:1245]()
    // TODO: Show the changes in this channel as children
    return null;
    [6.1166]
    [6.1245]
    if (element instanceof PijulChannel) {
    return await this.repository.getLog(element.name);
    } else {
    return null;
    }
  • replacement in src/pijul.ts at line 149
    [4.163][4.163:256]()
    * A dictionary for holding a cache of change hashes to avoid recalculating them each time
    [4.163]
    [4.256]
    * A dictionary for holding a cache of change hashes to avoid recalculating them each time.
    * Persists between refreshes.
  • edit in src/pijul.ts at line 154
    [4.329]
    [6.1305]
    // TODO: Create a number of sets which hold the state of the channels in memory.
    // Instead of each log, remote, or channel listing operation interacting with the CLI,
    // the state of the repository will be loaded each refresh and then accessed through the cache.
  • edit in src/pijul.ts at line 415
    [6.1559]
    [6.1559]
    * @param channel optional name of a channel to get the log for
  • replacement in src/pijul.ts at line 417
    [6.1565][6.1565:1609]()
    async getLog (): Promise<PijulChange[]> {
    [6.1565]
    [6.1609]
    async getLog (channel?: string): Promise<PijulChange[]> {
  • edit in src/pijul.ts at line 419
    [6.1648]
    [6.1648]
    const additionalArgs: string[] = [];
    if (channel) {
    additionalArgs.push('--channel', channel);
    }
  • replacement in src/pijul.ts at line 426
    [6.1750][6.1750:1823]()
    const result = await this._pijul.exec(this.repositoryRoot, ['log']);
    [6.1750]
    [5.0]
    const result = await this._pijul.exec(this.repositoryRoot, ['log', ...additionalArgs]);