mirror of
https://github.com/adusak/bitbucket-git-helpers.plugin.zsh.git
synced 2026-01-11 19:30:23 +01:00
29 lines
618 B
Ruby
Executable File
29 lines
618 B
Ruby
Executable File
#!/usr/bin/env ruby
|
|
#
|
|
# Open a file/directory on bitbucket in the current branch
|
|
#
|
|
# Copyright 2016 Joe Block <jpb@unixorn.net>
|
|
#
|
|
# License: Apache 2.0
|
|
|
|
require 'pathname'
|
|
require_relative 'bbhelpers'
|
|
|
|
def construct_PR_URL
|
|
remote = git_remote()
|
|
bbloc = remote.index('bitbucket.org')
|
|
if not bbloc
|
|
host = repo_url
|
|
else
|
|
host = remote[bbloc..-5].sub(':','/')
|
|
end
|
|
return "https://#{host}/pull-requests/new?source=#{git_branch()}&t=1"
|
|
end
|
|
|
|
if ARGV.length > 0
|
|
puts 'Usage: git-bb-create-pull-request'
|
|
puts 'Open the create PR page on bitbucket for the current branch'
|
|
end
|
|
|
|
openURL(construct_PR_URL())
|