dim: Add apply-pull command
PATCH 1/1 dim: Add apply-pull command
I'm getting real lazy, let's start scripting this. Very rough draft, but adds a Link: (patchwork tracks pull requests too, maybe we'll start CI-ing them too), and sob line. In the future we might add more checks here ...
--- dim | 34 ++++++++++++++++++++++++++++++++++ dim.rst | 4 ++++ 2 files changed, 38 insertions(+)
dim +34 -0
@@ -717,6 +717,40 @@ function dim_apply_branch return $rv } +dim_alias_ap=apply-pull +function dim_apply_pull +{ + local branch file message_id pull_branch rv + + branch=${1:?$usage} + shift + file=$(mktemp) + + assert_branch $branch + assert_repo_clean + + cat > $file + + pull_branch=$(sed -e '0,/git repository at:$/d' $file | head -n 2 | tail -n 1) + + echo $pull_branch + + git pull $pull_branch + + message_id=$(message_get_id $file) + + if [ -n "$message_id" ]; then + dim_commit_add_tag "\nLink: http://patchwork.freedesktop.org/patch/msgid/$message_id" + else + echoerr "WARNING: No message-id found in the patch file." + rv=1 + fi + + git commit --amend -s + + return $rv +} + function dim_add_link { local branch file message_id
dim.rst +4 -0
@@ -356,6 +356,10 @@ tag; this must have been done previously using **update-next**. This also means that the pull request can be regenerated with the same commands if something goes wrong. +apply-pull *branch* +------------------- +Reads a pull request mail from stdin and merges it into the given *branch*. + update-next ----------- Pushes out the latest dinq to drm-intel-next and tags it. Also
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 33 lines · Daniel Vetter
I'm getting real lazy, let's start scripting this. Very rough draft, but adds a Link: (patchwork tracks pull requests too, maybe we'll start CI-ing them too), and sob line. In the future we might add more checks here ...
Signed-off-by Daniel Vetter <[email protected]>--- dim | 34 ++++++++++++++++++++++++++++++++++ dim.rst | 4 ++++ 2 files changed, 38 insertions(+)dim +14
-0@@ -717,6 +717,40 @@ function dim_apply_branch return $rv } +dim_alias_ap=apply-pull +function dim_apply_pull +{ + local branch file message_id pull_branch rv + + branch=${1:?$usage} + shift + file=$(mktemp) + + assert_branch $branch + assert_repo_clean + + cat > $file +
dim function dim_apply_branch · line 743
Quoted 10 lines
dim +10
-0+ pull_branch=$(sed -e '0,/git repository at:$/d' $file | head -n 2 | tail -n 1) + + echo $pull_branch + + git pull $pull_branch + + message_id=$(message_get_id $file) + + if [ -n "$message_id" ]; then + dim_commit_add_tag "\nLink: http://patchwork.freedesktop.org/patch/msgid/$message_id"
The \n there doesn't do what you think it does, at least not for me. I end up with "nLink: " in the commit message.
dim function dim_apply_branch · line 749
Quoted 6 lines
dim +6
-0+ else + echoerr "WARNING: No message-id found in the patch file." + rv=1 + fi + + git commit --amend -s
I think the intention is to just add the signoff, but this ends up trying to fire up the editor, which is really not good for piping.
BR,
Jani.
Quoted 22 lines
dim +4
-0+ + return $rv +} + function dim_add_link { local branch file message_iddim.rst +4
-0@@ -356,6 +356,10 @@ tag; this must have been done previously using **update-next**. This also means that the pull request can be regenerated with the same commands if something goes wrong. +apply-pull *branch* +------------------- +Reads a pull request mail from stdin and merges it into the given *branch*. + update-next ----------- Pushes out the latest dinq to drm-intel-next and tags it. Also
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 6 lines · Jani Nikula
Review
Quoted 2 lines
(quoted diff) +2
-0+ + git commit --amend -sI think the intention is to just add the signoff, but this ends up trying to fire up the editor, which is really not good for piping.
You probably want --no-edit for that.
Signature · 5 lines
Gabriel Krisman Bertazi _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 39 lines · Jani Nikula
Quoted 38 lines · Daniel Vetter
I'm getting real lazy, let's start scripting this. Very rough draft, but adds a Link: (patchwork tracks pull requests too, maybe we'll start CI-ing them too), and sob line. In the future we might add more checks here ...
Signed-off-by Daniel Vetter <[email protected]>--- dim | 34 ++++++++++++++++++++++++++++++++++ dim.rst | 4 ++++ 2 files changed, 38 insertions(+)dim +19
-0@@ -717,6 +717,40 @@ function dim_apply_branch return $rv } +dim_alias_ap=apply-pull +function dim_apply_pull +{ + local branch file message_id pull_branch rv + + branch=${1:?$usage} + shift + file=$(mktemp) + + assert_branch $branch + assert_repo_clean + + cat > $file + + pull_branch=$(sed -e '0,/git repository at:$/d' $file | head -n 2 | tail -n 1) + + echo $pull_branch + + git pull $pull_branch
Quoted 8 lines
dim function dim_apply_branch · line 743
Quoted 5 lines
dim +5
-0+ + message_id=$(message_get_id $file) + + if [ -n "$message_id" ]; then + dim_commit_add_tag "\nLink: http://patchwork.freedesktop.org/patch/msgid/$message_id"The \n there doesn't do what you think it does, at least not for me. I end up with "nLink: " in the commit message.
wfm. Any idea what's different on your side? This is supposed to be all bash ...
Quoted 9 lines
dim function dim_apply_branch · line 749
Quoted 6 lines
dim +6
-0+ else + echoerr "WARNING: No message-id found in the patch file." + rv=1 + fi + + git commit --amend -sI think the intention is to just add the signoff, but this ends up trying to fire up the editor, which is really not good for piping.
Well it's my workflow again, I'd like to auto-edit patches after applying, same for pull requests. I guess we could try to add the sob through other means, and then invoke the post commit cmd again?
-Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 49 lines · Daniel Vetter
Quoted 39 lines · Jani Nikula
Quoted 38 lines · Daniel Vetter
I'm getting real lazy, let's start scripting this. Very rough draft, but adds a Link: (patchwork tracks pull requests too, maybe we'll start CI-ing them too), and sob line. In the future we might add more checks here ...
Signed-off-by Daniel Vetter <[email protected]>--- dim | 34 ++++++++++++++++++++++++++++++++++ dim.rst | 4 ++++ 2 files changed, 38 insertions(+)dim +19
-0@@ -717,6 +717,40 @@ function dim_apply_branch return $rv } +dim_alias_ap=apply-pull +function dim_apply_pull +{ + local branch file message_id pull_branch rv + + branch=${1:?$usage} + shift + file=$(mktemp) + + assert_branch $branch + assert_repo_clean + + cat > $file + + pull_branch=$(sed -e '0,/git repository at:$/d' $file | head -n 2 | tail -n 1) + + echo $pull_branch + + git pull $pull_branchQuoted 8 lines
dim function dim_apply_branch · line 743
Quoted 5 lines
dim +5
-0+ + message_id=$(message_get_id $file) + + if [ -n "$message_id" ]; then + dim_commit_add_tag "\nLink: http://patchwork.freedesktop.org/patch/msgid/$message_id"The \n there doesn't do what you think it does, at least not for me. I end up with "nLink: " in the commit message.
Quoted 2 lines
wfm. Any idea what's different on your side? This is supposed to be all bash ...
I didn't intend for this to be used that way anyway, the intention was to add one line, no escapes etc. and that's it... dim_commit_add_tag adds all arguments as "tags", so I think you could do
dim_commit_add_tag "" "Link: http://patchwork.freedesktop.org/patch/msgid/$message_id"
to add an "empty" tag on a line of its own.
BR,
Jani.
Quoted 15 lines
Quoted 10 lines
dim function dim_apply_branch · line 749
Quoted 7 lines
dim +6
-0+ else + echoerr "WARNING: No message-id found in the patch file." + rv=1 + fi + + git commit --amend -sI think the intention is to just add the signoff, but this ends up trying to fire up the editor, which is really not good for piping.
Well it's my workflow again, I'd like to auto-edit patches after applying, same for pull requests. I guess we could try to add the sob through other means, and then invoke the post commit cmd again?
-Daniel
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx