[Intel-gfx] [PATCH] dim: Add apply-pull command

Daniel Vetter daniel at ffwll.ch
Mon Apr 3 22:05:58 UTC 2017


On Mon, Apr 03, 2017 at 06:17:51PM +0300, Jani Nikula wrote:
> On Thu, 30 Mar 2017, Daniel Vetter <daniel.vetter at 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 at 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


More information about the Intel-gfx mailing list