mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 19:18:59 +01:00
Git: Pull from specific branch
This commit is contained in:
@@ -270,7 +270,8 @@ export const GitErrorCodes = {
|
||||
CantAccessRemote: 'CantAccessRemote',
|
||||
RepositoryNotFound: 'RepositoryNotFound',
|
||||
RepositoryIsLocked: 'RepositoryIsLocked',
|
||||
BranchNotFullyMerged: 'BranchNotFullyMerged'
|
||||
BranchNotFullyMerged: 'BranchNotFullyMerged',
|
||||
NoRemoteReference: 'NoRemoteReference'
|
||||
};
|
||||
|
||||
function getGitErrorCode(stderr: string): string | undefined {
|
||||
@@ -290,6 +291,8 @@ function getGitErrorCode(stderr: string): string | undefined {
|
||||
return GitErrorCodes.CantAccessRemote;
|
||||
} else if (/branch '.+' is not fully merged/.test(stderr)) {
|
||||
return GitErrorCodes.BranchNotFullyMerged;
|
||||
} else if (/Couldn\'t find remote ref/.test(stderr)) {
|
||||
return GitErrorCodes.NoRemoteReference;
|
||||
}
|
||||
|
||||
return void 0;
|
||||
@@ -734,13 +737,21 @@ export class Repository {
|
||||
}
|
||||
}
|
||||
|
||||
async pull(rebase?: boolean): Promise<void> {
|
||||
async pull(rebase?: boolean, remote?: string, name?: string): Promise<void> {
|
||||
const args = ['pull'];
|
||||
|
||||
if (rebase) {
|
||||
args.push('-r');
|
||||
}
|
||||
|
||||
if (remote) {
|
||||
args.push(remote);
|
||||
}
|
||||
|
||||
if (name) {
|
||||
args.push(name);
|
||||
}
|
||||
|
||||
try {
|
||||
await this.run(args);
|
||||
} catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user