Explorar el Código

Adds type safety to date ordering

main
Eric Amodio hace 2 años
padre
commit
b0b014c14f
Se han modificado 5 ficheros con 50 adiciones y 32 borrados
  1. +15
    -9
      src/env/node/git/git.ts
  2. +8
    -8
      src/env/node/git/localGitProvider.ts
  3. +4
    -4
      src/git/gitProvider.ts
  4. +10
    -4
      src/git/gitProviderService.ts
  5. +13
    -7
      src/plus/github/githubGitProvider.ts

+ 15
- 9
src/env/node/git/git.ts Ver fichero

@ -705,7 +705,7 @@ export class Git {
authors?: GitUser[];
limit?: number;
merges?: boolean;
ordering?: string | null;
ordering?: 'date' | 'author-date' | 'topo' | null;
similarityThreshold?: number | null;
since?: number | string;
until?: number | string;
@ -796,7 +796,7 @@ export class Git {
filters?: GitDiffFilter[];
firstParent?: boolean;
limit?: number;
ordering?: string | null;
ordering?: 'date' | 'author-date' | 'topo' | null;
renames?: boolean;
reverse?: boolean;
since?: string;
@ -890,7 +890,7 @@ export class Git {
repoPath: string,
fileName: string,
options?: {
ordering?: string | null;
ordering?: 'date' | 'author-date' | 'topo' | null;
ref?: string;
similarityThreshold?: number | null;
cancellation?: CancellationToken;
@ -929,7 +929,7 @@ export class Git {
repoPath: string,
objectId: string,
ref: string,
ordering: string | null,
ordering: 'date' | 'author-date' | 'topo' | null,
file?: string,
cancellation?: CancellationToken,
) {
@ -955,7 +955,7 @@ export class Git {
return data.length === 0 ? undefined : data.trim();
}
async log__recent(repoPath: string, ordering?: string | null) {
async log__recent(repoPath: string, ordering?: 'date' | 'author-date' | 'topo' | null) {
const params = ['log', '-n1', '--format=%H'];
if (ordering) {
@ -971,7 +971,7 @@ export class Git {
return data.length === 0 ? undefined : data.trim();
}
async log__recent_committerdate(repoPath: string, ordering?: string | null) {
async log__recent_committerdate(repoPath: string, ordering?: 'date' | 'author-date' | 'topo' | null) {
const params = ['log', '-n1', '--format=%ct'];
if (ordering) {
@ -995,7 +995,7 @@ export class Git {
ordering,
skip,
useShow,
}: { limit?: number; ordering?: string | null; skip?: number; useShow?: boolean } = {},
}: { limit?: number; ordering?: 'date' | 'author-date' | 'topo' | null; skip?: number; useShow?: boolean } = {},
) {
const params = [
useShow ? 'show' : 'log',
@ -1096,7 +1096,13 @@ export class Git {
limit,
ordering,
skip,
}: { all?: boolean; branch?: string; limit?: number; ordering?: string | null; skip?: number } = {},
}: {
all?: boolean;
branch?: string;
limit?: number;
ordering?: 'date' | 'author-date' | 'topo' | null;
skip?: number;
} = {},
): Promise<string> {
const params = ['log', '--walk-reflogs', `--format=${GitReflogParser.defaultFormat}`, '--date=iso8601'];
@ -1188,7 +1194,7 @@ export class Git {
async rev_parse__currentBranch(
repoPath: string,
ordering: string | null,
ordering: 'date' | 'author-date' | 'topo' | null,
): Promise<[string, string | undefined] | undefined> {
try {
const data = await this.git<string>(

+ 8
- 8
src/env/node/git/localGitProvider.ts Ver fichero

@ -2064,7 +2064,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
cursor?: string;
limit?: number;
merges?: boolean;
ordering?: string | null;
ordering?: 'date' | 'author-date' | 'topo' | null;
ref?: string;
since?: number | string;
until?: number | string;
@ -2148,7 +2148,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
cursor?: string;
limit?: number;
merges?: boolean;
ordering?: string | null;
ordering?: 'date' | 'author-date' | 'topo' | null;
ref?: string;
since?: string;
},
@ -2186,7 +2186,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
authors?: GitUser[];
limit?: number;
merges?: boolean;
ordering?: string | null;
ordering?: 'date' | 'author-date' | 'topo' | null;
ref?: string;
},
): (limit: number | { until: string } | undefined) => Promise<GitLog> {
@ -2423,7 +2423,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
cursor?: string;
force?: boolean | undefined;
limit?: number;
ordering?: string | null;
ordering?: 'date' | 'author-date' | 'topo' | null;
range?: Range;
ref?: string;
renames?: boolean;
@ -2576,7 +2576,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
all?: boolean;
cursor?: string;
limit?: number;
ordering?: string | null;
ordering?: 'date' | 'author-date' | 'topo' | null;
range?: Range;
ref?: string;
renames?: boolean;
@ -2657,7 +2657,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
options: {
all?: boolean;
limit?: number;
ordering?: string | null;
ordering?: 'date' | 'author-date' | 'topo' | null;
range?: Range;
ref?: string;
renames?: boolean;
@ -3201,7 +3201,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
@log()
async getIncomingActivity(
repoPath: string,
options?: { all?: boolean; branch?: string; limit?: number; ordering?: string | null; skip?: number },
options?: { all?: boolean; branch?: string; limit?: number; ordering?: 'date' | 'author-date' | 'topo' | null; skip?: number },
): Promise<GitReflog | undefined> {
const scope = getLogScope();
@ -3229,7 +3229,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
private getReflogMoreFn(
reflog: GitReflog,
options?: { all?: boolean; branch?: string; limit?: number; ordering?: string | null; skip?: number },
options?: { all?: boolean; branch?: string; limit?: number; ordering?: 'date' | 'author-date' | 'topo' | null; skip?: number },
): (limit: number) => Promise<GitReflog> {
return async (limit: number | undefined) => {
limit = limit ?? configuration.get('advanced.maxSearchItems') ?? 0;

+ 4
- 4
src/git/gitProvider.ts Ver fichero

@ -266,7 +266,7 @@ export interface GitProvider extends Disposable {
cursor?: string | undefined;
limit?: number | undefined;
merges?: boolean | undefined;
ordering?: string | null | undefined;
ordering?: 'date' | 'author-date' | 'topo' | null | undefined;
ref?: string | undefined;
since?: string | undefined;
},
@ -278,7 +278,7 @@ export interface GitProvider extends Disposable {
cursor?: string | undefined;
limit?: number | undefined;
merges?: boolean | undefined;
ordering?: string | null | undefined;
ordering?: 'date' | 'author-date' | 'topo' | null | undefined;
ref?: string | undefined;
since?: string | undefined;
},
@ -300,7 +300,7 @@ export interface GitProvider extends Disposable {
cursor?: string | undefined;
force?: boolean | undefined;
limit?: number | undefined;
ordering?: string | null | undefined;
ordering?: 'date' | 'author-date' | 'topo' | null | undefined;
range?: Range | undefined;
ref?: string | undefined;
renames?: boolean | undefined;
@ -343,7 +343,7 @@ export interface GitProvider extends Disposable {
all?: boolean | undefined;
branch?: string | undefined;
limit?: number | undefined;
ordering?: string | null | undefined;
ordering?: 'date' | 'author-date' | 'topo' | null | undefined;
skip?: number | undefined;
},
): Promise<GitReflog | undefined>;

+ 10
- 4
src/git/gitProviderService.ts Ver fichero

@ -1404,7 +1404,7 @@ export class GitProviderService implements Disposable {
authors?: GitUser[];
limit?: number;
merges?: boolean;
ordering?: string | null;
ordering?: 'date' | 'author-date' | 'topo' | null;
ref?: string;
since?: string;
},
@ -1420,7 +1420,7 @@ export class GitProviderService implements Disposable {
authors?: GitUser[];
limit?: number;
merges?: boolean;
ordering?: string | null;
ordering?: 'date' | 'author-date' | 'topo' | null;
ref?: string;
since?: string;
},
@ -1447,7 +1447,7 @@ export class GitProviderService implements Disposable {
all?: boolean;
force?: boolean;
limit?: number;
ordering?: string | null;
ordering?: 'date' | 'author-date' | 'topo' | null;
range?: Range;
ref?: string;
renames?: boolean;
@ -1634,7 +1634,13 @@ export class GitProviderService implements Disposable {
@log()
async getIncomingActivity(
repoPath: string | Uri,
options?: { all?: boolean; branch?: string; limit?: number; ordering?: string | null; skip?: number },
options?: {
all?: boolean;
branch?: string;
limit?: number;
ordering?: 'date' | 'author-date' | 'topo' | null;
skip?: number;
},
): Promise<GitReflog | undefined> {
const { provider, path } = this.getProvider(repoPath);
return provider.getIncomingActivity(path, options);

+ 13
- 7
src/plus/github/githubGitProvider.ts Ver fichero

@ -1181,7 +1181,7 @@ export class GitHubGitProvider implements GitProvider, Disposable {
cursor?: string;
limit?: number;
merges?: boolean;
ordering?: string | null;
ordering?: 'date' | 'author-date' | 'topo' | null;
ref?: string;
since?: string;
},
@ -1286,7 +1286,7 @@ export class GitHubGitProvider implements GitProvider, Disposable {
cursor?: string;
limit?: number;
merges?: boolean;
ordering?: string | null;
ordering?: 'date' | 'author-date' | 'topo' | null;
ref?: string;
since?: string;
},
@ -1304,7 +1304,7 @@ export class GitHubGitProvider implements GitProvider, Disposable {
authors?: GitUser[];
limit?: number;
merges?: boolean;
ordering?: string | null;
ordering?: 'date' | 'author-date' | 'topo' | null;
ref?: string;
},
): (limit: number | { until: string } | undefined) => Promise<GitLog> {
@ -1572,7 +1572,7 @@ export class GitHubGitProvider implements GitProvider, Disposable {
cursor?: string;
force?: boolean | undefined;
limit?: number;
ordering?: string | null;
ordering?: 'date' | 'author-date' | 'topo' | null;
range?: Range;
ref?: string;
renames?: boolean;
@ -1732,7 +1732,7 @@ export class GitHubGitProvider implements GitProvider, Disposable {
all?: boolean;
cursor?: string;
limit?: number;
ordering?: string | null;
ordering?: 'date' | 'author-date' | 'topo' | null;
range?: Range;
ref?: string;
renames?: boolean;
@ -1870,7 +1870,7 @@ export class GitHubGitProvider implements GitProvider, Disposable {
options?: {
all?: boolean;
limit?: number;
ordering?: string | null;
ordering?: 'date' | 'author-date' | 'topo' | null;
range?: Range;
ref?: string;
renames?: boolean;
@ -2133,7 +2133,13 @@ export class GitHubGitProvider implements GitProvider, Disposable {
@log()
async getIncomingActivity(
_repoPath: string,
_options?: { all?: boolean; branch?: string; limit?: number; ordering?: string | null; skip?: number },
_options?: {
all?: boolean;
branch?: string;
limit?: number;
ordering?: 'date' | 'author-date' | 'topo' | null;
skip?: number;
},
): Promise<GitReflog | undefined> {
return undefined;
}

Cargando…
Cancelar
Guardar