Re: [maintainer-tools PATCH 2/2] dim: Accept patchwork URLs as apply-branch optional argument.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Aug 17, 2017 at 9:18 AM, Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx> wrote:
> On Thu, Aug 17, 2017 at 12:45 AM, Jani Nikula <jani.nikula@xxxxxxxxx> wrote:
>> On Wed, 16 Aug 2017, Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx> wrote:
>>> On Wed, Aug 16, 2017 at 11:13 AM, Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx> wrote:
>>>> Instead of having to manually download mbox from patchwork
>>>> let's make dim to do it directly.
>>>>
>>>> Cc: Daniel Vetter <daniel.vetter@xxxxxxxx>
>>>> Cc: Jani Nikula <jani.nikula@xxxxxxxxx>
>>>> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx>
>>>> ---
>>>>  dim | 18 ++++++++++++++++++
>>>>  1 file changed, 18 insertions(+)
>>>>
>>>> diff --git a/dim b/dim
>>>> index e98d23b24ec0..73b48da7f436 100755
>>>> --- a/dim
>>>> +++ b/dim
>>>> @@ -756,6 +756,16 @@ function dim_push
>>>>         dim_push_branch $(git_current_branch) "$@"
>>>>  }
>>>>
>>>> +function download_mbox
>>>> +{
>>>> +       wget -q --spider ${1}
>>>> +       if [ $? -ne "0" ]; then
>>>> +           echoerr "URL ${1} not found."
>>>> +           exit 1
>>>> +       fi
>>>> +       wget -q ${1} -O $2
>>>> +}
>>>> +
>>>>  # ensure we're on branch $1, and apply patches. the rest of the arguments are
>>>>  # passed to git am.
>>>>  dim_alias_ab=apply-branch
>>>> @@ -772,6 +782,14 @@ function dim_apply_branch
>>>>         assert_repo_clean
>>>>
>>>>         case $1 in
>>>> +               *"patchwork.freedesktop.org"*"mbox")
>>>> +                       download_mbox $1 $file
>>>> +                       shift
>>>> +                       ;;
>>>> +               *"patchwork.freedesktop.org"*)
>>>
>>> Another thing that I'd like to do is to be able to give the patchwork
>>> id directly, but I don't want to mess with the $@ going to git
>>> directly so I'm not sure which way would be better...
>>
>> Personally I prefer using message-id based patchwork references:
>>
>> http://patchwork.freedesktop.org/patch/msgid/20170811113907.6716-1-jani.nikula@xxxxxxxxx
>
> well remembered...
> in the end it gets converted to
> https://patchwork.freedesktop.org/patch/171432/
>
> so we can get
> https://patchwork.freedesktop.org/patch/171432/mbox
>
>>
>>> maybe parse for something like
>>> "pw="*)
>>> download_mbox ${1#pw=} $file
>>> so we could use
>>> dim aq pw=170802
>>>
>>> ?
>>> suggestions?
>>
>> The ways around this are argument parsing in apply-branch or adding
>> another dim subcommand.
>
> Usage: dim apply-branch [apply-branch options] branch [--] [git options]
>
> -i  <patchwork-id>
> -m <Message-id>
> -u <url>
>
> hmm but not sure it goes well with the aliases were we would need to convert
>
> dim aq -m 20170811113907.6716-1-jani.nikula@xxxxxxxxx [git options]
> to
> dim apply-branch -m 20170811113907.6716-1-jani.nikula@xxxxxxxxx
> drm-intel-next-queued [git options]

nevermind... please entirely ignore this..

I solved my own needs with:

dim_pwaq()
{
        if [ -n "$1" ]; then
                curl https://patchwork.freedesktop.org/patch/$1/mbox/
| dim_apply_queued
        else
                echo "Give me a patchwork id"
        fi
}

using as:
$ dim pwaq 172141

>
>>
>> Btw one missing piece is handling series mboxes, which do apply, but
>> only the last commit from an mbox gets all the checks and Link: tags
>> etc.
>
> yeap! well remembered! I suffered from this behaviour already and seen
> other folks also complaining about it.
>
> So, for this should we iterate over patches inside mbox somehow and
> git apply one by one or should we apply and then rebase && amend ?
> not sure how to deal whit this in a cleaner way...

this part is still valid..

>
>>
>>
>> BR,
>> Jani.
>>
>>
>>>
>>>
>>>> +                       download_mbox $1/mbox $file
>>>> +                       shift
>>>> +                       ;;
>>>>                 *".patch" | *".mbox")
>>>>                         cat $1 > $file
>>>>                         shift
>>>> --
>>>> 2.13.2
>>>>
>>>> _______________________________________________
>>>> Intel-gfx mailing list
>>>> Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
>>>> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
>>
>> --
>> Jani Nikula, Intel Open Source Technology Center
>
>
>
> --
> Rodrigo Vivi
> Blog: http://blog.vivi.eng.br



-- 
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux