Add menu command for recording changes to specific files

[?]
Dec 28, 2020, 8:58 PM
YDCLFNEJZCXIHV6SS2XC7WPBPA5QTSLRMVVDLZ3XRJ7QDAISEGHQC

Dependencies

  • [2] L44OILGK Add reset command to resource state context menu
  • [3] MU6ZNUYZ Integrate recordAll command with input box
  • [4] ILH3GIVT Add command centre and refresh/init commands
  • [5] H3GAPFUC Add pijul.recordAll command
  • [6] YUVLBWV3 Populate resource groups for unrecorded and untracked changes
  • [7] JYMSJCPQ Add command to add all untracked files and fix repository refreshing
  • [*] B4SKYP3Y Add repository model and add steps to initialize it
  • [*] BIEL6Z5J Update resource groups to use custom interface
  • [*] ZGMIJNFV Create pijul.ts for executing commands using the Pijul CLI
  • [*] NCBEWRYE Initialize Repository
  • [*] 3N3RS66T Create pijul output channel and configure activation events
  • [*] ZI7ORD4P Add iconv dependency

Change contents

  • edit in src/repository.ts at line 115
    [10.820]
    [3.31]
    }
    /**
    * Returns adn clears the message in the record input box if one is present,
    * presents the user with an input box otherwise.
    */
    private async getChangeMessage (): Promise<string | undefined> {
    let message: string | undefined = this.sourceControl.inputBox.value;
    // Clear message
    this.sourceControl.inputBox.value = '';
    if (!message) {
    message = await window.showInputBox({
    placeHolder: 'Change Message',
    prompt: 'Please include a message describing what has changed',
    ignoreFocusOut: true
    });
    }
    return message;
    }
    /**
    * Record all diffs in the given resources as a new change
    * @param resourceStates The files which will have their changes recorded
    * @param message The message for the new change
    */
    async recordChanges (resourceStates: SourceControlResourceState[], message? : string): Promise<void> {
    if (!message) {
    message = await this.getChangeMessage();
    }
    if (message) {
    await this.repository.recordChanges(resourceStates.map(r => r.resourceUri), message);
    } else {
    window.showErrorMessage('Change was not recorded, no message was provided');
    }
  • replacement in src/repository.ts at line 159
    [3.635][3.635:990]()
    message = this.sourceControl.inputBox.value;
    // Clear message
    this.sourceControl.inputBox.value = '';
    if (!message) {
    message = await window.showInputBox({
    placeHolder: 'Change Message',
    prompt: 'Please include a message describing what has changed',
    ignoreFocusOut: true
    });
    }
    [3.635]
    [3.990]
    message = await this.getChangeMessage();
  • edit in src/pijul.ts at line 221
    [3.280]
    [3.280]
    * Record all diffs in the given files as a new change
    * @param files The files that will be inlcuded in the new change
    * @param message The message for the new change
    */
    async recordChanges (files: Uri[], message: string): Promise<void> {
    await this._pijul.exec(this.repositoryRoot, ['record', ...files.map(f => f.fsPath), '-a', '-m', message], { input: 'test' });
    }
    /**
  • replacement in src/commands.ts at line 126
    [3.654][3.654:729]()
    * Create a new change with all of the currently unrecorded
    * changes
    [3.654]
    [3.729]
    * Create a new change with the unrecorded changes in the given files
    * @param repository The repository to record in
    * @param resourceStates The files to record changes for
    */
    @command('pijul.record', { repository: true })
    async record (repository: Repository, ...resourceStates: SourceControlResourceState[]): Promise<void> {
    await repository.recordChanges(resourceStates);
    await repository.refreshStatus();
    }
    /**
    * Create a new change with all of the currently unrecorded changes
  • replacement in src/commands.ts at line 163
    [2.1246][2.1246:1385]()
    for (const resource of resourceStates) {
    console.log(resource.resourceUri.path);
    }
    repository.reset(...resourceStates);
    [2.1246]
    [3.1596]
    await repository.reset(...resourceStates);
  • edit in package.json at line 33
    [13.1422]
    [14.276]
    "category": "Pijul"
    },
    {
    "command": "pijul.record",
    "title": "Record Current Changes",
  • edit in package.json at line 83
    [2.1551]
    [2.1551]
    "command": "pijul.record",
    "when": "scmProvider == pijul && scmResourceGroup == changed",
    "group": "1_modification"
    },
    {