Browse Source

Moves getOldestUnpushedRefForFile location

main
Eric Amodio 1 year ago
parent
commit
1c80e54992
4 changed files with 30 additions and 24 deletions
  1. +17
    -17
      src/env/node/git/localGitProvider.ts
  2. +1
    -1
      src/git/gitProvider.ts
  3. +6
    -0
      src/git/gitProviderService.ts
  4. +6
    -6
      src/plus/github/githubGitProvider.ts

+ 17
- 17
src/env/node/git/localGitProvider.ts View File

@ -2134,23 +2134,6 @@ export class LocalGitProvider implements GitProvider, Disposable {
}
@log()
async getOldestUnpushedRefForFile(repoPath: string, uri: Uri): Promise<string | undefined> {
const [relativePath, root] = splitPath(uri, repoPath);
const data = await this.git.log__file(root, relativePath, '@{push}..', {
argsOrFormat: ['-z', '--format=%H'],
fileMode: 'none',
ordering: configuration.get('advanced.commitOrdering'),
renames: true,
});
if (!data) return undefined;
// -2 to skip the ending null
const index = data.lastIndexOf('\0', data.length - 2);
return index === -1 ? undefined : data.slice(index + 1, data.length - 2);
}
@log()
async getContributors(
repoPath: string,
options?: { all?: boolean; ref?: string; stats?: boolean },
@ -3411,6 +3394,23 @@ export class LocalGitProvider implements GitProvider, Disposable {
}
@log()
async getOldestUnpushedRefForFile(repoPath: string, uri: Uri): Promise<string | undefined> {
const [relativePath, root] = splitPath(uri, repoPath);
const data = await this.git.log__file(root, relativePath, '@{push}..', {
argsOrFormat: ['-z', '--format=%H'],
fileMode: 'none',
ordering: configuration.get('advanced.commitOrdering'),
renames: true,
});
if (!data) return undefined;
// -2 to skip the ending null
const index = data.lastIndexOf('\0', data.length - 2);
return index === -1 ? undefined : data.slice(index + 1, data.length - 2);
}
@log()
async getPreviousComparisonUris(
repoPath: string,
uri: Uri,

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

@ -236,7 +236,6 @@ export interface GitProvider extends Disposable {
ref?: string;
},
): Promise<GitGraph>;
getOldestUnpushedRefForFile(repoPath: string, uri: Uri): Promise<string | undefined>;
getContributors(
repoPath: string,
options?: { all?: boolean | undefined; ref?: string | undefined; stats?: boolean | undefined },
@ -335,6 +334,7 @@ export interface GitProvider extends Disposable {
ref: string | undefined,
skip?: number,
): Promise<NextComparisonUrisResult | undefined>;
getOldestUnpushedRefForFile(repoPath: string, uri: Uri): Promise<string | undefined>;
getPreviousComparisonUris(
repoPath: string,
uri: Uri,

+ 6
- 0
src/git/gitProviderService.ts View File

@ -1611,6 +1611,12 @@ export class GitProviderService implements Disposable {
}
@log()
async getOldestUnpushedRefForFile(repoPath: string | Uri, uri: Uri): Promise<string | undefined> {
const { provider, path } = this.getProvider(repoPath);
return provider.getOldestUnpushedRefForFile(path, uri);
}
@log()
getPreviousComparisonUris(
repoPath: string | Uri,
uri: Uri,

+ 6
- 6
src/plus/github/githubGitProvider.ts View File

@ -1371,12 +1371,6 @@ export class GitHubGitProvider implements GitProvider, Disposable {
}
@log()
async getOldestUnpushedRefForFile(_repoPath: string, _uri: Uri): Promise<string | undefined> {
// TODO@eamodio until we have access to the RemoteHub change store there isn't anything we can do here
return undefined;
}
@log()
async getContributors(
repoPath: string,
_options?: { all?: boolean; ref?: string; stats?: boolean },
@ -2152,6 +2146,12 @@ export class GitHubGitProvider implements GitProvider, Disposable {
}
@log()
async getOldestUnpushedRefForFile(_repoPath: string, _uri: Uri): Promise<string | undefined> {
// TODO@eamodio until we have access to the RemoteHub change store there isn't anything we can do here
return undefined;
}
@log()
async getPreviousComparisonUris(
repoPath: string,
uri: Uri,

Loading…
Cancel
Save