mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-29 21:11:38 +01:00
Git - better handle conflict during cherry-pick (#230312)
This commit is contained in:
@@ -790,6 +790,21 @@ export class Repository implements Disposable {
|
||||
return this._mergeInProgress;
|
||||
}
|
||||
|
||||
private _cherryPickInProgress: boolean = false;
|
||||
|
||||
set cherryPickInProgress(value: boolean) {
|
||||
if (this._cherryPickInProgress === value) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._cherryPickInProgress = value;
|
||||
commands.executeCommand('setContext', 'gitCherryPickInProgress', value);
|
||||
}
|
||||
|
||||
get cherryPickInProgress() {
|
||||
return this._cherryPickInProgress;
|
||||
}
|
||||
|
||||
private _operations = new OperationManager(this.logger);
|
||||
get operations(): OperationManager { return this._operations; }
|
||||
|
||||
@@ -1434,6 +1449,10 @@ export class Repository implements Disposable {
|
||||
await this.run(Operation.CherryPick, () => this.repository.cherryPick(commitHash));
|
||||
}
|
||||
|
||||
async cherryPickAbort(): Promise<void> {
|
||||
await this.run(Operation.CherryPick, () => this.repository.cherryPickAbort());
|
||||
}
|
||||
|
||||
async move(from: string, to: string): Promise<void> {
|
||||
await this.run(Operation.Move, () => this.repository.move(from, to));
|
||||
}
|
||||
@@ -2171,13 +2190,14 @@ export class Repository implements Disposable {
|
||||
this._updateResourceGroupsState(optimisticResourcesGroups);
|
||||
}
|
||||
|
||||
const [HEAD, remotes, submodules, rebaseCommit, mergeInProgress, commitTemplate] =
|
||||
const [HEAD, remotes, submodules, rebaseCommit, mergeInProgress, cherryPickInProgress, commitTemplate] =
|
||||
await Promise.all([
|
||||
this.repository.getHEADRef(),
|
||||
this.repository.getRemotes(),
|
||||
this.repository.getSubmodules(),
|
||||
this.getRebaseCommit(),
|
||||
this.isMergeInProgress(),
|
||||
this.isCherryPickInProgress(),
|
||||
this.getInputTemplate()]);
|
||||
|
||||
this._HEAD = HEAD;
|
||||
@@ -2185,6 +2205,7 @@ export class Repository implements Disposable {
|
||||
this._submodules = submodules!;
|
||||
this.rebaseCommit = rebaseCommit;
|
||||
this.mergeInProgress = mergeInProgress;
|
||||
this.cherryPickInProgress = cherryPickInProgress;
|
||||
|
||||
this._sourceControl.commitTemplate = commitTemplate;
|
||||
|
||||
@@ -2412,6 +2433,11 @@ export class Repository implements Disposable {
|
||||
return new Promise<boolean>(resolve => fs.exists(mergeHeadPath, resolve));
|
||||
}
|
||||
|
||||
private isCherryPickInProgress(): Promise<boolean> {
|
||||
const cherryPickHeadPath = path.join(this.repository.root, '.git', 'CHERRY_PICK_HEAD');
|
||||
return new Promise<boolean>(resolve => fs.exists(cherryPickHeadPath, resolve));
|
||||
}
|
||||
|
||||
private async maybeAutoStash<T>(runOperation: () => Promise<T>): Promise<T> {
|
||||
const config = workspace.getConfiguration('git', Uri.file(this.root));
|
||||
const shouldAutoStash = config.get<boolean>('autoStash')
|
||||
|
||||
Reference in New Issue
Block a user