mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-01-14 17:25:28 -05:00
Renames commands/commands to commands/common
Renames quickpicks/quickpicks to quickpicks/common Moves git quick picks into common and other quick pick files
This commit is contained in:
@@ -1,10 +1,8 @@
|
||||
'use strict';
|
||||
import { commands } from 'vscode';
|
||||
import { BuiltInCommands } from './constants';
|
||||
export * from './commands/common';
|
||||
|
||||
export * from './commands/keyboard';
|
||||
|
||||
export * from './commands/commands';
|
||||
export * from './commands/closeUnchangedFiles';
|
||||
export * from './commands/copyMessageToClipboard';
|
||||
export * from './commands/copyShaToClipboard';
|
||||
@@ -30,18 +28,4 @@ export * from './commands/showQuickBranchHistory';
|
||||
export * from './commands/showQuickCurrentBranchHistory';
|
||||
export * from './commands/showQuickRepoStatus';
|
||||
export * from './commands/toggleBlame';
|
||||
export * from './commands/toggleCodeLens';
|
||||
|
||||
export type CommandContext = 'gitlens:canToggleCodeLens' | 'gitlens:enabled' | 'gitlens:isBlameable' | 'gitlens:key';
|
||||
export const CommandContext = {
|
||||
CanToggleCodeLens: 'gitlens:canToggleCodeLens' as CommandContext,
|
||||
Enabled: 'gitlens:enabled' as CommandContext,
|
||||
HasRemotes: 'gitlens:hasRemotes' as CommandContext,
|
||||
IsBlameable: 'gitlens:isBlameable' as CommandContext,
|
||||
Key: 'gitlens:key' as CommandContext
|
||||
};
|
||||
|
||||
|
||||
export function setCommandContext(key: CommandContext | string, value: any) {
|
||||
return commands.executeCommand(BuiltInCommands.SetContext, key, value);
|
||||
}
|
||||
export * from './commands/toggleCodeLens';
|
||||
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
import { TextEditor, Uri, window } from 'vscode';
|
||||
import { ActiveEditorTracker } from '../activeEditorTracker';
|
||||
import { ActiveEditorCommand, Commands } from './commands';
|
||||
import { ActiveEditorCommand, Commands } from './common';
|
||||
import { TextEditorComparer, UriComparer } from '../comparers';
|
||||
import { GitService } from '../gitService';
|
||||
import { Logger } from '../logger';
|
||||
|
||||
@@ -41,6 +41,20 @@ export const Commands = {
|
||||
ToggleCodeLens: 'gitlens.toggleCodeLens' as Commands
|
||||
};
|
||||
|
||||
export type CommandContext = 'gitlens:canToggleCodeLens' | 'gitlens:enabled' | 'gitlens:isBlameable' | 'gitlens:key';
|
||||
export const CommandContext = {
|
||||
CanToggleCodeLens: 'gitlens:canToggleCodeLens' as CommandContext,
|
||||
Enabled: 'gitlens:enabled' as CommandContext,
|
||||
HasRemotes: 'gitlens:hasRemotes' as CommandContext,
|
||||
IsBlameable: 'gitlens:isBlameable' as CommandContext,
|
||||
Key: 'gitlens:key' as CommandContext
|
||||
};
|
||||
|
||||
|
||||
export function setCommandContext(key: CommandContext | string, value: any) {
|
||||
return commands.executeCommand(BuiltInCommands.SetContext, key, value);
|
||||
}
|
||||
|
||||
export abstract class Command extends Disposable {
|
||||
|
||||
private _disposable: Disposable;
|
||||
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
import { Iterables } from '../system';
|
||||
import { TextEditor, Uri, window } from 'vscode';
|
||||
import { ActiveEditorCommand, Commands } from './commands';
|
||||
import { ActiveEditorCommand, Commands } from './common';
|
||||
import { GitService, GitUri } from '../gitService';
|
||||
import { Logger } from '../logger';
|
||||
import { copy } from 'copy-paste';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
import { Iterables } from '../system';
|
||||
import { TextEditor, Uri, window } from 'vscode';
|
||||
import { ActiveEditorCommand, Commands } from './commands';
|
||||
import { ActiveEditorCommand, Commands } from './common';
|
||||
import { GitService, GitUri } from '../gitService';
|
||||
import { Logger } from '../logger';
|
||||
import { copy } from 'copy-paste';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
import { Iterables } from '../system';
|
||||
import { TextEditor, Uri, window } from 'vscode';
|
||||
import { ActiveEditorCommand, Commands } from './commands';
|
||||
import { ActiveEditorCommand, Commands } from './common';
|
||||
import { GitService } from '../gitService';
|
||||
import { Logger } from '../logger';
|
||||
import { CommandQuickPickItem, BranchesQuickPick } from '../quickPicks';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
import { commands, TextEditor, Uri, window } from 'vscode';
|
||||
import { ActiveEditorCommand, Commands } from './commands';
|
||||
import { ActiveEditorCommand, Commands } from './common';
|
||||
import { BuiltInCommands } from '../constants';
|
||||
import { GitCommit, GitService, GitUri } from '../gitService';
|
||||
import { Logger } from '../logger';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
import { commands, TextEditor, Uri, window } from 'vscode';
|
||||
import { ActiveEditorCommand, Commands } from './commands';
|
||||
import { ActiveEditorCommand, Commands } from './common';
|
||||
import { GitCommit, GitService, GitUri } from '../gitService';
|
||||
import { Logger } from '../logger';
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
import { commands, TextEditor, Uri, window } from 'vscode';
|
||||
import { ActiveEditorCommand, Commands } from './commands';
|
||||
import { ActiveEditorCommand, Commands } from './common';
|
||||
import { BuiltInCommands } from '../constants';
|
||||
import { GitService, GitUri } from '../gitService';
|
||||
import { Logger } from '../logger';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
import { Iterables } from '../system';
|
||||
import { commands, Range, TextEditor, Uri, window } from 'vscode';
|
||||
import { ActiveEditorCommand, Commands } from './commands';
|
||||
import { ActiveEditorCommand, Commands } from './common';
|
||||
import { BuiltInCommands } from '../constants';
|
||||
import { GitLogCommit, GitService, GitUri } from '../gitService';
|
||||
import { Logger } from '../logger';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
import { Iterables } from '../system';
|
||||
import { commands, Range, TextEditor, Uri, window } from 'vscode';
|
||||
import { ActiveEditorCommand, Commands } from './commands';
|
||||
import { ActiveEditorCommand, Commands } from './common';
|
||||
import { BuiltInCommands } from '../constants';
|
||||
import { GitCommit, GitService, GitUri } from '../gitService';
|
||||
import { Logger } from '../logger';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
// import { Iterables } from '../system';
|
||||
import { commands, TextEditor, Uri, window } from 'vscode';
|
||||
import { ActiveEditorCommand, Commands } from './commands';
|
||||
import { ActiveEditorCommand, Commands } from './common';
|
||||
import { BuiltInCommands } from '../constants';
|
||||
import { GitCommit, GitService, GitUri } from '../gitService';
|
||||
import { Logger } from '../logger';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
import { commands, Disposable, QuickPickItem } from 'vscode';
|
||||
import { CommandContext, setCommandContext } from '../commands';
|
||||
import { CommandQuickPickItem, OpenFileCommandQuickPickItem } from '../quickPicks/quickPicks';
|
||||
import { CommandContext, setCommandContext } from './common';
|
||||
import { CommandQuickPickItem, OpenFileCommandQuickPickItem } from '../quickPicks';
|
||||
import { Logger } from '../logger';
|
||||
|
||||
const keyNoopCommand = Object.create(null) as QuickPickItem;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
import { TextEditor, Uri, window } from 'vscode';
|
||||
import { ActiveEditorCommand, Commands, openEditor } from './commands';
|
||||
import { ActiveEditorCommand, Commands, openEditor } from './common';
|
||||
import { GitService } from '../gitService';
|
||||
import { Logger } from '../logger';
|
||||
import * as path from 'path';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
import { Arrays } from '../system';
|
||||
import { commands, TextEditor, TextEditorEdit, Uri, window } from 'vscode';
|
||||
import { ActiveEditorCommand, Commands } from './commands';
|
||||
import { ActiveEditorCommand, Commands } from './common';
|
||||
import { GitCommit, GitService, GitUri } from '../gitService';
|
||||
import { Logger } from '../logger';
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
import { Arrays } from '../system';
|
||||
import { commands, Range, TextEditor, TextEditorEdit, Uri, window } from 'vscode';
|
||||
import { ActiveEditorCommand, Commands } from './commands';
|
||||
import { ActiveEditorCommand, Commands } from './common';
|
||||
import { GitService, GitUri } from '../gitService';
|
||||
import { Logger } from '../logger';
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
import { TextEditor, Uri, window } from 'vscode';
|
||||
import { ActiveEditorCommand, Commands } from './commands';
|
||||
import { ActiveEditorCommand, Commands } from './common';
|
||||
import { GitRemote, RemoteOpenType } from '../gitService';
|
||||
import { Logger } from '../logger';
|
||||
import { CommandQuickPickItem, OpenRemoteCommandQuickPickItem, RemotesQuickPick } from '../quickPicks';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
import { TextEditor, TextEditorEdit, Uri, window } from 'vscode';
|
||||
import { BlameAnnotationController } from '../blameAnnotationController';
|
||||
import { Commands, EditorCommand } from './commands';
|
||||
import { Commands, EditorCommand } from './common';
|
||||
import { Logger } from '../logger';
|
||||
|
||||
export class ShowBlameCommand extends EditorCommand {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
import { commands, Position, Range, TextEditor, TextEditorEdit, Uri, window } from 'vscode';
|
||||
import { Commands, EditorCommand } from './commands';
|
||||
import { Commands, EditorCommand } from './common';
|
||||
import { BuiltInCommands } from '../constants';
|
||||
import { GitService, GitUri } from '../gitService';
|
||||
import { Logger } from '../logger';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
import { commands, Position, Range, TextEditor, TextEditorEdit, Uri, window } from 'vscode';
|
||||
import { Commands, EditorCommand } from './commands';
|
||||
import { Commands, EditorCommand } from './common';
|
||||
import { BuiltInCommands } from '../constants';
|
||||
import { GitService, GitUri } from '../gitService';
|
||||
import { Logger } from '../logger';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
import { commands, window } from 'vscode';
|
||||
import { Command, Commands, getLastCommand } from './commands';
|
||||
import { Command, Commands, getLastCommand } from './common';
|
||||
import { Logger } from '../logger';
|
||||
|
||||
export class ShowLastQuickPickCommand extends Command {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
import { commands, TextEditor, Uri, window } from 'vscode';
|
||||
import { ActiveEditorCachedCommand, Commands } from '../commands';
|
||||
import { ActiveEditorCachedCommand, Commands } from './common';
|
||||
import { GitService, GitUri, IGitLog } from '../gitService';
|
||||
import { Logger } from '../logger';
|
||||
import { BranchesQuickPick, BranchHistoryQuickPick, CommandQuickPickItem } from '../quickPicks';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
import { commands, TextEditor, Uri, window } from 'vscode';
|
||||
import { ActiveEditorCachedCommand, Commands } from './commands';
|
||||
import { ActiveEditorCachedCommand, Commands } from './common';
|
||||
import { GitCommit, GitLogCommit, GitService, GitUri, IGitLog } from '../gitService';
|
||||
import { Logger } from '../logger';
|
||||
import { CommandQuickPickItem, CommitDetailsQuickPick, CommitWithFileStatusQuickPickItem } from '../quickPicks';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
import { TextEditor, Uri, window } from 'vscode';
|
||||
import { ActiveEditorCachedCommand, Commands } from './commands';
|
||||
import { ActiveEditorCachedCommand, Commands } from './common';
|
||||
import { GitCommit, GitLogCommit, GitService, GitUri, IGitLog } from '../gitService';
|
||||
import { Logger } from '../logger';
|
||||
import { CommandQuickPickItem, CommitFileDetailsQuickPick } from '../quickPicks';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
import { commands, TextEditor, Uri, window } from 'vscode';
|
||||
import { ActiveEditorCachedCommand, Commands } from '../commands';
|
||||
import { ActiveEditorCachedCommand, Commands } from './common';
|
||||
import { GitService } from '../gitService';
|
||||
import { Logger } from '../logger';
|
||||
import { CommandQuickPickItem } from '../quickPicks';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
import { commands, Range, TextEditor, Uri, window } from 'vscode';
|
||||
import { ActiveEditorCachedCommand, Commands } from '../commands';
|
||||
import { ActiveEditorCachedCommand, Commands } from './common';
|
||||
import { GitService, GitUri, IGitLog } from '../gitService';
|
||||
import { Logger } from '../logger';
|
||||
import { CommandQuickPickItem, FileHistoryQuickPick } from '../quickPicks';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
import { TextEditor, Uri, window } from 'vscode';
|
||||
import { ActiveEditorCachedCommand, Commands } from './commands';
|
||||
import { ActiveEditorCachedCommand, Commands } from './common';
|
||||
import { GitService } from '../gitService';
|
||||
import { Logger } from '../logger';
|
||||
import { CommandQuickPickItem, RepoStatusQuickPick } from '../quickPicks';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
import { TextEditor, TextEditorEdit, Uri, window } from 'vscode';
|
||||
import { BlameAnnotationController } from '../blameAnnotationController';
|
||||
import { Commands, EditorCommand } from './commands';
|
||||
import { Commands, EditorCommand } from './common';
|
||||
import { Logger } from '../logger';
|
||||
|
||||
export class ToggleBlameCommand extends EditorCommand {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
import { TextEditor, TextEditorEdit } from 'vscode';
|
||||
import { Commands, EditorCommand } from './commands';
|
||||
import { Commands, EditorCommand } from './common';
|
||||
import { GitService } from '../gitService';
|
||||
|
||||
export class ToggleCodeLensCommand extends EditorCommand {
|
||||
|
||||
@@ -4,6 +4,16 @@ import { BuiltInCommands } from '../../constants';
|
||||
|
||||
export type RemoteOpenType = 'branch' | 'commit' | 'file' | 'working-file';
|
||||
|
||||
export function getNameFromRemoteOpenType(type: RemoteOpenType) {
|
||||
switch (type) {
|
||||
case 'branch': return 'Branch';
|
||||
case 'commit': return 'Commit';
|
||||
case 'file': return 'File';
|
||||
case 'working-file': return 'Working File';
|
||||
default: return '';
|
||||
}
|
||||
}
|
||||
|
||||
export abstract class RemoteProvider {
|
||||
|
||||
constructor(public domain: string, public path: string) { }
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
export * from './quickPicks/common';
|
||||
|
||||
export * from './quickPicks/branches';
|
||||
export * from './quickPicks/quickPicks';
|
||||
export * from './quickPicks/gitQuickPicks';
|
||||
export * from './quickPicks/commitDetails';
|
||||
export * from './quickPicks/commitFileDetails';
|
||||
export * from './quickPicks/branchHistory';
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
import { Arrays, Iterables } from '../system';
|
||||
import { CancellationTokenSource, QuickPickOptions, Uri, window } from 'vscode';
|
||||
import { Commands, Keyboard, KeyNoopCommand } from '../commands';
|
||||
import { CommandQuickPickItem, CommitQuickPickItem, getQuickPickIgnoreFocusOut, showQuickPickProgress } from './common';
|
||||
import { GitService, GitUri, IGitLog } from '../gitService';
|
||||
import { CommandQuickPickItem, CommitQuickPickItem, getQuickPickIgnoreFocusOut, OpenRemotesCommandQuickPickItem, showQuickPickProgress } from '../quickPicks';
|
||||
import { OpenRemotesCommandQuickPickItem } from './remotes';
|
||||
|
||||
export class BranchHistoryQuickPick {
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
import { QuickPickItem, QuickPickOptions, window } from 'vscode';
|
||||
import { GitBranch } from '../gitService';
|
||||
import { CommandQuickPickItem, getQuickPickIgnoreFocusOut } from './quickPicks';
|
||||
import { CommandQuickPickItem, getQuickPickIgnoreFocusOut } from './common';
|
||||
|
||||
export class BranchQuickPickItem implements QuickPickItem {
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
import { Arrays, Iterables } from '../system';
|
||||
import { QuickPickItem, QuickPickOptions, Uri, window } from 'vscode';
|
||||
import { Commands, Keyboard, KeyNoopCommand } from '../commands';
|
||||
import { CommandQuickPickItem, getQuickPickIgnoreFocusOut, KeyCommandQuickPickItem, OpenFileCommandQuickPickItem } from './common';
|
||||
import { GitCommit, GitLogCommit, GitService, GitUri, IGitLog } from '../gitService';
|
||||
import { CommandQuickPickItem, getQuickPickIgnoreFocusOut, KeyCommandQuickPickItem, OpenFileCommandQuickPickItem, OpenRemotesCommandQuickPickItem } from '../quickPicks';
|
||||
import { OpenRemotesCommandQuickPickItem } from './remotes';
|
||||
import * as moment from 'moment';
|
||||
import * as path from 'path';
|
||||
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
import { CancellationTokenSource, commands, Disposable, QuickPickItem, QuickPickOptions, TextEditor, Uri, window, workspace } from 'vscode';
|
||||
import { Commands, Keyboard, KeyboardScope, KeyMapping, openEditor } from '../commands';
|
||||
import { IAdvancedConfig } from '../configuration';
|
||||
import { GitCommit } from '../gitService';
|
||||
// import { Logger } from '../logger';
|
||||
import * as moment from 'moment';
|
||||
|
||||
export function getQuickPickIgnoreFocusOut() {
|
||||
return !workspace.getConfiguration('gitlens').get<IAdvancedConfig>('advanced').quickPick.closeOnFocusOut;
|
||||
@@ -106,4 +108,17 @@ export class OpenFilesCommandQuickPickItem extends CommandQuickPickItem {
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
export class CommitQuickPickItem implements QuickPickItem {
|
||||
|
||||
label: string;
|
||||
description: string;
|
||||
detail: string;
|
||||
|
||||
constructor(public commit: GitCommit, descriptionSuffix: string = '') {
|
||||
this.label = `${commit.author}, ${moment(commit.date).fromNow()}`;
|
||||
this.description = `\u00a0 \u2014 \u00a0\u00a0 $(git-commit) ${commit.shortSha}${descriptionSuffix}`;
|
||||
this.detail = commit.message;
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,9 @@
|
||||
import { Arrays, Iterables } from '../system';
|
||||
import { CancellationTokenSource, QuickPickOptions, Uri, window } from 'vscode';
|
||||
import { Commands, Keyboard, KeyNoopCommand } from '../commands';
|
||||
import { CommandQuickPickItem, CommitQuickPickItem, getQuickPickIgnoreFocusOut, showQuickPickProgress } from './common';
|
||||
import { GitService, GitUri, IGitLog } from '../gitService';
|
||||
import { CommandQuickPickItem, CommitQuickPickItem, getQuickPickIgnoreFocusOut, OpenRemotesCommandQuickPickItem, showQuickPickProgress } from '../quickPicks';
|
||||
import { OpenRemotesCommandQuickPickItem } from './remotes';
|
||||
import * as path from 'path';
|
||||
|
||||
export class FileHistoryQuickPick {
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
'use strict';
|
||||
import { QuickPickItem, Uri } from 'vscode';
|
||||
import { getGitStatusIcon, Git, GitCommit, GitStatusFileStatus, GitService, GitUri, IGitStatusFile } from '../gitService';
|
||||
import { OpenFileCommandQuickPickItem } from './quickPicks';
|
||||
import * as moment from 'moment';
|
||||
import * as path from 'path';
|
||||
|
||||
export class CommitQuickPickItem implements QuickPickItem {
|
||||
|
||||
label: string;
|
||||
description: string;
|
||||
detail: string;
|
||||
|
||||
constructor(public commit: GitCommit, descriptionSuffix: string = '') {
|
||||
this.label = `${commit.author}, ${moment(commit.date).fromNow()}`;
|
||||
this.description = `\u00a0 \u2014 \u00a0\u00a0 $(git-commit) ${commit.shortSha}${descriptionSuffix}`;
|
||||
this.detail = commit.message;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -1,20 +1,10 @@
|
||||
'use strict';
|
||||
import { QuickPickOptions, window } from 'vscode';
|
||||
import { Commands } from '../commands';
|
||||
import { GitRemote, RemoteOpenType } from '../gitService';
|
||||
import { CommandQuickPickItem, getQuickPickIgnoreFocusOut } from './quickPicks';
|
||||
import { CommandQuickPickItem, getQuickPickIgnoreFocusOut } from './common';
|
||||
import { getNameFromRemoteOpenType, GitRemote, RemoteOpenType } from '../gitService';
|
||||
import * as path from 'path';
|
||||
|
||||
function getNameFromRemoteOpenType(type: RemoteOpenType) {
|
||||
switch (type) {
|
||||
case 'branch': return 'Branch';
|
||||
case 'commit': return 'Commit';
|
||||
case 'file': return 'File';
|
||||
case 'working-file': return 'Working File';
|
||||
default: return '';
|
||||
}
|
||||
}
|
||||
|
||||
export class OpenRemoteCommandQuickPickItem extends CommandQuickPickItem {
|
||||
|
||||
private remote: GitRemote;
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
import { Iterables } from '../system';
|
||||
import { QuickPickItem, QuickPickOptions, Uri, window } from 'vscode';
|
||||
import { Commands, Keyboard } from '../commands';
|
||||
import { CommandQuickPickItem, getQuickPickIgnoreFocusOut, OpenFileCommandQuickPickItem } from './common';
|
||||
import { Git, GitStatusFile, GitUri, IGitStatus } from '../gitService';
|
||||
import { CommandQuickPickItem, getQuickPickIgnoreFocusOut, OpenFileCommandQuickPickItem } from '../quickPicks';
|
||||
import * as path from 'path';
|
||||
|
||||
export class OpenStatusFileCommandQuickPickItem extends OpenFileCommandQuickPickItem {
|
||||
|
||||
Reference in New Issue
Block a user