|
|
@ -2,11 +2,45 @@ |
|
|
|
import { Arrays, Iterables } from '../system'; |
|
|
|
import { QuickPickItem, QuickPickOptions, Uri, window } from 'vscode'; |
|
|
|
import { Commands, Keyboard, KeyNoopCommand } from '../commands'; |
|
|
|
import { GitLogCommit, GitService, IGitLog } from '../gitService'; |
|
|
|
import { CommandQuickPickItem, CommitWithFileStatusQuickPickItem, getQuickPickIgnoreFocusOut, KeyCommandQuickPickItem, OpenFilesCommandQuickPickItem, OpenRemotesCommandQuickPickItem } from '../quickPicks'; |
|
|
|
import { CommandQuickPickItem, getQuickPickIgnoreFocusOut, KeyCommandQuickPickItem, OpenFileCommandQuickPickItem, OpenFilesCommandQuickPickItem } from './common'; |
|
|
|
import { getGitStatusIcon, Git, GitCommit, GitLogCommit, GitService, GitStatusFileStatus, GitUri, IGitLog, IGitStatusFile } from '../gitService'; |
|
|
|
import { OpenRemotesCommandQuickPickItem } from './remotes'; |
|
|
|
import * as moment from 'moment'; |
|
|
|
import * as path from 'path'; |
|
|
|
|
|
|
|
export class CommitWithFileStatusQuickPickItem extends OpenFileCommandQuickPickItem { |
|
|
|
|
|
|
|
fileName: string; |
|
|
|
gitUri: GitUri; |
|
|
|
sha: string; |
|
|
|
shortSha: string; |
|
|
|
status: GitStatusFileStatus; |
|
|
|
|
|
|
|
constructor(commit: GitCommit, status: IGitStatusFile) { |
|
|
|
const icon = getGitStatusIcon(status.status); |
|
|
|
|
|
|
|
let directory = Git.normalizePath(path.dirname(status.fileName)); |
|
|
|
if (!directory || directory === '.') { |
|
|
|
directory = undefined; |
|
|
|
} |
|
|
|
|
|
|
|
let description = (status.status === 'R' && status.originalFileName) |
|
|
|
? `${directory || ''} \u00a0\u2190\u00a0 ${status.originalFileName}` |
|
|
|
: directory; |
|
|
|
|
|
|
|
super(GitService.toGitContentUri(commit.sha, status.fileName, commit.repoPath, commit.originalFileName), { |
|
|
|
label: `\u00a0\u00a0\u00a0\u00a0${icon}\u00a0\u00a0 ${path.basename(status.fileName)}`, |
|
|
|
description: description |
|
|
|
}); |
|
|
|
|
|
|
|
this.fileName = status.fileName; |
|
|
|
this.gitUri = new GitUri(Uri.file(path.resolve(commit.repoPath, status.fileName))); |
|
|
|
this.sha = commit.sha; |
|
|
|
this.shortSha = commit.shortSha; |
|
|
|
this.status = status.status; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
export class OpenCommitFilesCommandQuickPickItem extends OpenFilesCommandQuickPickItem { |
|
|
|
|
|
|
|
constructor(commit: GitLogCommit, item?: QuickPickItem) { |
|
|
|