All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dim: Add apply-pull command
@ 2017-03-30 13:30 Daniel Vetter
  2017-04-03 15:17 ` Jani Nikula
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Vetter @ 2017-03-30 13:30 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Daniel Vetter, DRI Development, 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 <daniel.vetter@intel.com>
---
 dim     | 34 ++++++++++++++++++++++++++++++++++
 dim.rst |  4 ++++
 2 files changed, 38 insertions(+)

diff --git a/dim b/dim
index 0903f6c2634d..73c25a195f17 100755
--- a/dim
+++ b/dim
@@ -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
diff --git a/dim.rst b/dim.rst
index aed79ca1d43c..a1c67143d910 100644
--- a/dim.rst
+++ b/dim.rst
@@ -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
-- 
2.11.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] dim: Add apply-pull command
  2017-03-30 13:30 [PATCH] dim: Add apply-pull command Daniel Vetter
@ 2017-04-03 15:17 ` Jani Nikula
  2017-04-03 15:26   ` Gabriel Krisman Bertazi
  2017-04-03 22:05   ` Daniel Vetter
  0 siblings, 2 replies; 5+ messages in thread
From: Jani Nikula @ 2017-04-03 15:17 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Daniel Vetter, DRI Development, Daniel Vetter

On Thu, 30 Mar 2017, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> 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 <daniel.vetter@intel.com>
> ---
>  dim     | 34 ++++++++++++++++++++++++++++++++++
>  dim.rst |  4 ++++
>  2 files changed, 38 insertions(+)
>
> diff --git a/dim b/dim
> index 0903f6c2634d..73c25a195f17 100755
> --- a/dim
> +++ b/dim
> @@ -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"

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.

> +	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.

> +
> +	return $rv
> +}
> +
>  function dim_add_link
>  {
>  	local branch file message_id
> diff --git a/dim.rst b/dim.rst
> index aed79ca1d43c..a1c67143d910 100644
> --- a/dim.rst
> +++ b/dim.rst
> @@ -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

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] dim: Add apply-pull command
  2017-04-03 15:17 ` Jani Nikula
@ 2017-04-03 15:26   ` Gabriel Krisman Bertazi
  2017-04-03 22:05   ` Daniel Vetter
  1 sibling, 0 replies; 5+ messages in thread
From: Gabriel Krisman Bertazi @ 2017-04-03 15:26 UTC (permalink / raw)
  To: Jani Nikula
  Cc: Daniel Vetter, Intel Graphics Development, DRI Development,
	Daniel Vetter

Jani Nikula <jani.nikula@linux.intel.com> writes:

>> +
>> +	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.
>

You probably want --no-edit for that.


-- 
Gabriel Krisman Bertazi
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] dim: Add apply-pull command
  2017-04-03 15:17 ` Jani Nikula
  2017-04-03 15:26   ` Gabriel Krisman Bertazi
@ 2017-04-03 22:05   ` Daniel Vetter
  2017-04-04  8:29     ` Jani Nikula
  1 sibling, 1 reply; 5+ messages in thread
From: Daniel Vetter @ 2017-04-03 22:05 UTC (permalink / raw)
  To: Jani Nikula
  Cc: Daniel Vetter, Intel Graphics Development, DRI Development,
	Daniel Vetter

On Mon, Apr 03, 2017 at 06:17:51PM +0300, Jani Nikula wrote:
> On Thu, 30 Mar 2017, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> > 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 <daniel.vetter@intel.com>
> > ---
> >  dim     | 34 ++++++++++++++++++++++++++++++++++
> >  dim.rst |  4 ++++
> >  2 files changed, 38 insertions(+)
> >
> > diff --git a/dim b/dim
> > index 0903f6c2634d..73c25a195f17 100755
> > --- a/dim
> > +++ b/dim
> > @@ -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"
> 
> 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 ...

> > +	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.

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
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] dim: Add apply-pull command
  2017-04-03 22:05   ` Daniel Vetter
@ 2017-04-04  8:29     ` Jani Nikula
  0 siblings, 0 replies; 5+ messages in thread
From: Jani Nikula @ 2017-04-04  8:29 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Daniel Vetter, Intel Graphics Development, DRI Development,
	Daniel Vetter

On Tue, 04 Apr 2017, Daniel Vetter <daniel@ffwll.ch> wrote:
> On Mon, Apr 03, 2017 at 06:17:51PM +0300, Jani Nikula wrote:
>> On Thu, 30 Mar 2017, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
>> > 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 <daniel.vetter@intel.com>
>> > ---
>> >  dim     | 34 ++++++++++++++++++++++++++++++++++
>> >  dim.rst |  4 ++++
>> >  2 files changed, 38 insertions(+)
>> >
>> > diff --git a/dim b/dim
>> > index 0903f6c2634d..73c25a195f17 100755
>> > --- a/dim
>> > +++ b/dim
>> > @@ -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"
>> 
>> 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 ...

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.



>
>> > +	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.
>
> 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

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-04-04  8:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-30 13:30 [PATCH] dim: Add apply-pull command Daniel Vetter
2017-04-03 15:17 ` Jani Nikula
2017-04-03 15:26   ` Gabriel Krisman Bertazi
2017-04-03 22:05   ` Daniel Vetter
2017-04-04  8:29     ` Jani Nikula

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.