pull request needs to select the source branch manually

Issue #9 resolved
Former user created an issue

The bitbucket server URL is set to https://bitbucket.????.com

Then create a pull request from current branch, then web browser will open a link,

https://bitbucket.????.com/projects/hpss/repos/????/pull-requests?create

but the source branch is none and needs to be selected manually.

Comments (7)

  1. Leo Cheng

    I found the reason for this issue on windows. & character is contained in the URL, which causes URL is truncated.

    Refer to https://stackoverflow.com/questions/44513063/how-to-open-a-url-with-cmd

    Bitbucket server pull request URL pattern,

    \${url}/projects/${owner}/repos/${repo}/pull-requests?create&sourceBranch=${encodedBranch}&t=1

    The fix in extension.ts

    export function activate(context: vscode.ExtensionContext) {
    
      //stuff...
    
            const result = bb.GetPullRequestURL();
            result.then((url) => {
                let openUrlCommand: string;
                const command = platform.getRunCommand();
                if (command === 'start') {
                   // refer to https://stackoverflow.com/questions/44513063/how-to-open-a-url-with-cmd
                   openUrlCommand = `${command} \"\" \"${url}\"`;
                } else {
                   openUrlCommand = `${command} ${url}`;
                }
                console.log(`running ${openUrlCommand}`);
                cp.exec(`${openUrlCommand}`).on('error', (err: Error) => {
                    vscode.window.showErrorMessage(`Couldn't open a browser window. Make sure you have a browser installed. ${err}`);
                });
            }).catch((reason) => {
                vscode.window.showErrorMessage(`Couldn't start your pr: ${reason}`);
            });
    
      //stuff...
    
    }
    

  2. Ramiro Berrelleza repo owner

    Great insight @Leo Cheng ! I pushed the fix with the 0.3.10 release, can you give it a go?

  3. Log in to comment