lib/atlassian/stash/pull_request.rb in atlassian-stash-0.4.0 vs lib/atlassian/stash/pull_request.rb in atlassian-stash-0.4.1

- old
+ new

@@ -60,10 +60,20 @@ Process.exit if not target or not source @source = source @target = target + @source_ref = source + if options.src_remote and not options.src_remote.empty? + @source_ref = options.src_remote + "/" + @source_ref + end + + @target_ref = target + if options.target_remote and not options.target_remote.empty? + @target_ref = options.target_remote + "/" + @target_ref + end + srcRepoInfo = RepoInfo.create(@config, options.src_remote) targetRepoInfo = RepoInfo.create(@config, options.target_remote) title, description = title_and_description(options) @@ -76,11 +86,11 @@ username = ask("Username: ") unless @config["username"] password = ask("Password: ") { |q| q.echo = '*' } unless @config["password"] uri = URI.parse(@config["stash_url"]) prPath = targetRepoInfo.repoPath + '/pull-requests' - + req = Net::HTTP::Post.new(uri.query.nil? ? "#{prPath}" : "#{prPath}?#{uri.query}", {'Content-Type' => 'application/json', 'Accept' => 'application/json'}) req.basic_auth username, password req.body = resource.to_json http = Net::HTTP.new(uri.host, uri.port, proxy_addr, proxy_port) http.verify_mode = OpenSSL::SSL::VERIFY_NONE if @config["ssl_no_verify"] @@ -124,10 +134,10 @@ def title_from_branch convert_branch_name_to_sentence(@source) || "Merge '#{@source}' into '#{@target}'" end def git_commit_messages - @commit_messages ||= `git log --reverse --format=%s #{@target}..#{@source}` + @commit_messages ||= `git log --reverse --format=%s #{@target_ref}..#{@source_ref}` end def parse_proxy(conf) return nil, nil unless conf