Add reset command to resource state context menu

[?]
Dec 28, 2020, 7:13 PM
L44OILGKTGXSLQ3A4UQH44AMJXAVZSFISAB6ICHCDB6D42NKUWBQC

Dependencies

  • [2] 6ONRFFRG First pass of file decorations
  • [3] BIEL6Z5J Update resource groups to use custom interface
  • [4] B4SKYP3Y Add repository model and add steps to initialize it
  • [5] JYMSJCPQ Add command to add all untracked files and fix repository refreshing
  • [6] YUVLBWV3 Populate resource groups for unrecorded and untracked changes
  • [7] MU6ZNUYZ Integrate recordAll command with input box
  • [8] WHQQV5QQ Add watcher to refresh on file system changes
  • [9] ILH3GIVT Add command centre and refresh/init commands
  • [10] ZGMIJNFV Create pijul.ts for executing commands using the Pijul CLI
  • [*] NCBEWRYE Initialize Repository
  • [*] 3N3RS66T Create pijul output channel and configure activation events
  • [*] H6KYVQ2Q Add a class to represent resources

Change contents

  • replacement in src/repository.ts at line 1
    [3.16][3.0:134]()
    import { Disposable, Event, EventEmitter, OutputChannel, RelativePattern, scm, SourceControl, Uri, window, workspace } from 'vscode';
    [3.16]
    [2.0]
    import { Disposable, Event, EventEmitter, OutputChannel, RelativePattern, scm, SourceControl, SourceControlResourceState, Uri, window, workspace } from 'vscode';
  • replacement in src/repository.ts at line 153
    [3.1185][3.1185:1252]()
    * Reset all files in the repository by undoing recorded changes
    [3.1185]
    [3.1252]
    * Reset all files in the repository by undoing unrecorded changes
  • edit in src/repository.ts at line 160
    [3.279]
    [3.1523]
    * Reset specific files in the repository by undoing unrecorded changes
    */
    async reset (...resourceStates: SourceControlResourceState[]): Promise<void> {
    await this.repository.reset(resourceStates.map(r => r.resourceUri));
    }
    /**
  • replacement in src/pijul.ts at line 237
    [3.1341][3.1341:1408]()
    * Reset all files in the repository by undoing recorded changes
    [3.1341]
    [3.1408]
    * Reset all files in the repository by undoing unrecorded changes
  • edit in src/pijul.ts at line 242
    [3.1515]
    [3.4617]
    /**
    * Reset specific files in the repository by undoing unrecorded
    */
    async reset (files: Uri[]): Promise<void> {
    await this._pijul.exec(this.repositoryRoot, ['reset', ...files.map(f => f.fsPath)]);
    }
  • replacement in src/commands.ts at line 1
    [3.14][3.15:96]()
    import { commands, Disposable, OutputChannel, window, workspace } from 'vscode';
    [3.14]
    [3.96]
    import { commands, Disposable, OutputChannel, SourceControlResourceState, window, workspace } from 'vscode';
  • edit in src/commands.ts at line 144
    [3.1596]
    [3.1596]
    }
    /**
    * Resets specific files in the repository, discarding unrecorded changes
    * @param repository The repository that contains the files
    * @param resourceStates The resources that will be reset
    */
    @command('pijul.reset', { repository: true })
    async stage (repository: Repository, ...resourceStates: SourceControlResourceState[]): Promise<void> {
    for (const resource of resourceStates) {
    console.log(resource.resourceUri.path);
    }
    repository.reset(...resourceStates);
  • edit in package.json at line 46
    [3.1883]
    [3.1883]
    "command": "pijul.reset",
    "title": "Reset Unrecorded Changes",
    "category": "Pijul"
    },
    {
  • edit in package.json at line 74
    [13.1696]
    [14.6229]
    },
    "menus": {
    "scm/resourceState/context": [
    {
    "command": "pijul.reset",
    "when": "scmProvider == pijul && scmResourceGroup == changed",
    "group": "1_modification"
    }
    ]