Re: Script for merging PRs to Mynewt

2017-02-20 Thread Sterling Hughes
Bem Feito - Obrigado!

On 20 Feb 2017, at 13:43, Fabio Utzig wrote:

> Hi Sterling,
>
> Updated with some improvements:
>
> 1) Gets info from github API (original branch, message), requiring only
> the PR number as parameter
> 2) Checks out target local branch
> 3) Concats original message to log
> 4) Extra error checkings
>
> https://gist.github.com/utzig/e582bb2d4cc0128bb01ba5f4b7866711
>
> On Mon, Feb 20, 2017, at 01:22 PM, Sterling Hughes wrote:
>> Hi,
>>
>> For others who are merging PRs from GH, I wanted to share what I was
>> doing:
>>
>> #1 - I have setup the following remotes
>>
>> [~/dev/mynewt/core]$ git remote -v
>> github  https://github.com/apache/incubator-mynewt-core (fetch)
>> github  https://github.com/apache/incubator-mynewt-core (push)
>> origin  g...@github.com:sterlinghughes/incubator-mynewt-core.git (fetch)
>> origin  g...@github.com:sterlinghughes/incubator-mynewt-core.git (push)
>> upstream
>> https://git-wip-us.apache.org/repos/asf/incubator-mynewt-core.git
>> (fetch)
>> upstream
>> https://git-wip-us.apache.org/repos/asf/incubator-mynewt-core.git
>> (push)
>>
>> This contains my working clone (origin), the GitHub mirror (github) and
>> the ASF maintained git repo (upstream.)
>>
>> #2 - I work off origin for my commits and PRs
>>
>> #3 - To merge other people’s PRs, I have the following script:
>>
>> [~/dev/mynewt/core]$ more ~/dev/scripts/merge-pr
>> #!/bin/bash
>>
>> git fetch github pull/$1/head:$2
>> git merge --no-ff -m "This closes #$1" $2
>> git branch -D $2
>> git push upstream develop
>>
>>
>> Which is called like so:
>>
>> [~/dev/mynewt/core]$ merge-pr 178 harden-fs-checks
>>
>> And goes ahead and fetches the remote pull request, and pushes it to
>> upstream develop.  If you want to avoid automatic pushes, comment out
>> the git push upstream develop.
>>
>> Sterling


Script for merging PRs to Mynewt

2017-02-20 Thread Sterling Hughes

Hi,

For others who are merging PRs from GH, I wanted to share what I was 
doing:


#1 - I have setup the following remotes

[~/dev/mynewt/core]$ git remote -v
github  https://github.com/apache/incubator-mynewt-core (fetch)
github  https://github.com/apache/incubator-mynewt-core (push)
origin  g...@github.com:sterlinghughes/incubator-mynewt-core.git (fetch)
origin  g...@github.com:sterlinghughes/incubator-mynewt-core.git (push)
upstream	https://git-wip-us.apache.org/repos/asf/incubator-mynewt-core.git 
(fetch)
upstream	https://git-wip-us.apache.org/repos/asf/incubator-mynewt-core.git 
(push)


This contains my working clone (origin), the GitHub mirror (github) and 
the ASF maintained git repo (upstream.)


#2 - I work off origin for my commits and PRs

#3 - To merge other people’s PRs, I have the following script:

[~/dev/mynewt/core]$ more ~/dev/scripts/merge-pr
#!/bin/bash

git fetch github pull/$1/head:$2
git merge --no-ff -m "This closes #$1" $2
git branch -D $2
git push upstream develop


Which is called like so:

[~/dev/mynewt/core]$ merge-pr 178 harden-fs-checks

And goes ahead and fetches the remote pull request, and pushes it to 
upstream develop.  If you want to avoid automatic pushes, comment out 
the git push upstream develop.


Sterling