Skip to content

Commit e01df1f

Browse files
authored
Merge pull request #126 from kellda/squash
Document `squash` and `squash-` commands
2 parents f15ed6a + 691bd79 commit e01df1f

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

homu/html/index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ <h3>Commands</h3>
6666
<li><code>rollup</code>: Mark the PR as likely to merge without issue, short for <code>rollup=always</code></li>
6767
<li><code>rollup-</code>: Unmark the PR as <code>rollup</code>.</li>
6868
<li><code>rollup=maybe|always|iffy|never</code>: Mark the PR as "always", "maybe", "iffy", and "never" rollup-able.</li>
69+
<li><code>squash</code>: Squash all commits into one just before performing the merge.</li>
70+
<li><code>squash-</code>: Do not squash commits before merging.</li>
6971
<li><code>retry</code>: Signal that the PR is not bad, and should be retried by buildbot.</li>
7072
<li><code>try</code>: Request that the PR be tested by buildbot, without accepting it.</li>
7173
<li><code>force</code>: Stop all the builds on the configured builders, and proceed to the next PR.</li>

homu/main.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -921,6 +921,10 @@ def create_merge(state, repo_cfg, branch, logger, git_cfg,
921921
state.title,
922922
state.body)
923923

924+
squash_msg = '{}\n\n{}'.format(
925+
state.title,
926+
state.body)
927+
924928
desc = 'Merge conflict'
925929
comment = (
926930
'This pull request and the master branch diverged in a way that cannot'
@@ -1028,18 +1032,18 @@ def create_merge(state, repo_cfg, branch, logger, git_cfg,
10281032
'merge-base',
10291033
base_sha,
10301034
state.head_sha)).decode('ascii').strip()
1031-
git_editor = os.environ['GIT_EDITOR']
1032-
os.environ['GIT_EDITOR'] = "sed -i '2,/^$/s/^pick\b/s/'"
1035+
utils.logged_call(git_cmd(
1036+
'reset',
1037+
'--soft',
1038+
merge_base_sha))
10331039
utils.logged_call(git_cmd(
10341040
'-c',
10351041
'user.name=' + git_cfg['name'],
10361042
'-c',
10371043
'user.email=' + git_cfg['email'],
1038-
'rebase',
1039-
'-i',
1040-
'--onto',
1041-
merge_base_sha, base_sha))
1042-
os.environ['GIT_EDITOR'] = git_editor
1044+
'commit',
1045+
'-m',
1046+
squash_msg))
10431047
except subprocess.CalledProcessError:
10441048
desc = 'Squashing failed'
10451049
comment = ''

0 commit comments

Comments
 (0)