Skip to content
This repository has been archived by the owner on Jan 12, 2019. It is now read-only.

Add an option to accept patches without squashing #287

Closed
wants to merge 3 commits into from
Closed
Changes from 2 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
34 changes: 34 additions & 0 deletions contrib.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@
{ "include": "update {{meta.branches.development}}" },
{ "include": "pull_request accept" }
]
},
"accept-as-is": {
"desc": "Merge a submitted feature without squashing commits",
"steps": [
{ "include": "update {{meta.branches.development}}" },
{ "include": "pull_request accept-as-is" }
]
}
},

Expand Down Expand Up @@ -140,6 +147,13 @@
{ "include": "update {{meta.branches.release}}" },
{ "include": "pull_request accept" }
]
},
"accept-as-is": {
"desc": "Merge a submitted patch without squashing commits",
"steps": [
{ "include": "update {{meta.branches.release}}" },
{ "include": "pull_request accept-as-is" }
]
}
},

Expand Down Expand Up @@ -345,6 +359,26 @@
[ "git push upstream {{pr.base.ref}}", "Push the changes to the main project" ],
[ "git branch -D {{pr.user.login}}-{{pr.head.ref}}", "Delete the local branch used for merging" ]
]
},
"accept-as-is": {
"steps": [
{ "prompt": "text", "id": "prNum", "desc": "What is the the pull request number?" },
{ "get": "{{meta.urls.repo_api}}/pulls/{{prNum}}", "desc": "Get the PR information", "id": "pr" },
{ "get": "{{meta.urls.repo_api}}/pulls/{{prNum}}/commits", "desc": "Get the PR commits to access author info", "id": "prCommits" },
[ "git checkout -b {{pr.user.login}}-{{pr.head.ref}} {{pr.base.ref}}", "Create a new branch for merging the changes" ],
[ "git pull --rebase {{pr.head.repo.ssh_url}}", "Merge and rebase the changes"],
[ "grunt test", "Run tests to make sure they still pass" ],
{ "prompt": "text", "id": "line", "desc": "Describe this change in one line" },
[ "grunt chg-add:'{{line}} ([view](https\\://github.com/{{meta.org}}/{{meta.name}}/pull/{{prNum}}))'", "Add a line to the changelog" ],
[ "git add CHANGELOG.md", "Add the changlelog change to be committed" ],
[ "git commit -a --author='{{prCommits.[0].commit.author.name}} <{{prCommits.[0].commit.author.email}}>' -m '{{line}}. closes #{{prNum}}'", "Commit the changes" ],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you know there's going to be a merge commit, you might be able to do a git commit --amend and add the changelog change and the message to the merge commit, saving an additional commit. Though I'm not exactly sure how you might prepend to the commit message.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly --reedit-message=<commit>. But also how you have it now is perfectly fine.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, it would be nice to piggyback the changelog onto the merge commit.

{ "prompt": "confirm", "desc": "Does everything look ok?" },
[ "git checkout {{pr.base.ref}}", "Check out the base branch" ],
[ "git merge {{pr.user.login}}-{{pr.head.ref}}", "Merge the changes" ],
[ "git push origin {{pr.base.ref}}", "Push the changes to your remote copy of the project" ],
[ "git push upstream {{pr.base.ref}}", "Push the changes to the main project" ],
[ "git branch -D {{pr.user.login}}-{{pr.head.ref}}", "Delete the local branch used for merging" ]
]
}
}
}