Kaynağa Gözat

Impls changed file count for GitHub

main
Eric Amodio 2 yıl önce
ebeveyn
işleme
264224b22b
5 değiştirilmiş dosya ile 20 ekleme ve 8 silme
  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 Dosyayı Görüntüle

@ -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 Dosyayı Görüntüle

@ -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 Dosyayı Görüntüle

@ -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 Dosyayı Görüntüle

@ -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 Dosyayı Görüntüle

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

Yükleniyor…
İptal
Kaydet