Skip to content
This repository was archived by the owner on Nov 28, 2024. It is now read-only.

Commit

Permalink
Merge pull request #91 from jd/cancel-on-empty
Browse files Browse the repository at this point in the history
Pull request for cancel-on-empty
  • Loading branch information
mergify[bot] authored Nov 14, 2019
2 parents 4c3b3b3 + 8ac94e3 commit 8638e87
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions git_pull_request/__init__.py
Original file line number Diff line number Diff line change
@@ -523,14 +523,17 @@ def fork_and_push_pull_request(g, hosttype, repo_to_fork, rebase,

if pulls:
for pull in pulls:
# If there's only one commit, it's very likely the new PR title
# should be the actual current title. Otherwise, it's unlikely the
# title we autogenerate is going to be better than one might be in
# place now, so keep it.
if nb_commits == 1:
ptitle = git_title
if title is None:
# If there's only one commit, it's very likely the new PR title
# should be the actual current title. Otherwise, it's unlikely
# the title we autogenerate is going to be better than one
# might be in place now, so keep it.
if nb_commits == 1:
ptitle = git_title
else:
ptitle = pull.title
else:
ptitle = pull.title
ptitle = title

body = textparse.concat_with_ignore_marker(
message or git_message,
@@ -540,6 +543,10 @@ def fork_and_push_pull_request(g, hosttype, repo_to_fork, rebase,

ptitle, body = edit_title_and_message(ptitle, body)

if ptitle is None:
LOG.critical("Pull-request message is empty, aborting")
return 40

if ptitle and body:
if dry_run:
LOG.info("Would edit title and body")
@@ -579,6 +586,8 @@ def fork_and_push_pull_request(g, hosttype, repo_to_fork, rebase,
else:
LOG.debug("Adding labels %s", labels)
pull.add_to_labels(*labels)

LOG.info("Pull-request updated: %s", pull.html_url)
else:
# Create a pull request
if not title or not message:

0 comments on commit 8638e87

Please sign in to comment.