Procházet zdrojové kódy

Impls changed file count for GitHub

main
Eric Amodio před 2 roky
rodič
revize
264224b22b
5 změnil soubory, kde provedl 20 přidání a 8 odebrání
  1. +2
    -2
      src/git/models/diff.ts
  2. +2
    -2
      src/git/parsers/diffParser.ts
  3. +14
    -2
      src/premium/github/githubGitProvider.ts
  4. +1
    -1
      src/views/nodes/branchTrackingStatusFilesNode.ts
  5. +1
    -1
      src/views/nodes/statusFilesNode.ts

+ 2
- 2
src/git/models/diff.ts Zobrazit soubor

@ -48,9 +48,9 @@ export interface GitDiff {
}
export interface GitDiffShortStat {
readonly files: number;
readonly insertions: number;
readonly additions: number;
readonly deletions: number;
readonly changedFiles: number;
}
export type GitDiffFilter = 'A' | 'C' | 'D' | 'M' | 'R' | 'T' | 'U' | 'X' | 'B' | '*';

+ 2
- 2
src/git/parsers/diffParser.ts Zobrazit soubor

@ -190,8 +190,8 @@ export class GitDiffParser {
const [, files, insertions, deletions] = match;
const diffShortStat: GitDiffShortStat = {
files: files == null ? 0 : parseInt(files, 10),
insertions: insertions == null ? 0 : parseInt(insertions, 10),
changedFiles: files == null ? 0 : parseInt(files, 10),
additions: insertions == null ? 0 : parseInt(insertions, 10),
deletions: deletions == null ? 0 : parseInt(deletions, 10),
};

+ 14
- 2
src/premium/github/githubGitProvider.ts Zobrazit soubor

@ -680,8 +680,20 @@ export class GitHubGitProvider implements GitProvider, Disposable {
}
@log()
async getChangedFilesCount(_repoPath: string, _ref?: string): Promise<GitDiffShortStat | undefined> {
return undefined;
async getChangedFilesCount(repoPath: string, ref?: string): Promise<GitDiffShortStat | undefined> {
// TODO@eamodio if there is no ref we can't return anything, until we can get at the change store from RemoteHub
if (!ref) return undefined;
const commit = await this.getCommit(repoPath, ref);
if (commit?.stats == null) return undefined;
const { stats } = commit;
const changedFiles =
typeof stats.changedFiles === 'number'
? stats.changedFiles
: stats.changedFiles.added + stats.changedFiles.changed + stats.changedFiles.deleted;
return { additions: stats.additions, deletions: stats.deletions, changedFiles: changedFiles };
}
@log()

+ 1
- 1
src/views/nodes/branchTrackingStatusFilesNode.ts Zobrazit soubor

@ -112,7 +112,7 @@ export class BranchTrackingStatusFilesNode extends ViewNode {
this.repoPath,
`${this.status.upstream}${this.direction === 'behind' ? '..' : '...'}`,
);
const files = stats?.files ?? 0;
const files = stats?.changedFiles ?? 0;
const label = `${Strings.pluralize('file', files)} changed`;
const item = new TreeItem(label, TreeItemCollapsibleState.Collapsed);

+ 1
- 1
src/views/nodes/statusFilesNode.ts Zobrazit soubor

@ -136,7 +136,7 @@ export class StatusFilesNode extends ViewNode {
`${this.status.upstream}...`,
);
if (stats != null) {
files += stats.files;
files += stats.changedFiles;
} else {
files = -1;
}

Načítá se…
Zrušit
Uložit