diff mbox

[dim,2/2] dim: Add add-link command

Message ID 20170314185014.8635-2-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ville Syrjälä March 14, 2017, 6:50 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Add the "add-link" command so that you can add the Link: tag to
patches that failed to apply directly.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 dim | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

Comments

Jani Nikula March 15, 2017, 9:17 a.m. UTC | #1
On Tue, 14 Mar 2017, ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Add the "add-link" command so that you can add the Link: tag to
> patches that failed to apply directly.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  dim | 39 +++++++++++++++++++++++++++++++++++++++
>  1 file changed, 39 insertions(+)
>
> diff --git a/dim b/dim
> index 4110642b2f4a..b44d087b19ac 100755
> --- a/dim
> +++ b/dim
> @@ -664,6 +664,45 @@ function dim_apply_branch
>  	eval $DRY $DIM_POST_APPLY_ACTION
>  }
>  
> +dim_alias_ll=add-link
> +function dim_add_link
> +{
> +	local branch=$1
> +	shift
> +	local file=`mktemp`

Same complaints about locals as in previous patch.

> +
> +	assert_branch $branch
> +	assert_repo_clean
> +
> +	cat > $file
> +
> +	local message_id=$(message_get_id $file)
> +
> +	if [ -n $message_id ]; then
> +		dim_commit_add_tag "Link: http://patchwork.freedesktop.org/patch/msgid/$message_id"
> +	else
> +		echo "No message-id found in the patch file."

Please use echoerr to print to stderr.

> +	fi
> +}
> +
> +dim_alias_lq=add-link-queued
> +function dim_add_link_queued
> +{
> +	dim_add_link drm-intel-next-queued "$@"
> +}
> +
> +dim_alias_lf=add-link-fixes
> +function dim_add_link_fixes
> +{
> +	dim_add_link drm-intel-fixes "$@"
> +}
> +
> +dim_alias_lnf=add-link-next-fixes
> +function dim_add_link_next_fixes
> +{
> +	dim_add_link drm-intel-next-fixes "$@"
> +}
> +

I'm thinking this one's so rarely used that the aliases are not
needed. Short aliases will make dim bash completion less useful, as the
completion automatically completes all dim commands and aliases.

>  dim_alias_aq=apply-queued
>  function dim_apply_queued
>  {
Jani Nikula March 15, 2017, 9:18 a.m. UTC | #2
On Wed, 15 Mar 2017, Jani Nikula <jani.nikula@linux.intel.com> wrote:
> On Tue, 14 Mar 2017, ville.syrjala@linux.intel.com wrote:
>> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>>
>> Add the "add-link" command so that you can add the Link: tag to
>> patches that failed to apply directly.
>>
>> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
>> ---
>>  dim | 39 +++++++++++++++++++++++++++++++++++++++
>>  1 file changed, 39 insertions(+)
>>
>> diff --git a/dim b/dim
>> index 4110642b2f4a..b44d087b19ac 100755
>> --- a/dim
>> +++ b/dim
>> @@ -664,6 +664,45 @@ function dim_apply_branch
>>  	eval $DRY $DIM_POST_APPLY_ACTION
>>  }
>>  
>> +dim_alias_ll=add-link
>> +function dim_add_link
>> +{
>> +	local branch=$1
>> +	shift
>> +	local file=`mktemp`
>
> Same complaints about locals as in previous patch.
>
>> +
>> +	assert_branch $branch
>> +	assert_repo_clean
>> +
>> +	cat > $file
>> +
>> +	local message_id=$(message_get_id $file)

rm -f $file

>> +
>> +	if [ -n $message_id ]; then
>> +		dim_commit_add_tag "Link: http://patchwork.freedesktop.org/patch/msgid/$message_id"
>> +	else
>> +		echo "No message-id found in the patch file."
>
> Please use echoerr to print to stderr.
>
>> +	fi
>> +}
>> +
>> +dim_alias_lq=add-link-queued
>> +function dim_add_link_queued
>> +{
>> +	dim_add_link drm-intel-next-queued "$@"
>> +}
>> +
>> +dim_alias_lf=add-link-fixes
>> +function dim_add_link_fixes
>> +{
>> +	dim_add_link drm-intel-fixes "$@"
>> +}
>> +
>> +dim_alias_lnf=add-link-next-fixes
>> +function dim_add_link_next_fixes
>> +{
>> +	dim_add_link drm-intel-next-fixes "$@"
>> +}
>> +
>
> I'm thinking this one's so rarely used that the aliases are not
> needed. Short aliases will make dim bash completion less useful, as the
> completion automatically completes all dim commands and aliases.
>
>>  dim_alias_aq=apply-queued
>>  function dim_apply_queued
>>  {
Ville Syrjälä March 15, 2017, 10:53 a.m. UTC | #3
On Wed, Mar 15, 2017 at 11:18:00AM +0200, Jani Nikula wrote:
> On Wed, 15 Mar 2017, Jani Nikula <jani.nikula@linux.intel.com> wrote:
> > On Tue, 14 Mar 2017, ville.syrjala@linux.intel.com wrote:
> >> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >>
> >> Add the "add-link" command so that you can add the Link: tag to
> >> patches that failed to apply directly.
> >>
> >> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >> ---
> >>  dim | 39 +++++++++++++++++++++++++++++++++++++++
> >>  1 file changed, 39 insertions(+)
> >>
> >> diff --git a/dim b/dim
> >> index 4110642b2f4a..b44d087b19ac 100755
> >> --- a/dim
> >> +++ b/dim
> >> @@ -664,6 +664,45 @@ function dim_apply_branch
> >>  	eval $DRY $DIM_POST_APPLY_ACTION
> >>  }
> >>  
> >> +dim_alias_ll=add-link
> >> +function dim_add_link
> >> +{
> >> +	local branch=$1
> >> +	shift
> >> +	local file=`mktemp`
> >
> > Same complaints about locals as in previous patch.
> >
> >> +
> >> +	assert_branch $branch
> >> +	assert_repo_clean
> >> +
> >> +	cat > $file
> >> +
> >> +	local message_id=$(message_get_id $file)
> 
> rm -f $file

Indeed. And looks like it's missing from extract-tags as well.

> 
> >> +
> >> +	if [ -n $message_id ]; then
> >> +		dim_commit_add_tag "Link: http://patchwork.freedesktop.org/patch/msgid/$message_id"
> >> +	else
> >> +		echo "No message-id found in the patch file."
> >
> > Please use echoerr to print to stderr.
> >
> >> +	fi
> >> +}
> >> +
> >> +dim_alias_lq=add-link-queued
> >> +function dim_add_link_queued
> >> +{
> >> +	dim_add_link drm-intel-next-queued "$@"
> >> +}
> >> +
> >> +dim_alias_lf=add-link-fixes
> >> +function dim_add_link_fixes
> >> +{
> >> +	dim_add_link drm-intel-fixes "$@"
> >> +}
> >> +
> >> +dim_alias_lnf=add-link-next-fixes
> >> +function dim_add_link_next_fixes
> >> +{
> >> +	dim_add_link drm-intel-next-fixes "$@"
> >> +}
> >> +
> >
> > I'm thinking this one's so rarely used that the aliases are not
> > needed. Short aliases will make dim bash completion less useful, as the
> > completion automatically completes all dim commands and aliases.

I've not used bash completion for this stuff so far, so the short
commands have been handy. But I can always move it all into my .dimrc.

> >
> >>  dim_alias_aq=apply-queued
> >>  function dim_apply_queued
> >>  {
> 
> -- 
> Jani Nikula, Intel Open Source Technology Center
Jani Nikula March 15, 2017, 11:08 a.m. UTC | #4
On Wed, 15 Mar 2017, Ville Syrjälä <ville.syrjala@linux.intel.com> wrote:
> I've not used bash completion for this stuff so far, so the short
> commands have been handy. But I can always move it all into my .dimrc.

Oh, you should give the bash completions a try! It completes more than
just the subcommands, e.g. 'dim co TAB' completes the branches.

BR,
Jani.
diff mbox

Patch

diff --git a/dim b/dim
index 4110642b2f4a..b44d087b19ac 100755
--- a/dim
+++ b/dim
@@ -664,6 +664,45 @@  function dim_apply_branch
 	eval $DRY $DIM_POST_APPLY_ACTION
 }
 
+dim_alias_ll=add-link
+function dim_add_link
+{
+	local branch=$1
+	shift
+	local file=`mktemp`
+
+	assert_branch $branch
+	assert_repo_clean
+
+	cat > $file
+
+	local message_id=$(message_get_id $file)
+
+	if [ -n $message_id ]; then
+		dim_commit_add_tag "Link: http://patchwork.freedesktop.org/patch/msgid/$message_id"
+	else
+		echo "No message-id found in the patch file."
+	fi
+}
+
+dim_alias_lq=add-link-queued
+function dim_add_link_queued
+{
+	dim_add_link drm-intel-next-queued "$@"
+}
+
+dim_alias_lf=add-link-fixes
+function dim_add_link_fixes
+{
+	dim_add_link drm-intel-fixes "$@"
+}
+
+dim_alias_lnf=add-link-next-fixes
+function dim_add_link_next_fixes
+{
+	dim_add_link drm-intel-next-fixes "$@"
+}
+
 dim_alias_aq=apply-queued
 function dim_apply_queued
 {