Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes issue24 #27

Merged
merged 4 commits into from
Jun 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,12 +321,36 @@ class GitBackupSync {
return false;
}

let backupBranchName: string;
let branchInfo = await this._branchInfo.get(this._config.branchInfoPath, currentBranchName);
if (branchInfo === undefined) {
maxyu1115 marked this conversation as resolved.
Show resolved Hide resolved
///ask user if they want to loadBackup by giving a backup Branch name
let branchName = await vscode.window.showInputBox({
placeHolder: 'No backup branch found.Type a Branch Name, or press Esc to cancel',
ignoreFocusOut: true, // 光标移开也不会消失
prompt: "Load Backup Branch",
});

if (branchName === undefined) {
this.showErrorMessage(`Load Backup failed: No backup branch found for "${currentBranchName}"`);
return false;
}

backupBranchName = branchName;
}
else {
backupBranchName = branchInfo.backupBranchName;
}


/*
let branchInfo = await this._branchInfo.get(this._config.branchInfoPath, currentBranchName);
if (branchInfo === undefined) {
this.showErrorMessage(`Load Backup failed: No backup branch found for "${currentBranchName}"`);
return false;
}
let backupBranchName: string = branchInfo.backupBranchName;
*/
// stashes the current changes. Normally this shouldn't do anything since you wouldn't want to load backup with local changes
console.log(await this._git.stash());
console.log(await this._git.checkout(backupBranchName));
Expand Down