Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions cfg.sample.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ try_users = []
# Auto-squash commits. Requires the local Git command
#autosquash = true

# Whether homu should push a temporary merge commit that causes
# github to think the PR was merged. You need to disable this if
# you have branch protection enabled. Also, leaving this enabled
# means that other people pulling master might transiently see
# the merge commit.
#linear_fake_merge = true

## branch names (these settings here are the defaults)
#[repo.NAME.branch]
#
Expand Down
17 changes: 16 additions & 1 deletion homu/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,12 @@ def refresh(self):
self.body = issue.body

def fake_merge(self, repo_cfg):
if repo_cfg.get('linear', False) or repo_cfg.get('autosquash', False):
is_linear_or_autosquash = repo_cfg.get('linear', False) or repo_cfg.get('autosquash', False)
# Backwards compat, though I think this is a terrible default.
fake_merge = repo_cfg.get('linear_fake_merge', True)
if not is_linear_or_autosquash:
return
if fake_merge:
msg = '''!!! Temporary commit !!!

This commit is artifically made up to mark PR {} as merged.
Expand All @@ -238,6 +243,16 @@ def fail(err):
self.get_issue().close()

utils.retry_until(inner, fail, self)
else:
issue = self.get_issue()
title = issue.title
# So unfortunately, we can't yet tell github this PR was
# merged. We need to rework things so that our last
# comment at least includes a link to the master commit.
merged_prefix = '[merged] '
if not title.startswith(merged_prefix):
title = merged_prefix + title
issue.edit(title=title, state='closed')

def sha_cmp(short, full):
return len(short) >= 4 and short == full[:len(short)]
Expand Down