瀏覽代碼

Add support to filter logs by author

main
Eric Amodio 6 年之前
父節點
當前提交
897676e371
共有 2 個文件被更改,包括 11 次插入3 次删除
  1. +4
    -1
      src/git/git.ts
  2. +7
    -2
      src/gitService.ts

+ 4
- 1
src/git/git.ts 查看文件

@ -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 查看文件

@ -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…
取消
儲存