提交 bbb4adaa 编写于 作者: P Peng Lyu

Check dirty workspace before switching to Review mode.

上级 51c19493
......@@ -348,6 +348,11 @@ export class Repository {
throw (result.exitCode);
}
}
async isDirty(): Promise<boolean> {
let result = await GitProcess.exec(['diff', '--no-ext-diff', '--exit-code'], this.path);
return result.exitCode !== 0;
}
}
export class GitHubRepository {
......
......@@ -444,6 +444,12 @@ export class ReviewManager implements vscode.DecorationProvider {
}
async switch(pr: PullRequestModel): Promise<void> {
let isDirty = await this._repository.isDirty();
if (isDirty) {
vscode.window.showErrorMessage('Your local changes would be overwritten by checkout, please commit your changes or stash them before you switch branches');
return;
}
this.statusBarItem.text = '$(sync~spin) Switching to Review Mode';
this.statusBarItem.show();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册