Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upmerge pull request #281
merge pull request #281
Conversation
|
from #278 |
| // Merge a specific pull request | ||
| // ------- | ||
|
|
||
| this.mergePull = function(pull, message, cb) { |
This comment has been minimized.
This comment has been minimized.
AurelioDeRosa
Jan 24, 2016
Member
Since we're using already an object as the first parameter, instead of using overloading I think it's better to add the optional message as a property of the object. If it isn't defined we can use a default message (e.g. empty string).
| commit_message: message | ||
| }; | ||
|
|
||
| _request('PUT', repoPath + '/pulls/' + pull.number + '/merge', data, function(err, mergeResult, xhr) { |
This comment has been minimized.
This comment has been minimized.
| @@ -272,14 +273,35 @@ describe('Creating new Github.Repository', function() { | |||
| it('should get pull requests on repo', function(done) { | |||
| var repo = github.getRepo('michael', 'github'); | |||
|
|
|||
| repo.getPull(153, function(err) { | |||
| repo.getPull(153, function(err, pull) { | |||
This comment has been minimized.
This comment has been minimized.
AurelioDeRosa
Jan 24, 2016
Member
Can you remove this change and move it into another PR? This is not related to the merge feature.
|
Hi @benjamine. Are you still interested in this PR? |
|
@AurelioDeRosa yes, fixing |
fadd687
to
8e1cb4b
|
@AurelioDeRosa all fixed except for this comment that got lost while rebasing:
the reason why I added |
| var expectedDocUrl = 'https://developer.github.com/v3/pulls/#merge-a-pull-request-merge-button'; | ||
|
|
||
| repo.getPull(153, function(err, pull) { | ||
| repo.mergePull(pull, function(err) { |
This comment has been minimized.
This comment has been minimized.
AurelioDeRosa
Feb 21, 2016
Member
I think we should have a test for the success of the merge of a pull request, not the failure. At the moment the test doesn't verify if the method is working correctly.
This comment has been minimized.
This comment has been minimized.
benjamine
Feb 21, 2016
Author
I agree, but given there's no mocking of the github API, I don't see a way to do merges in a repeatable, parallel-safe, way.
But maybe the test title could be negative then.
This comment has been minimized.
This comment has been minimized.
AurelioDeRosa
Feb 21, 2016
Member
At the moment we're not doing parallel tests anyway, so the idea here is to create a new PR and then merge it.
This comment has been minimized.
This comment has been minimized.
benjamine
Feb 21, 2016
Author
I meant parallel in that any user could be running them, locally, or in travis from their forks.
should this create a random commit to a new branch and merge it (with the potential to get conflicts if other is merged in between)?
This comment has been minimized.
This comment has been minimized.
AurelioDeRosa
Feb 21, 2016
Member
No conflict can happen as the repository used is different at every execution of the tests.
This comment has been minimized.
This comment has been minimized.
|
I see your point @benjamine and it makes perfect sense. However, I know that in that context a user will not care about the change of the original object with an optional |
|
besides side effects, it seems confusing to me, as user, to add a |
8e1cb4b
to
5481366
5481366
to
f41ef25


benjamine commentedJan 20, 2016
adding
repo.mergePulldocs: https://developer.github.com/v3/pulls/#merge-a-pull-request-merge-button
note the unit test isn't really testing a succesful merge (but a failture to merge), given the destructive nature of that action I think that would require mocking of the github API, but that might be a big effort.
ps: this is a pull request to merge pull requests😮