Browse Source

Add support to filter logs by author

main
Eric Amodio 6 years ago
parent
commit
897676e371
2 changed files with 11 additions and 3 deletions
  1. +4
    -1
      src/git/git.ts
  2. +7
    -2
      src/gitService.ts

+ 4
- 1
src/git/git.ts View File

@ -465,8 +465,11 @@ export class Git {
return git({ cwd: repoPath }, ...params);
}
static log(repoPath: string, options: { maxCount?: number; ref?: string; reverse?: boolean }) {
static log(repoPath: string, options: { author?: string; maxCount?: number; ref?: string; reverse?: boolean }) {
const params = ['-c', 'diff.renameLimit=0', ...defaultLogParams, '--full-history', '-M', '-m'];
if (options.author) {
params.push(`--author=${options.author}`);
}
if (options.maxCount && !options.reverse) {
params.push(`-n${options.maxCount}`);
}

+ 7
- 2
src/gitService.ts View File

@ -1122,7 +1122,7 @@ export class GitService implements Disposable {
async getLog(
repoPath: string,
options: { maxCount?: number; ref?: string; reverse?: boolean } = {}
options: { author?: string; maxCount?: number; ref?: string; reverse?: boolean } = {}
): Promise<GitLog | undefined> {
options = { reverse: false, ...options };
@ -1131,7 +1131,12 @@ export class GitService implements Disposable {
const maxCount = options.maxCount == null ? Container.config.advanced.maxListItems || 0 : options.maxCount;
try {
const data = await Git.log(repoPath, { maxCount: maxCount, ref: options.ref, reverse: options.reverse });
const data = await Git.log(repoPath, {
author: options.author,
maxCount: maxCount,
ref: options.ref,
reverse: options.reverse
});
const log = GitLogParser.parse(
data,
GitCommitType.Branch,

||||||
x
 
000:0
Loading…
Cancel
Save