Add pijul.openChange command and text document provider for pijul-change scheme

[?]
Jan 4, 2021, 11:52 PM
GNQD74OZ56J2R23GVUGFP3G5KVML2KDZ4OUZK6SVLSM7HVO2WOCAC

Dependencies

  • [2] WCQM6IOK Add parsing of Author strings
  • [3] GGYKE3DV Enforce documentation on every Function, Method, and Class
  • [4] ZGMIJNFV Create pijul.ts for executing commands using the Pijul CLI
  • [5] VP6KWIRT Add inline icons for commands on SCM view
  • [6] ODRMVURU Implement first iteration of file diffing
  • [7] 6H4B4UJQ Add commands to open repo and global pijul configuration files
  • [8] OXW4KMVU Add QuickDiffProvider
  • [9] YUVLBWV3 Populate resource groups for unrecorded and untracked changes
  • [10] L44OILGK Add reset command to resource state context menu
  • [11] L3VOQYAF Add changelog view to the source control panel
  • [12] ILH3GIVT Add command centre and refresh/init commands
  • [*] B4SKYP3Y Add repository model and add steps to initialize it
  • [*] NCBEWRYE Initialize Repository

Change contents

  • replacement in src/views/changelog.ts at line 1
    [3.24][3.25:104]()
    import { TreeDataProvider, TreeItem, TreeItemCollapsibleState } from 'vscode';
    [3.24]
    [3.104]
    import { TreeDataProvider, TreeItem, TreeItemCollapsibleState, Uri } from 'vscode';
  • edit in src/views/changelog.ts at line 22
    [3.666]
    [3.666]
    const resourceUri = Uri.parse('pijul-change:' + element.hash);
  • replacement in src/views/changelog.ts at line 28
    [2.76][3.766:820](),[3.766][3.766:820]()
    collapsibleState: TreeItemCollapsibleState.None
    [2.76]
    [3.820]
    collapsibleState: TreeItemCollapsibleState.None,
    contextValue: 'pijulChange',
    resourceUri: resourceUri,
    command: {
    command: 'vscode.open',
    title: 'Open Change TOML',
    arguments: [resourceUri]
    }
  • edit in src/repository.ts at line 106
    [3.101]
    [3.0]
    this.disposables.push(workspace.registerTextDocumentContentProvider('pijul-change', this.repository));
  • replacement in src/pijul.ts at line 182
    [3.686][3.272:606](),[3.834][3.272:606]()
    * 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
    [3.686]
    [3.606]
    * Implementation of the TextDocumentContentProvider. Depending on the scheme of the given URI, either returns
    * a the last recorded version of a file using `pijul reset` or the stdout of the `pijul change` command.
    * @param uri The URI, with scheme 'pijul' or 'pijul-change', which will be used to determine which text document should be returned.
  • replacement in src/pijul.ts at line 188
    [3.796][3.796:994]()
    // return stdout, which is the last recorded version of the file
    return (await this._pijul.exec(this.repositoryRoot, ['reset', uri.path, '--dry-run'], { cancellationToken: token })).stdout;
    [3.796]
    [3.994]
    if (uri.scheme === 'pijul-change') {
    return (await this._pijul.exec(this.repositoryRoot, ['change', uri.path], { cancellationToken: token })).stdout;
    } else {
    // return stdout of a pijul reset dry run, which is the last recorded version of the file
    return (await this._pijul.exec(this.repositoryRoot, ['reset', uri.path, '--dry-run'], { cancellationToken: token })).stdout;
    }
  • replacement in src/commands.ts at line 4
    [3.877][3.96:129](),[3.240][3.96:129](),[3.96][3.96:129]()
    import { Pijul } from './pijul';
    [3.240]
    [3.129]
    import { Pijul, PijulChange } from './pijul';
  • edit in src/commands.ts at line 241
    [3.258]
    [3.258]
    * Opens the output of `pijul change` for a given change
    * @param resourceStates The resources to open
    */
    @command('pijul.openChange')
    async openChange (change: PijulChange): Promise<void> {
    const changeUri = Uri.parse('pijul-change:' + change.hash);
    console.log(changeUri);
    await commands.executeCommand('vscode.open', changeUri);
    }
    /**
  • edit in package.json at line 92
    [3.1603]
    [3.1175]
    "command": "pijul.openChange",
    "title": "Open Change TOML",
    "category": "Pijul"
    },
    {
  • replacement in package.json at line 253
    [3.2688][3.2688:2693]()
    ]
    [3.2688]
    [3.2693]
    ],
    "view/item/context": [
    {
    "command": "pijul.openChange",
    "when": "view == pijul.views.log && viewItem == pijulChange"
    }
    ]