Skip to content

Commit

Permalink
Merge pull request #10 from Davilink/feature/addSourceBranch
Browse files Browse the repository at this point in the history
Added the ability to specify a branch
  • Loading branch information
jlandersen authored Jun 6, 2017
2 parents cbc2810 + a3db169 commit 28867ba
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/vstsbuildrestclient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export interface BuildDefinition {
id: number;
name: string;
revision: number;
sourceBranch?: string;
}

export interface BuildLog {
Expand Down Expand Up @@ -143,6 +144,10 @@ class VstsBuildRestClientImpl implements VstsBuildRestClient {
}
};

if(definition.sourceBranch) {
body['sourceBranch'] = definition.sourceBranch;
}

return this.post<QueueBuildResult>(url, body);
}

Expand Down
21 changes: 18 additions & 3 deletions src/vstsbuildstatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,29 @@ export class VstsBuildStatus {
public openQueueBuildSelection(): void {
this.getBuildDefinitionByQuickPick("Select a build definition").then(result => {
if (!result) {
return;
return Promise.reject(null);
}

return this.restClient.queueBuild(result);
return window.showInputBox({prompt: "Branch (leave empty to use default) ?"}).then(branch => {
if(branch !== undefined) {
if(branch.length !== 0) {
result.sourceBranch = branch;
}

return this.restClient.queueBuild(result);
}
else {
// The user has cancel the input box
return Promise.reject(null);
}
});
}).then(result => {
window.showInformationMessage(`Build has been queued for ${result.value.definition.name}`);
}, error => {
this.handleError();
if(error) {
this.handleError();
}
// Otherwise has been cancelled by the user
});
}

Expand Down

0 comments on commit 28867ba

Please sign in to comment.