lib/atlassian/stash/pull_request.rb in atlassian-stash-0.2.0 vs lib/atlassian/stash/pull_request.rb in atlassian-stash-0.3.0

- old
+ new

@@ -54,12 +54,15 @@ Process.exit if not target or not source @source = source @target = target - repoInfo = RepoInfo.create(@config) + remote = get_remote_url(options.remote || @config["remote"]) + repoInfo = RepoInfo.create(@config, remote) + title, description = title_and_description(options) + resource = CreatePullRequestResource.new(repoInfo.projectKey, repoInfo.slug, title, description, reviewers, @source, @target).resource username = @config["username"] password = @config["password"] proxy_addr, proxy_port = parse_proxy(@config["proxy"]) @@ -110,18 +113,14 @@ end end private - def title + def title_from_branch convert_branch_name_to_sentence(@source) || "Merge '#{@source}' into '#{@target}'" end - def description - git_commit_messages - end - def git_commit_messages @commit_messages ||= `git log --reverse --format=%s #{@target}..#{@source}` end def parse_proxy(conf) @@ -132,9 +131,16 @@ port = port.to_i else port = nil end [addr, port] + end + + def title_and_description(options) + descr = (options.description or git_commit_messages) + title = (options.title or title_from_branch) + + [title, descr] end end end end