OKOH6H2FW3PK6Q2Y5CO7TRCRH2JZS6EIBKLIZO5OZAS3MFHJKRLQC
MGRAFWDZTJ6ODMSPYNX4YLJ5JLQGN535AVTX3F6GFS54IHMEZ2EQC
YTQW3VKICOJYQECTCMDBNBW2VFI62DZN6HMMZYYIYQOTOQ4FB4LQC
YPGOGP7ZW7BROOBBWPH7IY3LFQACDVJN5LPSUPLTWVAX6LE6IPAAC
GPTHUH3N7W2DMGEYDBKIAQFJS3CLNQEV667FQCRIH4ZNHFRODRLQC
H3GAPFUC4TCMSLC3O4LUNQNHRANRNVIOQJRTZT4XQ3AUXFHTW4CAC
B4SKYP3Y5R7UPPGLLZV7OK3SIN4TRAJ3IL6FS3T7ZFZF5HTEQARQC
HVVRC2GNC3D5PULNDL5XSPOQVJS2QWVU7GDGYSWLNYTK73UPYMHQC
XVYOJLZ4GYPFZFVBTTR7U3HXG5KBDBD5VQAW64GA6V32O2VP2H4AC
L44OILGKTGXSLQ3A4UQH44AMJXAVZSFISAB6ICHCDB6D42NKUWBQC
ZGMIJNFVDK7R6AF56FNCA23W5KV3HVBUBPTWMLQADCEPB3MOPELQC
ILH3GIVTVMKSU5TH5ZZSPB3URX622JA2BNBOO6K7ZTF4ISYDTJLAC
NCBEWRYEEJMJO37SHY7XCNFZYWLT5HUHCKN47UGSEY3FFWFX6QFQC
GNQD74OZ56J2R23GVUGFP3G5KVML2KDZ4OUZK6SVLSM7HVO2WOCAC
5ISTB4TW2BH52Y7U4XSVQ5PBHWIHIN2Q26V5M25HLWWHKJIPCNOQC
L3VOQYAF3HCAFWJ7QFULL54WUZ35B4K3MWU5YDRW7R4VTXSDWJUQC
}
/**
* 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 });
}
}
/**
* 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);
* 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);
}
}
/**
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;
targetRemote = await this.chooseRemote();
if (targetRemote) {
await this.repository.deleteRemote(targetRemote);
}
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);
}
/**
* 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);
}
/**
* 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);
},
{
"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)"
"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)"
},
{
},
{
"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"
],
"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"
}