Adds compare options to repository history

Adds compare options to file history
Fixes issue with repository history compare with commits with multiple files
This commit is contained in:
Eric Amodio
2016-11-25 14:12:39 -05:00
parent a91afffbb2
commit 615485cd21
5 changed files with 121 additions and 53 deletions

View File

@@ -0,0 +1,34 @@
'use strict';
import { QuickPickItem, Uri } from 'vscode';
import { Commands } from '../constants';
import { GitCommit, GitUri } from '../gitProvider';
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 = `$(git-commit) ${commit.sha}${descriptionSuffix}`;
this.detail = commit.message;
}
}
export interface CompareQuickPickItem extends QuickPickItem {
command: Commands;
}
export class FileQuickPickItem implements QuickPickItem {
label: string;
description: string;
detail: string;
uri: GitUri;
constructor(commit: GitCommit, public fileName: string) {
this.label = fileName;
this.uri = GitUri.fromUri(Uri.file(path.resolve(commit.repoPath, fileName)));
}
}