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

Rodrigo Vivi rodrigo.vivi at gmail.com
Wed Aug 16 18:17:34 UTC 2017


On Wed, Aug 16, 2017 at 11:13 AM, Rodrigo Vivi <rodrigo.vivi at intel.com> wrote:
> Instead of having to manually download mbox from patchwork
> let's make dim to do it directly.
>
> Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
> Cc: Jani Nikula <jani.nikula at intel.com>
> Signed-off-by: Rodrigo Vivi <rodrigo.vivi at intel.com>
> ---
>  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...
maybe parse for something like
"pw="*)
download_mbox ${1#pw=} $file
so we could use
dim aq pw=170802

?
suggestions?


> +                       download_mbox $1/mbox $file
> +                       shift
> +                       ;;
>                 *".patch" | *".mbox")
>                         cat $1 > $file
>                         shift
> --
> 2.13.2
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx



-- 
Rodrigo Vivi
Blog: http://blog.vivi.eng.br


More information about the Intel-gfx mailing list