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

Commit 8638e87

Browse files
authored
Merge pull request #91 from jd/cancel-on-empty
Pull request for cancel-on-empty
2 parents 4c3b3b3 + 8ac94e3 commit 8638e87

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

git_pull_request/__init__.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -523,14 +523,17 @@ def fork_and_push_pull_request(g, hosttype, repo_to_fork, rebase,
523523

524524
if pulls:
525525
for pull in pulls:
526-
# If there's only one commit, it's very likely the new PR title
527-
# should be the actual current title. Otherwise, it's unlikely the
528-
# title we autogenerate is going to be better than one might be in
529-
# place now, so keep it.
530-
if nb_commits == 1:
531-
ptitle = git_title
526+
if title is None:
527+
# If there's only one commit, it's very likely the new PR title
528+
# should be the actual current title. Otherwise, it's unlikely
529+
# the title we autogenerate is going to be better than one
530+
# might be in place now, so keep it.
531+
if nb_commits == 1:
532+
ptitle = git_title
533+
else:
534+
ptitle = pull.title
532535
else:
533-
ptitle = pull.title
536+
ptitle = title
534537

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

541544
ptitle, body = edit_title_and_message(ptitle, body)
542545

546+
if ptitle is None:
547+
LOG.critical("Pull-request message is empty, aborting")
548+
return 40
549+
543550
if ptitle and body:
544551
if dry_run:
545552
LOG.info("Would edit title and body")
@@ -579,6 +586,8 @@ def fork_and_push_pull_request(g, hosttype, repo_to_fork, rebase,
579586
else:
580587
LOG.debug("Adding labels %s", labels)
581588
pull.add_to_labels(*labels)
589+
590+
LOG.info("Pull-request updated: %s", pull.html_url)
582591
else:
583592
# Create a pull request
584593
if not title or not message:

0 commit comments

Comments
 (0)