add push and pull commands

Freax13
Aug 5, 2021, 3:11 PM
OKOH6H2FW3PK6Q2Y5CO7TRCRH2JZS6EIBKLIZO5OZAS3MFHJKRLQC

Dependencies

  • [2] MGRAFWDZ Add commands for applying changes to channels
  • [3] YTQW3VKI Run yarn lint --fix
  • [4] YPGOGP7Z add copy remote url and id commands
  • [5] H3GAPFUC Add pijul.recordAll command
  • [6] HVVRC2GN Add command to apply all outstanding changes from one channel to another
  • [7] XVYOJLZ4 add Delete Remote command
  • [*] B4SKYP3Y Add repository model and add steps to initialize it
  • [*] GPTHUH3N Add commands for unrecording changes
  • [*] ZGMIJNFV Create pijul.ts for executing commands using the Pijul CLI
  • [*] L44OILGK Add reset command to resource state context menu
  • [*] ILH3GIVT Add command centre and refresh/init commands
  • [*] NCBEWRYE Initialize Repository
  • [*] GNQD74OZ Add pijul.openChange command and text document provider for pijul-change scheme
  • [*] 5ISTB4TW Add commands to copy the hash and message of changes in the log
  • [*] L3VOQYAF Add changelog view to the source control panel

Change contents

  • edit in src/repository.ts at line 194
    [10.478]
    [5.31]
    }
    /**
    * Prompt the user to choose a remote
    */
    private async chooseChannel (placeHolder?: string): Promise<string | undefined> {
    // TODO: Show more channel information with QuickPickOption
    const items = (await this.repository.getChannels()).map(c => c.name);
    return await window.showQuickPick(items, { placeHolder: placeHolder ?? 'Channel Name', ignoreFocusOut: true });
  • replacement in src/repository.ts at line 213
    [2.346][2.346:505]()
    channelName = await window.showQuickPick((await this.repository.getChannels()).map(c => c.name), { placeHolder: 'Channel Name', ignoreFocusOut: true });
    [2.346]
    [2.505]
    channelName = await this.chooseChannel();
  • edit in src/repository.ts at line 370
    [5.427]
    [5.115]
    }
    }
    /**
    * Prompt the user to choose a remote
    */
    private async chooseRemote (): Promise<PijulRemote | undefined> {
    const items = (await this.repository.getRemotes()).map(c => ({
    label: c.url,
    description: c.remoteid,
    value: c
    }));
    const pick = await window.showQuickPick(items, { placeHolder: 'Remote url', ignoreFocusOut: true });
    return pick?.value;
    }
    /**
    * Pull changes from a remote
    * @param targetRemote The remote that will be pulled from
    */
    async pull (options: {from: boolean, to: boolean}, targetRemote?: PijulRemote): Promise<void> {
    if (!targetRemote) {
    targetRemote = await this.chooseRemote();
    }
    let from;
    if (options.from) {
    from = await this.chooseChannel('From Channel');
    if (from === undefined) { return; }
    }
    let to;
    if (options.to) {
    to = await this.chooseChannel('To Channel');
    if (to === undefined) { return; }
    }
    if (targetRemote) {
    await this.repository.pull(targetRemote, from, to);
  • edit in src/repository.ts at line 412
    [5.132]
    [5.132]
    * Push changes to a remote
    * @param targetRemote The remote that will be pushed to
    */
    async push (options: {from: boolean, to: boolean}, targetRemote?: PijulRemote): Promise<void> {
    if (!targetRemote) {
    targetRemote = await this.chooseRemote();
    }
    let from;
    if (options.from) {
    from = await this.chooseChannel('From Channel');
    if (from === undefined) { return; }
    }
    let to;
    if (options.to) {
    to = await this.chooseChannel('To Channel');
    if (to === undefined) { return; }
    }
    if (targetRemote) {
    await this.repository.push(targetRemote, from, to);
    }
    }
    /**
  • replacement in src/repository.ts at line 442
    [5.308][5.308:601]()
    const items = (await this.repository.getRemotes()).map(c => ({
    label: c.url,
    description: c.remoteid,
    value: c
    }));
    const pick = await window.showQuickPick(items, { placeHolder: 'Remote url', ignoreFocusOut: true });
    targetRemote = pick?.value;
    [5.308]
    [5.427]
    targetRemote = await this.chooseRemote();
  • edit in src/repository.ts at line 444
    [5.433]
    [5.602]
    if (!targetRemote) return;
  • replacement in src/repository.ts at line 446
    [5.603][5.603:689]()
    if (targetRemote) {
    await this.repository.deleteRemote(targetRemote);
    }
    [5.603]
    [5.433]
    const pick = await window.showWarningMessage('Are you sure you want to delete ' + targetRemote.url + '?', { modal: true }, 'Yes');
    if (pick !== 'Yes') return;
    await this.repository.deleteRemote(targetRemote);
  • edit in src/pijul.ts at line 525
    [3.257]
    [12.763]
    }
    /**
    * Pull from a remote of this repository with `pijul pull [url] -a`
    */
    async pull (targetRemote: PijulRemote, from: string | undefined, to: string | undefined): Promise<void> {
    const args = ['pull', targetRemote.url, '-a'];
    if (from !== undefined) {
    args.push('--from-channel', from);
    }
    if (to !== undefined) {
    args.push('--to-channel', to);
    }
    await this.pijul.exec(this.repositoryRoot, args);
    }
    /**
    * Push to a remote of this repository with `pijul push [url] -a`
    */
    async push (targetRemote: PijulRemote, from: string | undefined, to: string | undefined): Promise<void> {
    const args = ['push', targetRemote.url, '-a'];
    if (from !== undefined) {
    args.push('--from-channel', from);
    }
    if (to !== undefined) {
    args.push('--to-channel', to);
    }
    await this.pijul.exec(this.repositoryRoot, args);
  • edit in src/commands.ts at line 366
    [5.900]
    [5.900]
    }
    /**
    * Pull changes
    * @param repository The repository that contains the remote
    * @param targetRemote The remote to be pulled from
    */
    @command('pijul.pull', { repository: true })
    async pull (repository: Repository, targetRemote?: PijulRemote): Promise<void> {
    await repository.pull({ from: false, to: false }, targetRemote);
    }
    /**
    * Pull changes from a channel
    * @param repository The repository that contains the remote
    * @param targetRemote The remote to be pulled from
    */
    @command('pijul.pullFrom', { repository: true })
    async pullFrom (repository: Repository, targetRemote?: PijulRemote): Promise<void> {
    await repository.pull({ from: true, to: false }, targetRemote);
    }
    /**
    * Pull changes to a channel
    * @param repository The repository that contains the remote
    * @param targetRemote The remote to be pulled from
    */
    @command('pijul.pullTo', { repository: true })
    async pullTo (repository: Repository, targetRemote?: PijulRemote): Promise<void> {
    await repository.pull({ from: false, to: true }, targetRemote);
    }
    /**
    * Pull changes from a channel to another channel
    * @param repository The repository that contains the remote
    * @param targetRemote The remote to be pulled from
    */
    @command('pijul.pullFromTo', { repository: true })
    async pullFromTo (repository: Repository, targetRemote?: PijulRemote): Promise<void> {
    await repository.pull({ from: true, to: true }, targetRemote);
    }
    /**
    * Push changes
    * @param repository The repository that contains the remote
    * @param targetRemote The remote to be pushed to
    */
    @command('pijul.push', { repository: true })
    async push (repository: Repository, targetRemote?: PijulRemote): Promise<void> {
    await repository.push({ from: false, to: false }, targetRemote);
    }
    /**
    * Push changes from a channel
    * @param repository The repository that contains the remote
    * @param targetRemote The remote to be pushed to
    */
    @command('pijul.pushFrom', { repository: true })
    async pushFrom (repository: Repository, targetRemote?: PijulRemote): Promise<void> {
    await repository.push({ from: true, to: false }, targetRemote);
    }
    /**
    * Push changes to a channel
    * @param repository The repository that contains the remote
    * @param targetRemote The remote to be pushed to
    */
    @command('pijul.pushTo', { repository: true })
    async pushTo (repository: Repository, targetRemote?: PijulRemote): Promise<void> {
    await repository.push({ from: false, to: true }, targetRemote);
    }
    /**
    * Push changes from a channel to another channel
    * @param repository The repository that contains the remote
    * @param targetRemote The remote to be pushed to
    */
    @command('pijul.pushFromTo', { repository: true })
    async pushFromTo (repository: Repository, targetRemote?: PijulRemote): Promise<void> {
    await repository.push({ from: true, to: true }, targetRemote);
  • edit in package.json at line 163
    [5.1085]
    [5.1393]
    },
    {
    "command": "pijul.pull",
    "title": "Pull",
    "category": "Pijul",
    "icon": "$(repo-pull)"
    },
    {
    "command": "pijul.pullFrom",
    "title": "Pull from ...",
    "category": "Pijul",
    "icon": "$(repo-pull)"
    },
    {
    "command": "pijul.pullTo",
    "title": "Pull to ...",
    "category": "Pijul",
    "icon": "$(repo-pull)"
  • edit in package.json at line 183
    [5.1404]
    [5.1404]
    "command": "pijul.pullFromTo",
    "title": "Pull from ... to ...",
    "category": "Pijul",
    "icon": "$(repo-pull)"
    },
    {
    "command": "pijul.push",
    "title": "Push",
    "category": "Pijul",
    "icon": "$(repo-push)"
    },
    {
    "command": "pijul.pushFrom",
    "title": "Push from ...",
    "category": "Pijul",
    "icon": "$(repo-push)"
    },
    {
    "command": "pijul.pushTo",
    "title": "Push to ...",
    "category": "Pijul",
    "icon": "$(repo-push)"
    },
    {
    "command": "pijul.pushFromTo",
    "title": "Push from ... to ...",
    "category": "Pijul",
    "icon": "$(repo-push)"
    },
    {
  • edit in package.json at line 554
    [5.1356]
    [4.857]
    },
    {
    "command": "pijul.push",
    "when": "view == pijul.views.remotes && viewItem == pijulRemote",
    "group": "changeFirst@1"
    },
    {
    "command": "pijul.pull",
    "when": "view == pijul.views.remotes && viewItem == pijulRemote",
    "group": "changeFirst@2"
    },
    {
    "submenu": "pijul.pushpull",
    "when": "view == pijul.views.remotes && viewItem == pijulRemote",
    "group": "changeFirst@3"
  • edit in package.json at line 572
    [4.908]
    [4.908]
    "name": "Delete",
  • replacement in package.json at line 574
    [4.979][4.979:1007]()
    "group": "changeFirst"
    [4.979]
    [4.1007]
    "group": "changeSecond"
  • replacement in package.json at line 579
    [4.1130][4.1130:1159]()
    "group": "changeSecond"
    [4.1130]
    [4.1159]
    "group": "changeThird"
  • replacement in package.json at line 584
    [4.1281][4.1281:1310]()
    "group": "changeSecond"
    [4.1281]
    [5.1521]
    "group": "changeThird"
  • edit in package.json at line 591
    [15.1942]
    [16.1311]
    ],
    "pijul.pushpull": [
    {
    "command": "pijul.push",
    "when": "view == pijul.views.remotes && viewItem == pijulRemote",
    "group": "changeFirst@1"
    },
    {
    "command": "pijul.pushFrom",
    "when": "view == pijul.views.remotes && viewItem == pijulRemote",
    "group": "changeFirst@2"
    },
    {
    "command": "pijul.pushTo",
    "when": "view == pijul.views.remotes && viewItem == pijulRemote",
    "group": "changeFirst@3"
    },
    {
    "command": "pijul.pushFromTo",
    "when": "view == pijul.views.remotes && viewItem == pijulRemote",
    "group": "changeFirst@4"
    },
    {
    "command": "pijul.pull",
    "when": "view == pijul.views.remotes && viewItem == pijulRemote",
    "group": "changeFirst@5"
    },
    {
    "command": "pijul.pullFrom",
    "when": "view == pijul.views.remotes && viewItem == pijulRemote",
    "group": "changeFirst@6"
    },
    {
    "command": "pijul.pullTo",
    "when": "view == pijul.views.remotes && viewItem == pijulRemote",
    "group": "changeFirst@7"
    },
    {
    "command": "pijul.pullFromTo",
    "when": "view == pijul.views.remotes && viewItem == pijulRemote",
    "group": "changeFirst@8"
    }
  • edit in package.json at line 635
    [17.2698]
    [17.2698]
    "submenus": [
    {
    "id": "pijul.pushpull",
    "label": "Push/Pull"
    }
    ],