diff --git a/src/commands/patches.ts b/src/commands/patches.ts index e34cddb..bf0fe73 100644 --- a/src/commands/patches.ts +++ b/src/commands/patches.ts @@ -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() diff --git a/src/plus/webviews/patchDetails/protocol.ts b/src/plus/webviews/patchDetails/protocol.ts index 8af1395..32aeb7c 100644 --- a/src/plus/webviews/patchDetails/protocol.ts +++ b/src/plus/webviews/patchDetails/protocol.ts @@ -49,15 +49,6 @@ interface LocalDraftDetails { description?: string; patches?: PatchDetails[]; - - // files?: GitFileChangeShape[]; - // stats?: GitCommitStats; - - // repoPath?: string; - // repoName?: string; - - // baseRef?: string; - // commit?: string; } interface CloudDraftDetails { @@ -77,33 +68,10 @@ interface CloudDraftDetails { description?: string; patches?: PatchDetails[]; - - // commit?: string; - - // files?: GitFileChangeShape[]; - // stats?: GitCommitStats; - - // repoPath: string; - // repoName?: string; - // baseRef?: string; } export type DraftDetails = LocalDraftDetails | CloudDraftDetails; -// export interface RangeRef { -// baseSha: string; -// sha: string | undefined; -// branchName: string; -// // shortSha: string; -// // summary: string; -// // message: string; -// // author: GitCommitIdentityShape & { avatar: string | undefined }; -// // committer: GitCommitIdentityShape & { avatar: string | undefined }; -// // parents: string[]; -// // repoPath: string; -// // stashNumber?: string; -// } - export interface Preferences { avatars: boolean; dateFormat: DateTimeFormat | string; @@ -139,30 +107,6 @@ export interface RevisionChange { export type Change = WipChange | RevisionChange; -// export interface RepoCommitChange { -// type: 'commit'; - -// repoName: string; -// repoUri: string; -// change: Change; - -// checked: boolean; -// expanded: boolean; -// } - -// export interface RepoWipChange { -// type: 'wip'; - -// repoName: string; -// repoUri: string; -// change: Change | undefined; - -// checked: boolean | 'staged'; -// expanded: boolean; -// } - -// export type RepoChangeSet = RepoCommitChange | RepoWipChange; - export interface State { webviewId: WebviewIds | WebviewViewIds; timestamp: number;