Switches to use repoPath on GitService

This commit is contained in:
Eric Amodio
2017-03-28 16:42:35 -04:00
parent 8b0748608d
commit 19fe22f061
13 changed files with 34 additions and 40 deletions

View File

@@ -9,7 +9,7 @@ import * as path from 'path';
export class CloseUnchangedFilesCommand extends ActiveEditorCommand {
constructor(private git: GitService, private repoPath: string) {
constructor(private git: GitService) {
super(Commands.CloseUnchangedFiles);
}
@@ -20,7 +20,7 @@ export class CloseUnchangedFilesCommand extends ActiveEditorCommand {
try {
if (!uris) {
const repoPath = await this.git.getRepoPathFromUri(uri, this.repoPath);
const repoPath = await this.git.getRepoPathFromUri(uri, this.git.repoPath);
if (!repoPath) return window.showWarningMessage(`Unable to close unchanged files`);
const status = await this.git.getStatusForRepo(repoPath);

View File

@@ -8,7 +8,7 @@ import { copy } from 'copy-paste';
export class CopyMessageToClipboardCommand extends ActiveEditorCommand {
constructor(private git: GitService, private repoPath: string) {
constructor(private git: GitService) {
super(Commands.CopyMessageToClipboard);
}
@@ -20,7 +20,7 @@ export class CopyMessageToClipboardCommand extends ActiveEditorCommand {
try {
// If we don't have an editor then get the message of the last commit to the branch
if (!uri) {
const log = await this.git.getLogForRepo(this.repoPath, undefined, 1);
const log = await this.git.getLogForRepo(this.git.repoPath, undefined, 1);
if (!log) return undefined;
message = Iterables.first(log.commits.values()).message;

View File

@@ -8,7 +8,7 @@ import { copy } from 'copy-paste';
export class CopyShaToClipboardCommand extends ActiveEditorCommand {
constructor(private git: GitService, private repoPath: string) {
constructor(private git: GitService) {
super(Commands.CopyShaToClipboard);
}
@@ -20,7 +20,7 @@ export class CopyShaToClipboardCommand extends ActiveEditorCommand {
try {
// If we don't have an editor then get the sha of the last commit to the branch
if (!uri) {
const log = await this.git.getLogForRepo(this.repoPath, undefined, 1);
const log = await this.git.getLogForRepo(this.git.repoPath, undefined, 1);
if (!log) return undefined;
sha = Iterables.first(log.commits.values()).sha;

View File

@@ -8,7 +8,7 @@ import { CommandQuickPickItem, BranchesQuickPick } from '../quickPicks';
export class DiffDirectoryCommand extends ActiveEditorCommand {
constructor(private git: GitService, private repoPath: string) {
constructor(private git: GitService) {
super(Commands.DiffDirectory);
}
@@ -18,7 +18,7 @@ export class DiffDirectoryCommand extends ActiveEditorCommand {
}
try {
const repoPath = await this.git.getRepoPathFromUri(uri, this.repoPath);
const repoPath = await this.git.getRepoPathFromUri(uri, this.git.repoPath);
if (!repoPath) return window.showWarningMessage(`Unable to open directory diff`);
if (!shaOrBranch1) {

View File

@@ -7,7 +7,7 @@ import * as path from 'path';
export class OpenChangedFilesCommand extends ActiveEditorCommand {
constructor(private git: GitService, private repoPath: string) {
constructor(private git: GitService) {
super(Commands.OpenChangedFiles);
}
@@ -18,7 +18,7 @@ export class OpenChangedFilesCommand extends ActiveEditorCommand {
try {
if (!uris) {
const repoPath = await this.git.getRepoPathFromUri(uri, this.repoPath);
const repoPath = await this.git.getRepoPathFromUri(uri, this.git.repoPath);
if (!repoPath) return window.showWarningMessage(`Unable to open changed files`);
const status = await this.git.getStatusForRepo(repoPath);

View File

@@ -7,7 +7,7 @@ import { Logger } from '../logger';
export class OpenCommitInRemoteCommand extends ActiveEditorCommand {
constructor(private git: GitService, private repoPath: string) {
constructor(private git: GitService) {
super(Commands.OpenCommitInRemote);
}
@@ -35,7 +35,7 @@ export class OpenCommitInRemoteCommand extends ActiveEditorCommand {
commit = new GitCommit(commit.type, commit.repoPath, commit.previousSha, commit.previousFileName, commit.author, commit.date, commit.message);
}
const remotes = Arrays.uniqueBy(await this.git.getRemotes(this.repoPath), _ => _.url, _ => !!_.provider);
const remotes = Arrays.uniqueBy(await this.git.getRemotes(this.git.repoPath), _ => _.url, _ => !!_.provider);
return commands.executeCommand(Commands.OpenInRemote, uri, remotes, 'commit', [commit.sha]);
}
catch (ex) {

View File

@@ -7,7 +7,7 @@ import { Logger } from '../logger';
export class OpenFileInRemoteCommand extends ActiveEditorCommand {
constructor(private git: GitService, private repoPath: string) {
constructor(private git: GitService) {
super(Commands.OpenFileInRemote);
}
@@ -18,10 +18,10 @@ export class OpenFileInRemoteCommand extends ActiveEditorCommand {
}
const gitUri = await GitUri.fromUri(uri, this.git);
const branch = await this.git.getBranch(gitUri.repoPath || this.repoPath);
const branch = await this.git.getBranch(gitUri.repoPath || this.git.repoPath);
try {
const remotes = Arrays.uniqueBy(await this.git.getRemotes(this.repoPath), _ => _.url, _ => !!_.provider);
const remotes = Arrays.uniqueBy(await this.git.getRemotes(this.git.repoPath), _ => _.url, _ => !!_.provider);
const range = editor && new Range(editor.selection.start.with({ line: editor.selection.start.line + 1 }), editor.selection.end.with({ line: editor.selection.end.line + 1 }));
return commands.executeCommand(Commands.OpenInRemote, uri, remotes, 'file', [gitUri.getRelativePath(), branch.name, gitUri.sha, range]);
}

View File

@@ -7,7 +7,7 @@ import { BranchesQuickPick, BranchHistoryQuickPick, CommandQuickPickItem } from
export class ShowQuickBranchHistoryCommand extends ActiveEditorCachedCommand {
constructor(private git: GitService, private repoPath: string) {
constructor(private git: GitService) {
super(Commands.ShowQuickBranchHistory);
}
@@ -24,7 +24,7 @@ export class ShowQuickBranchHistoryCommand extends ActiveEditorCachedCommand {
let progressCancellation = branch && BranchHistoryQuickPick.showProgress(branch);
try {
const repoPath = (gitUri && gitUri.repoPath) || await this.git.getRepoPathFromUri(uri, this.repoPath);
const repoPath = (gitUri && gitUri.repoPath) || await this.git.getRepoPathFromUri(uri, this.git.repoPath);
if (!repoPath) return window.showWarningMessage(`Unable to show branch history`);
if (!branch) {

View File

@@ -8,7 +8,7 @@ import * as path from 'path';
export class ShowQuickCommitDetailsCommand extends ActiveEditorCachedCommand {
constructor(private git: GitService, private repoPath: string) {
constructor(private git: GitService) {
super(Commands.ShowQuickCommitDetails);
}
@@ -56,7 +56,7 @@ export class ShowQuickCommitDetailsCommand extends ActiveEditorCachedCommand {
}
if (!repoLog) {
const log = await this.git.getLogForRepo(repoPath || this.repoPath, sha, 2);
const log = await this.git.getLogForRepo(repoPath || this.git.repoPath, sha, 2);
if (!log) return window.showWarningMessage(`Unable to show commit details`);
commit = log.commits.get(sha);

View File

@@ -7,7 +7,7 @@ import { CommandQuickPickItem, RepoStatusQuickPick } from '../quickPicks';
export class ShowQuickRepoStatusCommand extends ActiveEditorCachedCommand {
constructor(private git: GitService, private repoPath: string) {
constructor(private git: GitService) {
super(Commands.ShowQuickRepoStatus);
}
@@ -17,7 +17,7 @@ export class ShowQuickRepoStatusCommand extends ActiveEditorCachedCommand {
}
try {
const repoPath = await this.git.getRepoPathFromUri(uri, this.repoPath);
const repoPath = await this.git.getRepoPathFromUri(uri, this.git.repoPath);
if (!repoPath) return window.showWarningMessage(`Unable to show repository status`);
const status = await this.git.getStatusForRepo(repoPath);