|
|
@ -118,92 +118,7 @@ export class CreateCloudPatchCommand extends Command { |
|
|
|
return showPatchesView({ mode: 'create', create: { repositories: [repo] } }); |
|
|
|
} |
|
|
|
return showPatchesView({ mode: 'create', create: create }); |
|
|
|
|
|
|
|
// let changes: Change[] | undefined;
|
|
|
|
// if (args?.repoPath != null) {
|
|
|
|
// const repo = this.container.git.getRepository(args.repoPath);
|
|
|
|
// if (repo == null) return;
|
|
|
|
|
|
|
|
// const diff = await this.container.git.getDiff(repo.uri, args.ref1 ?? 'HEAD', args.ref2);
|
|
|
|
// if (diff == null) return;
|
|
|
|
|
|
|
|
// const result = await this.container.git.getDiffFiles(args.repoPath, diff.contents);
|
|
|
|
// if (result?.files == null) return;
|
|
|
|
|
|
|
|
// const branch = await repo.getBranch();
|
|
|
|
|
|
|
|
// changes = [
|
|
|
|
// {
|
|
|
|
// type: 'commit',
|
|
|
|
// repository: {
|
|
|
|
// name: repo.name,
|
|
|
|
// path: repo.path,
|
|
|
|
// uri: repo.uri.toString(true),
|
|
|
|
// },
|
|
|
|
// files: result.files,
|
|
|
|
// range: {
|
|
|
|
// baseSha: args.ref2 ?? `${args.ref1 ?? 'HEAD'}^`,
|
|
|
|
// branchName: branch?.name ?? 'HEAD',
|
|
|
|
// sha: args.ref1 ?? 'HEAD',
|
|
|
|
// },
|
|
|
|
// },
|
|
|
|
// ];
|
|
|
|
// }
|
|
|
|
|
|
|
|
// let repo;
|
|
|
|
// if (args?.repoPath == null) {
|
|
|
|
// repo = await getRepositoryOrShowPicker('Create Cloud Patch');
|
|
|
|
// } else {
|
|
|
|
// repo = this.container.git.getRepository(args.repoPath);
|
|
|
|
// }
|
|
|
|
// if (repo == null) return;
|
|
|
|
|
|
|
|
// const diff = await this.container.git.getDiff(repo.uri, args?.ref1 ?? 'HEAD', args?.ref2);
|
|
|
|
// if (diff == null) return;
|
|
|
|
|
|
|
|
// const d = await workspace.openTextDocument({ content: diff.contents, language: 'diff' });
|
|
|
|
// await window.showTextDocument(d);
|
|
|
|
|
|
|
|
// // ask the user for a title
|
|
|
|
|
|
|
|
// const title = await window.showInputBox({
|
|
|
|
// title: 'Create Cloud Patch',
|
|
|
|
// prompt: 'Enter a title for the patch',
|
|
|
|
// validateInput: value => (value == null || value.length === 0 ? 'A title is required' : undefined),
|
|
|
|
// });
|
|
|
|
// if (title == null) return;
|
|
|
|
|
|
|
|
// // ask the user for an optional description
|
|
|
|
// const description = await window.showInputBox({
|
|
|
|
// title: 'Create Cloud Patch',
|
|
|
|
// prompt: 'Enter an optional description for the patch',
|
|
|
|
// });
|
|
|
|
|
|
|
|
// const patch = await this.container.drafts.createDraft(
|
|
|
|
// 'patch',
|
|
|
|
// title,
|
|
|
|
// {
|
|
|
|
// contents: diff.contents,
|
|
|
|
// baseSha: diff.baseSha,
|
|
|
|
// repository: repo,
|
|
|
|
// },
|
|
|
|
// { description: description },
|
|
|
|
// );
|
|
|
|
// void this.showPatchNotification(patch);
|
|
|
|
} |
|
|
|
|
|
|
|
// private async showPatchNotification(patch: Draft | undefined) {
|
|
|
|
// if (patch == null) return;
|
|
|
|
|
|
|
|
// await env.clipboard.writeText(patch.deepLinkUrl);
|
|
|
|
|
|
|
|
// const copy = { title: 'Copy Link' };
|
|
|
|
// const result = await window.showInformationMessage(`Created cloud patch ${patch.id}`, copy);
|
|
|
|
|
|
|
|
// if (result === copy) {
|
|
|
|
// await env.clipboard.writeText(patch.deepLinkUrl);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
} |
|
|
|
|
|
|
|
@command() |
|
|
|