BLD: update merge script to update on github
State: closed

@jreback @TomAugspurger This adds the ability to checkout a PR, do a small fixup or rebase, and push changes to github. 
I now added it as an additional question whether to update or merge, but can also make to separate scripts of it for convenience.

Labels:
name: Build
description: Library building on various platforms

Comments:
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/15917?src=pr&el=h1) Report
> Merging [#15917](https://codecov.io/gh/pandas-dev/pandas/pull/15917?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/1fbdc23def1cc91280c508ac5b7806ced579b264?src=pr&el=desc) will **increase** coverage by `0.03%`.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/15917/graphs/tree.svg?width=650&height=150&src=pr&token=eZ4WkYLtcO)](https://codecov.io/gh/pandas-dev/pandas/pull/15917?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #15917      +/-   ##
==========================================
+ Coverage   90.96%   90.99%   +0.03%     
==========================================
  Files         145      145              
  Lines       49534    49521      -13     
==========================================
+ Hits        45057    45062       +5     
+ Misses       4477     4459      -18
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.76% <ø> (+0.03%)` | :arrow_up: |
| #single | `40.61% <ø> (-0.02%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/15917?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/types/common.py](https://codecov.io/gh/pandas-dev/pandas/pull/15917?src=pr&el=tree#diff-cGFuZGFzL3R5cGVzL2NvbW1vbi5weQ==) | `93.64% <0%> (-0.3%)` | :arrow_down: |
| [pandas/core/series.py](https://codecov.io/gh/pandas-dev/pandas/pull/15917?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvc2VyaWVzLnB5) | `94.89% <0%> (-0.08%)` | :arrow_down: |
| [pandas/indexes/base.py](https://codecov.io/gh/pandas-dev/pandas/pull/15917?src=pr&el=tree#diff-cGFuZGFzL2luZGV4ZXMvYmFzZS5weQ==) | `96.09% <0%> (-0.06%)` | :arrow_down: |
| [pandas/core/reshape.py](https://codecov.io/gh/pandas-dev/pandas/pull/15917?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvcmVzaGFwZS5weQ==) | `99.27% <0%> (-0.01%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/15917?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.57% <0%> (ø)` | :arrow_up: |
| [pandas/io/pytables.py](https://codecov.io/gh/pandas-dev/pandas/pull/15917?src=pr&el=tree#diff-cGFuZGFzL2lvL3B5dGFibGVzLnB5) | `93.06% <0%> (ø)` | :arrow_up: |
| [pandas/core/sorting.py](https://codecov.io/gh/pandas-dev/pandas/pull/15917?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvc29ydGluZy5weQ==) | `97.81% <0%> (+0.03%)` | :arrow_up: |
| [pandas/types/dtypes.py](https://codecov.io/gh/pandas-dev/pandas/pull/15917?src=pr&el=tree#diff-cGFuZGFzL3R5cGVzL2R0eXBlcy5weQ==) | `95.38% <0%> (+0.04%)` | :arrow_up: |
| [pandas/indexes/multi.py](https://codecov.io/gh/pandas-dev/pandas/pull/15917?src=pr&el=tree#diff-cGFuZGFzL2luZGV4ZXMvbXVsdGkucHk=) | `96.7% <0%> (+0.1%)` | :arrow_up: |
| [pandas/io/parsers.py](https://codecov.io/gh/pandas-dev/pandas/pull/15917?src=pr&el=tree#diff-cGFuZGFzL2lvL3BhcnNlcnMucHk=) | `95.65% <0%> (+0.12%)` | :arrow_up: |
| ... and [2 more](https://codecov.io/gh/pandas-dev/pandas/pull/15917?src=pr&el=tree-more) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/15917?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/15917?src=pr&el=footer). Last update [1fbdc23...a06d0fc](https://codecov.io/gh/pandas-dev/pandas/pull/15917?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
Just to make sure, the goal of this is to allow you to push your local changes back up to the PR branch, correct? And then use the green "Squash and merge" from there?

IIUC the new options are

1. Update the PR (`y`)
2. Merge the PR (maybe with local modifications (`n`)).

Maybe the logic should be flipped on the if / else you added, to be more consistent with how it was (`y` = merge), but not a big deal for me.
Need to remember to update https://github.com/pandas-dev/pandas/wiki/Merging-Commits

Also should have have a section there on commit message format (which I messed up with b070d519c). Can link to http://pandas.pydata.org/pandas-docs/stable/contributing.html#committing-your-code


> Just to make sure, the goal of this is to allow you to push your local changes back up to the PR branch, correct? 

Yes, indeed, that's what I have used it for. I would prefer if we use the github green button more (but we can talk about in the meeting)

For that reason I put the update as 'yes' :), but can also switch or make it a different command ('update-pr.py')
> Also should have have a section there on commit message format (which I messed up with b070d51). 

What is wrong with it?
> What is wrong with it?

Forgot the `DOC` code in the commit message title. Pretty minor :)
@jreback What you mentioned on the hangout about the commit message: as far as I can see, you can edit both commit title and longer commit message. What else do you want to edit?
I just did a test, and it seems like you can edit both the title and the
squashed commit message when using the squash and merge button.

On Fri, Apr 7, 2017 at 11:38 AM, Joris Van den Bossche <
notifications@github.com> wrote:

> @jreback <https://github.com/jreback> What you mentioned on the hangout
> about the commit message: as far as I can see, you can edit both commit
> title and longer commit message. What else do you want to edit?
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <https://github.com/pandas-dev/pandas/pull/15917#issuecomment-292587062>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/ABQHIisNM3wLJXuiOog0nMzFmTTCQPlvks5rtmaLgaJpZM4M1SBd>
> .
>

so the script captures the top-of-the PR, which I *usually* want some of it because its a nice sentence or 2 on what is going on this PR. The button *only* includes the title.

BUT since we have https://github.com/pandas-dev/pandas/blob/master/.github/PULL_REQUEST_TEMPLATE.md, I have to edit this out most of the time (so maybe we should just remove this entirely).
here's what you get if you don't explicity edit things with the scripts. Not picking on you @TomAugspurger I accidently do this too :>

```
commit ba30e3a2e376035549b009079d44ba5ca7a4c48f
Author: alexandercbooth <alexander.c.booth@gmail.com>
Date:   Wed Apr 5 16:47:07 2017 -0500

    BUG: addresses #14855 by fixing color kwarg conflict
    
     - [x] closes #14855    - [x] tests passed   - [x] passes ``git diff
    upstream/master | flake8 --diff``
    
    Author: alexandercbooth <alexander.c.booth@gmail.com>
    
    This patch had conflicts when merged, resolved by
    Committer: Tom Augspurger <tom.w.augspurger@gmail.com>
    
    Closes #14871 from alexandercbooth/fix-color-scatterm-bug and squashes the following commits:
    
    3245f09b9 [alexandercbooth] DOC: moving whatsnew entry to 0.20.0
    8ff5f51f1 [alexandercbooth] BUG: addresses #14855 by fixing color kwarg conflict

```
I understand that copying from the first post into the commit message box is some extra work, but if you typically still need to edit the generated commit message by the script, it does not seem more work?
> I understand that copying from the first post into the commit message box is some extra work, but if you typically still need to edit the generated commit message by the script, it does not seem more work?

what are you suggesting?

I think editing the commit messages if using the script is fine. just noting it.

I use the script because I often need to edit very minor things (like the formatting or something) in the whatsnew. Its just easier to do this right before merge.
> what are you suggesting?

What I said on the meeting: using the merge button. You can still use the script to do minor things (that's the reason I the update part), but instead of merging locally and pushing, pushing to github and directly merging there (which means editing the commit message on github instead of locally the generated one -> and that is what I meant with not much difference in work as both typically needs editing)
@jorisvandenbossche ahh yes I see what you mean now.

ok, then I agree the default should actually be to push back to the user PR with any changes. (default is to do nothing I think).

thanks @jorisvandenbossche let me give this a try!