Add command for switching to a given channel

[?]
Jan 5, 2021, 2:54 AM
LL5PNIABADMCIKL7OKCQM7AIQFK363TYWU65FSVM22YAV73FWROAC

Dependencies

  • [2] VT237HUJ Add tree view for channels
  • [3] 64J6B76F Add command to rename channels
  • [4] J6DDODYY Update views to refresh with the rest of the repository state
  • [5] GNQD74OZ Add pijul.openChange command and text document provider for pijul-change scheme
  • [6] 5ISTB4TW Add commands to copy the hash and message of changes in the log
  • [*] B4SKYP3Y Add repository model and add steps to initialize it
  • [*] ZGMIJNFV Create pijul.ts for executing commands using the Pijul CLI
  • [*] ILH3GIVT Add command centre and refresh/init commands
  • [*] NCBEWRYE Initialize Repository

Change contents

  • replacement in src/views/channels.ts at line 28
    [2.826][2.826:861]()
    contextValue: 'pijulChannel'
    [2.826]
    [2.861]
    // Different context menu options for current and inactive channels
    contextValue: 'pijulChannel' + (element.isCurrent ? 'Current' : '')
  • edit in src/repository.ts at line 280
    [3.752]
    [3.752]
    }
    /**
    * Switch to the given channel from the current channel
    * @param targetChannel The channel that will be switched to
    */
    async switchChannel (targetChannel: PijulChannel): Promise<void> {
    this.repository.switchChannel(targetChannel);
  • edit in src/pijul.ts at line 325
    [3.1095]
    [3.1095]
    }
    /**
    * Switch to the given channel from the current channel
    * @param targetChannel The channel that will be switched to
    */
    async switchChannel (channel: PijulChannel): Promise<void> {
    await this._pijul.exec(this.repositoryRoot, ['channel', 'switch', channel.name]);
  • edit in src/commands.ts at line 275
    [3.1459]
    [3.1459]
    await repository.refreshStatus();
    }
    /**
    * Switch to a different channel
    * @param repository The repository that contains the channels
    */
    @command('pijul.switchChannel', { repository: true })
    async switchChannel (repository: Repository, targetChannel: PijulChannel): Promise<void> {
    if (targetChannel.isCurrent) {
    throw new Error('Attempting to switch to current channel, this should be impossible');
    }
    await repository.switchChannel(targetChannel);
  • edit in package.json at line 109
    [3.1567]
    [3.1567]
    "category": "Pijul"
    },
    {
    "command": "pijul.switchChannel",
    "title": "Switch to Channel",
  • edit in package.json at line 290
    [3.1616]
    [3.1616]
    "command": "pijul.switchChannel",
    "when": "view == pijul.views.channels && viewItem == pijulChannel"
    },
    {
  • replacement in package.json at line 295
    [3.1655][3.1655:1727]()
    "when": "view == pijul.views.channels && viewItem == pijulChannel"
    [3.1655]
    [4.1936]
    "when": "view == pijul.views.channels && viewItem == pijulChannel || viewItem == pijulChannelCurrent"