mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-31 00:10:04 +08:00
Git - add new API to help with computing a diff with stats between two commits (#302402)
This commit is contained in:
@@ -212,6 +212,10 @@ export class ApiRepository implements Repository {
|
||||
return this.#repository.diffBetweenWithStats(ref1, ref2, path);
|
||||
}
|
||||
|
||||
diffBetweenWithStats2(ref: string, path?: string): Promise<DiffChange[]> {
|
||||
return this.#repository.diffBetweenWithStats2(ref, path);
|
||||
}
|
||||
|
||||
hashObject(data: string): Promise<string> {
|
||||
return this.#repository.hashObject(data);
|
||||
}
|
||||
|
||||
1
extensions/git/src/api/git.d.ts
vendored
1
extensions/git/src/api/git.d.ts
vendored
@@ -278,6 +278,7 @@ export interface Repository {
|
||||
diffBetween(ref1: string, ref2: string, path: string): Promise<string>;
|
||||
diffBetweenPatch(ref1: string, ref2: string, path?: string): Promise<string>;
|
||||
diffBetweenWithStats(ref1: string, ref2: string, path?: string): Promise<DiffChange[]>;
|
||||
diffBetweenWithStats2(ref: string, path?: string): Promise<DiffChange[]>;
|
||||
|
||||
hashObject(data: string): Promise<string>;
|
||||
|
||||
|
||||
@@ -1226,6 +1226,14 @@ export class Repository implements Disposable {
|
||||
this.repository.diffBetweenWithStats(`${ref1}...${ref2}`, { path, similarityThreshold }));
|
||||
}
|
||||
|
||||
diffBetweenWithStats2(ref: string, path?: string): Promise<DiffChange[]> {
|
||||
const scopedConfig = workspace.getConfiguration('git', Uri.file(this.root));
|
||||
const similarityThreshold = scopedConfig.get<number>('similarityThreshold', 50);
|
||||
|
||||
return this.run(Operation.Diff, () =>
|
||||
this.repository.diffBetweenWithStats(ref, { path, similarityThreshold }));
|
||||
}
|
||||
|
||||
diffTrees(treeish1: string, treeish2?: string): Promise<DiffChange[]> {
|
||||
const scopedConfig = workspace.getConfiguration('git', Uri.file(this.root));
|
||||
const similarityThreshold = scopedConfig.get<number>('similarityThreshold', 50);
|
||||
|
||||
Reference in New Issue
Block a user