Show altered files instead of dependencies as children of changes in changelog

[?]
Jan 14, 2021, 8:56 PM
7A3NMQ6QLJBGUXO4YWSBSDLP6MBZXBRCMMLO72R5HLCYOAYF7TYQC

Dependencies

  • [2] GGYUCHWQ Update change tooltip in changelog
  • [3] GVFKCLQH Prevent dependencies from appearing multiple times under the same change
  • [4] 5P6DJRJQ Fix outdated comment on changelog children
  • [5] L3VOQYAF Add changelog view to the source control panel
  • [6] HF3NERPZ Add cache for changes and add change dependencies to log
  • [7] J6DDODYY Update views to refresh with the rest of the repository state
  • [8] WCQM6IOK Add parsing of Author strings
  • [9] GNQD74OZ Add pijul.openChange command and text document provider for pijul-change scheme
  • [*] ZGMIJNFV Create pijul.ts for executing commands using the Pijul CLI
  • [*] H3GAPFUC Add pijul.recordAll command

Change contents

  • replacement in src/views/changelog.ts at line 8
    [5.288][5.288:366]()
    export class ChangelogViewProvider implements TreeDataProvider<PijulChange> {
    [5.288]
    [5.366]
    export class ChangelogViewProvider implements TreeDataProvider<PijulChange | string> {
  • replacement in src/views/changelog.ts at line 22
    [5.596][5.596:666](),[5.666][5.85:152]()
    getTreeItem (element: PijulChange): TreeItem | Thenable<TreeItem> {
    const resourceUri = Uri.parse('pijul-change:' + element.hash);
    [5.596]
    [5.152]
    getTreeItem (element: PijulChange | string): TreeItem | Thenable<TreeItem> {
    if (element instanceof PijulChange) {
    const resourceUri = Uri.parse('pijul-change:' + element.hash);
  • replacement in src/views/changelog.ts at line 26
    [5.153][5.666:679](),[5.666][5.666:679](),[5.679][5.0:27](),[5.27][5.703:733](),[5.703][5.703:733](),[5.733][5.0:76](),[5.76][5.28:88](),[5.88][5.209:244](),[5.209][5.209:244](),[5.244][2.0:156](),[2.156][5.276:401](),[5.276][5.276:401](),[5.401][5.820:827](),[5.820][5.820:827]()
    return {
    // id: element.hash,
    label: element.message,
    description: `${element.author.name}, ${element.date.toISOString()}`,
    collapsibleState: TreeItemCollapsibleState.Collapsed,
    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: [resourceUri]
    }
    };
    [5.153]
    [5.827]
    return {
    label: element.message,
    description: `${element.author.name}, ${element.date.toISOString()}`,
    collapsibleState: TreeItemCollapsibleState.Collapsed,
    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: [resourceUri]
    }
    };
    } else {
    // It's a string, representing a file path
    // TODO: Use URIs instead of strings
    // TODO: Customize appearance depending on file action (Edit, Replacement, Deletion, etc.)
    const sections = element.split(/\\|\//);
    return {
    label: sections[sections.length - 1],
    description: sections.slice(0, -1).join('/'),
    collapsibleState: TreeItemCollapsibleState.None,
    contextValue: 'pijulChangedFile'
    // TODO: Command and Tooltip
    };
    }
  • replacement in src/views/changelog.ts at line 57
    [5.980][5.980:1069]()
    async getChildren (element?: PijulChange): Promise<PijulChange[] | null | undefined> {
    [5.980]
    [5.1069]
    async getChildren (element?: PijulChange | string): Promise<Array<PijulChange | string> | null | undefined> {
  • replacement in src/views/changelog.ts at line 59
    [5.1088][4.0:55](),[4.55][5.89:156](),[5.1125][5.89:156]()
    // Show changes which the current one depends on
    return await this.repository.getChangeDependencies(element);
    [5.1088]
    [5.1196]
    if (element instanceof PijulChange) {
    // Show the paths of the files altered by the parent change
    return await this.repository.getChangeFiles(element);
    } else {
    // Paths have no children
    return null;
    }
  • edit in src/pijul.ts at line 303
    [3.138]
    [12.269]
    }
    /**
    * Gets a list of the files which were altered in a change
    * @param change The change to retrieve the altered files for
    */
    async getChangeFiles (change: PijulChange): Promise<string[]> {
    const changeToml = await this.getChangeToml(change.hash);
    const changePattern = /\d\.\s([A-Za-z]+)\sin\s(.*):/g;
    const files: Set<string> = new Set();
    let match = changePattern.exec(changeToml);
    while (match) {
    files.add(match[2]);
    match = changePattern.exec(changeToml);
    }
    return [...files];