Skip to content

Comments

Improve addrev and ghmerge tools and their README#59

Closed
DDvO wants to merge 15 commits intoopenssl:masterfrom
DDvO:improve_ghmerge_and_README
Closed

Improve addrev and ghmerge tools and their README#59
DDvO wants to merge 15 commits intoopenssl:masterfrom
DDvO:improve_ghmerge_and_README

Conversation

@DDvO
Copy link
Contributor

@DDvO DDvO commented Feb 11, 2020

Various tweaks to make ghmerge more usable:
* make gcc (rather than clang-3.6) the default for rebuilding
* take the (SSH version of the) repo URL from the database
* print some more (and slightly improve) info what is going on
* show the log of the commits be pushed (after addrev is called)

Extend review-tools/README, making clear that ghmerge calls addrev

BTW, @mattcaswell, thanks for the Committer Instructions I had received by email.
I suggest adapting also these such that it becomes clear that ghmerge uses addrev.
For instance:

Example usage adding PR and reviewer info to the last two commits:
$ addrev -2 --prnum=3711 matt @levitte master..

Example usage adding PR and reviewer info to the last commit and performing a non-merge push:
$ ghmerge --nomerge 3711 matt @levitte 

@DDvO
Copy link
Contributor Author

DDvO commented Feb 11, 2020

I've just added also the following info on (git)addrev in review-tools/README:

The tool accesses databases on www.openssl.org via HTTPS.
The environment variable 'https_proxy' can be used to connect via a proxy.
The transfer may take many seconds, in particular with the '--list' option.

paulidale
paulidale previously approved these changes Feb 11, 2020
Copy link
Contributor

@paulidale paulidale left a comment

Choose a reason for hiding this comment

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

This looks like an improvement.

@levitte
Copy link
Member

levitte commented Feb 11, 2020

While you're tweaking, would it be possible to have $MERGE default to "no"? The mere fact that this script defaults to squashing all commits into one has had me avoid it like the plague.

@paulidale paulidale dismissed their stale review February 11, 2020 23:13

More tweaks

@paulidale
Copy link
Contributor

A strong "yes" to defaulting $MERGE to no.

@DDvO
Copy link
Contributor Author

DDvO commented Feb 12, 2020

While you're tweaking, would it be possible to have $MERGE default to "no"? The mere fact that this script defaults to squashing all commits into one has had me avoid it like the plague.

I was considering that as well but was reluctant because of the name of the tool.
Yet since there is strong consensus on changing the default I've done it now.

@DDvO
Copy link
Contributor Author

DDvO commented Feb 12, 2020

A strong "yes" to defaulting $MERGE to no.

How about changing the name of the tool to ghpush?
This would reflect its semantics better, covering both the merge and rebase case.

@mspncp
Copy link
Contributor

mspncp commented Feb 12, 2020

A strong "yes" to defaulting $MERGE to no.

How about changing the name of the tool to ghpush?
This would reflect its semantics better, covering both the merge and rebase case.

I would leave the name as it is, because the main action is the merging (in the sense of integration) of the pull request into the master branch. That we integrate it linearly without creating an explicit merge commit is more a technical detail IMHO.

@mspncp
Copy link
Contributor

mspncp commented Feb 12, 2020

Essentially, it's a git merge --ff-only.

@mspncp
Copy link
Contributor

mspncp commented Feb 12, 2020

A strong "yes" to defaulting $MERGE to no.

How about changing the name of the tool to ghpush?
This would reflect its semantics better, covering both the merge and rebase case.

I would leave the name as it is, because the main action is the merging (in the sense of integration) of the pull request into the master branch. That we integrate it linearly without creating an explicit merge commit is more a technical detail IMHO.

Looking at it once more, I think it's $MERGE which is misnamed, not ghmerge. I would suggest to name it $SQUASH and let it default to false.

@DDvO
Copy link
Contributor Author

DDvO commented Feb 12, 2020

Looking at it once more, I think it's $MERGE which is misnamed, not ghmerge. I would suggest to name it $SQUASH and let it default to false.

I'm not so sure on this, since in both cases some (auto)squashing is done:
git merge --no-commit --squash $WORK
vs.
git rebase -i --autosquash

@DDvO
Copy link
Contributor Author

DDvO commented Feb 12, 2020

Doing my most recent push using the new version of the tool,
I found it makes more sense to do the git rebase -i --autosquash before addrev is called.
I've changed this and also added an initial git pull on master.

@mspncp
Copy link
Contributor

mspncp commented Feb 12, 2020

Looking at it once more, I think it's $MERGE which is misnamed, not ghmerge. I would suggest to name it $SQUASH and let it default to false.

I'm not so sure on this, since in both cases some (auto)squashing is done:
git merge --no-commit --squash $WORK
vs.
git rebase -i --autosquash

It's a matter of how you view it: If the pull request has seven commits, each of which has several fixups, then the latter does a dumb squash-all-in-a-big-blob, while the former leaves the seven commits intact and only incorparates the fixups. But it's up to you to choose a name which suits you.

Copy link
Contributor

@mspncp mspncp left a comment

Choose a reason for hiding this comment

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

Please reword the commit message of e738545 to add an empty line between 'various tweaks' and the subitems:

    Various tweaks to make ghmerge more usable
	
    - make gcc (rather than clang-3.6) the default for rebuilding
    - take the (SSH version of the) repo URL from the database
    - print some more (and slightly improve) info what is going on
    - show the log of the commits be pushed (after addrev is called)

Otherwise, git will turn the entire paragraph into a boa-constrictor sentence (as you can see in the fixups already). It's sufficient if you do it when you rebase interactively before finally pushing it. (Just replace pick e738545692ec by reword e738545692ec).

@levitte
Copy link
Member

levitte commented Feb 12, 2020

If the pull request has seven commits, each of which has several fixups, then the latter does a dumb squash-all-in-a-big-blob, while the former leaves the seven commits intact and only incorparates the fixups.

... but the other way around. --squash is the "dumb squash-all-in-a-big-blob", while --autosquash "leaves the seven commits intact and only incorparates the fixups."

@mspncp
Copy link
Contributor

mspncp commented Feb 12, 2020

... but the other way around.

Yeah, thanks for noticing. I mixed up the order.

@DDvO DDvO force-pushed the improve_ghmerge_and_README branch from 6d7690f to 9701575 Compare February 12, 2020 15:49
@DDvO
Copy link
Contributor Author

DDvO commented Feb 12, 2020

It's a matter of how you view it: If the pull request has seven commits, each of which has several fixups, then the former does a dumb squash-all-in-a-big-blob, while the latter leaves the seven commits intact and only incorporates the fixups.

[in this quote I've fixed the confusion mentioned above]

I know.

But it's up to you to choose a name which suits you.

All right, so I've kept the variable name MERGE
but renamed the option '-nosquash' to the meanwhile more to-the-point '-autosquash'.

@DDvO
Copy link
Contributor Author

DDvO commented Feb 12, 2020

Please reword the commit message of e738545 to add an empty line between 'various tweaks' and the subitems

Done.

Unfortunately, such a change breaks the autosquash capability of the fixups for this commit because git references the base commit by its title (and not, e.g. by its hash-based ID).

In the future I'll make sure to put an empty line after the first line of multi-line commit messages.

@mspncp
Copy link
Contributor

mspncp commented Feb 12, 2020

git references the base commit by its title (and not, e.g. by its hash-based ID).

GIt does not reference the commit hash by design. Just imagine that git would do that. Then it would have to rewrite the commit messages of all fixups every time you rebase.
Fortunately, it's not such a big deal to reorder and edit the rebase-todo list manually, so an interactive rebase is still feasible :-)

@DDvO
Copy link
Contributor Author

DDvO commented Feb 14, 2020

I've just added --ff-only to the git merge invocations to be on the safe side.

@DDvO DDvO force-pushed the improve_ghmerge_and_README branch from a2e016d to 1f349de Compare February 14, 2020 08:16
@richsalz
Copy link
Contributor

I suggest you avoid aliases, you don't need more than one way to do things.

@DDvO DDvO force-pushed the improve_ghmerge_and_README branch from 06961a3 to 73b0431 Compare February 15, 2020 13:13
@DDvO
Copy link
Contributor Author

DDvO commented Feb 15, 2020

I've meanwhile cleaned up up the (fixup) commits I've done so far.
All comments/requets have been addressed, also the formal change request by @mspncp.

@DDvO
Copy link
Contributor Author

DDvO commented Feb 15, 2020

I've done some further small improvements on ghmerge and its documentation.

I found that sometimes (after some more complex/messed-up commits that interfere with each other) the --autosquash option of interactive rebase re-arranges commits in a way that causes merge conflicts. Therefore I've fixed the cleanup behavior of ghmerge in this case and added the --noautosquash option that leaves out --autosquash on git rebase -i.

DDvO added 3 commits February 17, 2020 09:18
enhance usability of addrev: one may leave out '--prnum=' and just give the PR number
add '--remote' option defaulting to 'origin'; update doc accordingly
update README w.r.t. addrev by including PR numbers in the examples
@DDvO
Copy link
Contributor Author

DDvO commented Feb 17, 2020

I've just added a further option to ghmerge:
using --remote <arg> one can select the git remote of the branch to pull from and push to.
This defaults to 'origin', the hitherto hard-wired value.

@DDvO
Copy link
Contributor Author

DDvO commented Feb 17, 2020

I've also slightly simplified the CLI of addrev:
Instead of --prnum=NNN' one can now simply give NNN`, e.g.:

addrev 1234 -2 steve @richsalz

@DDvO DDvO changed the title Improve tools::review-tools/ghmerge and its doc in README Improve addrev and ghmerge tools and their README Feb 17, 2020
@mspncp
Copy link
Contributor

mspncp commented Feb 17, 2020

This defaults to 'origin', the hitherto hard-wired value.

Why not ask git instead of assuming 'origin'?

$ git remote -v | grep 'github.com/openssl/openssl'
github https://github.com/openssl/openssl.git (fetch)
github https://github.com/openssl/openssl.git (push)

@mspncp
Copy link
Contributor

mspncp commented Feb 17, 2020

Ups, wrong repo :-)

$ git remote -v | grep git.openssl.org
origin git://git.openssl.org/openssl.git (fetch)
origin [email protected]:openssl.git (push)

@mspncp
Copy link
Contributor

mspncp commented Feb 17, 2020

A classical use-case for good'ol awk:

$ git remote -v | awk '/git.openssl.org.*(push)/{ print $1; }'
origin

let the default remote be the first one matching 'git.openssl.org.*(push)'
@DDvO
Copy link
Contributor Author

DDvO commented Feb 20, 2020

$ git remote -v | awk '/git.openssl.org.*(push)/{ print $1; }'
origin

@mspncp, good thought and thanks for the code snippet.
I've just extended it by | head -n 1 for the case that more than just one such remote is listed.
I've updated also the README in this PR accordingly.
Again all your change requests are fulfilled.

@DDvO
Copy link
Contributor Author

DDvO commented Feb 22, 2020

Trying the --squash option of the latest ghmerge on #11134 yesterday revealed that its error handling still deserved some improvements, which in turn motivated a further tweak also on addrev. These are done in the two most recent commits.

@DDvO
Copy link
Contributor Author

DDvO commented Feb 22, 2020

Any further comments or requests for changes?
Else would be nice if this can approved such that it becomes directly usable.

Copy link
Member

@t8m t8m left a comment

Choose a reason for hiding this comment

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

LGTM. But I prefer if someone else who also uses the ghmerge also approves.

Copy link
Contributor

@paulidale paulidale left a comment

Choose a reason for hiding this comment

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

Looks good from here.

@DDvO
Copy link
Contributor Author

DDvO commented Feb 27, 2020

Thanks @t8m and @paulidale for your swift approvals.

Can an OMC member please now do the merge?
You may already take advantage of the new ghmerge to merge itself 😉, e.g., like this:

ghmerge --tools 59 @t8m paulidale

@paulidale
Copy link
Contributor

I've merged it but I don't think I used the new ghmerge. I would have used the new versions of things it calls.

@paulidale paulidale closed this Feb 28, 2020
@t8m
Copy link
Member

t8m commented Feb 28, 2020

I've merged it but I don't think I used the new ghmerge. I would have used the new versions of things it calls.

Well now after this merge the ghmerge is becoming really useful tool.

@DDvO
Copy link
Contributor Author

DDvO commented Feb 28, 2020

Well now after this merge the ghmerge is becoming really useful tool.

Very pleased to hear!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants