Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Hi, you can drop Reviewers: Subscribers: Tags: and the text Summary: from the git commit with the following script:
arcfilter () { arc amend git log -1 --pretty=%B | awk '/Reviewers:|Subscribers:/{p=1} /Reviewed By:|Differential Revision:/{p=0} !p && !/^Summary:$/ {sub(/^Summary: /,"");print}' | git commit --amend --date=now -F - }
Reviewed By: is considered important by some people. Please keep the tag. (I have updated my script to use --date=now (setting author date to committer date))
https://reviews.llvm.org/D80978 contains a git pre-push hook to automate this.
I remove all extraneous tags by hand during the review, but I have been using "arc land" as final step so far (slightly against the recommendations, but it is so much more convenient than the equivalent git commands). Is there a way to apply the filter to the arc land step as a convenience?
Sorry, I don't know the answer. I never use "arc land". I do git pull --rebase origin master && last-minute testing && git push origin HEAD:master
You may ask on D80978.
We call out "do not use arc land" in our doc for this reason: https://mlir.llvm.org/getting_started/Contributing/#using-arcanist
If you want to write some Php, we can patch Phabricator though!
I suspect we may also be able change the pre-push hook to automatically change the message instead of rejecting the push.
Any automation would be greatly appreciated. As I stated above, I am very aware that arc land is frowned upon. But... I am a big fan of just running one command rather than a series of git commands in sequence.
Add a function to your bashrc to do it for you?
function arcfilter { git log -1 --pretty=%B | \ sed 's/^Summary://' | \ awk '/Reviewers:|Subscribers:/{p=1} /Reviewed By:|Differential Revision:/{p=0} !p && !/^Summary:$/ {sub(/^Summary: /,"");print}' | \ git commit --amend --date=now -F - } function aart-land { arc patch $1 arcfilter && git pull --rebase origin master && git push origin HEAD:master }
And you should be able to aart-land D82117 :)
I have a similar script to what Mehdi posted and have been using it for months, for both my commits and patched-in commits that I land for people w/o commit access. It is based on branches, not diff-ids, because I also have local branches sometimes. It will loop the rebase because sometimes other commits land between pull and push.
#!/bin/bash set -o pipefail set -e function arcfilter() { git log -1 --pretty=%B | sed 's/^Summary:\s*//' | sed '/^Summary:\s*$/d' | awk '/Reviewers: /{p=1; sub(/Reviewers: .*Differential Revision: /, "")}; /Differential Revision: /{p=0;}; !p' | git commit --amend -F - ; } if [ -z "$1" ]; then echo "Usage: $0 <branch>" exit 1 fi git checkout $1 arcfilter while true; do set -e git checkout master git pull git rebase master $1 set +e git push origin $1:master if [ $? -eq 0 ]; then break fi done set -e git checkout master git branch -D $1
Ah, aart-land, haven't been there in a while!
I am going to keep this script! Thanks for that Mehdi!
Thanks for the extended script. I agree this actually looks very doable :-)
Okay, no more "arc land"s from me!