[Intel-gfx] [maintainer-tools RFC PATCH 12/17] dim: separate handling of aliases

Daniel Vetter daniel at ffwll.ch
Tue Jan 26 07:56:10 PST 2016


On Tue, Jan 26, 2016 at 04:32:25PM +0200, Jani Nikula wrote:
> ---
>  dim | 50 +++++++++++++++++++++++++++++++++++---------------
>  1 file changed, 35 insertions(+), 15 deletions(-)
> 
> diff --git a/dim b/dim
> index 34f2312be37a..b336c2c7d939 100755
> --- a/dim
> +++ b/dim
> @@ -727,7 +727,27 @@ function assert_branch
>  	fi
>  }
>  
> +# handle aliases
>  case "$subcommand" in
> +	ab|sob) subcmd=apply-branch;;
> +	af)	subcmd=apply-fixes;;
> +	ai)	subcmd=apply-igt;;
> +	anf)	subcmd=apply-next-fixes;;
> +	aq)	subcmd=apply-queued;;
> +	ar)	subcmd=apply-resolved;;
> +	check-patch|cp)	subcmd=checkpatch;;
> +	co)	subcmd=checkout;;
> +	fw)	subcmd=for-each-workdirs;;
> +	mp)	subcmd=magic-patch;;
> +	mrr)	subcmd=magic-rebase-resolve;;
> +	pf)	subcmd=push-fixes;;
> +	pnf)	subcmd=push-next-fixes;;
> +	pq)	subcmd=push-queued;;
> +	ub)	subcmd=update-branches;;
> +	*)	subcmd="$subcommand";;
> +esac

This is a bit unfortunate imo since it separates the aliases from the
functions. Could we do something like:

local af=apply-fixes
right next to the dim_apply_fixes function to group them together again?
Just and idea, haven't tried to make the bash-foo for this work.

Otherwise I really like this, ACK on the entire series/concept.
-Daniel

> +
> +case "$subcmd" in
>  	setup)
>  		dim_setup
>  		;;
> @@ -738,7 +758,7 @@ case "$subcommand" in
>  		git merge origin/drm-intel-fixes
>  		git rerere forget
>  		;;
> -	update-branches|ub)
> +	update-branches)
>  		cd $DIM_PREFIX/$DIM_DRM_INTEL
>  		git fetch $DIM_DRM_INTEL_REMOTE
>  		check_repo_clean $DIM_PREFIX/$DIM_DRM_INTEL Kernel
> @@ -760,7 +780,7 @@ case "$subcommand" in
>  	create-workdir)
>  		dim_create_workdir $1
>  		;;
> -	for-each-workdirs|fw)
> +	for-each-workdirs)
>  		cd $DIM_PREFIX/$DIM_DRM_INTEL
>  		$@
>  		for branch in $dim_branches ; do
> @@ -780,16 +800,16 @@ case "$subcommand" in
>  	push-branch)
>  		dim_push_branch "$@"
>  		;;
> -	push-queued|pq)
> +	push-queued)
>  		dim_push_branch drm-intel-next-queued "$@"
>  		;;
> -	push-next-fixes|pnf)
> +	push-next-fixes)
>  		dim_push_branch drm-intel-next-fixes "$@"
>  		;;
> -	push-fixes|pf)
> +	push-fixes)
>  		dim_push_branch drm-intel-fixes "$@"
>  		;;
> -	checkout|co)
> +	checkout)
>  		dim_checkout "$@"
>  		;;
>  	conq)
> @@ -801,31 +821,31 @@ case "$subcommand" in
>  	conf)
>  		dim_checkout drm-intel-next-fixes
>  		;;
> -	apply-branch|ab|sob)
> +	apply-branch)
>  		dim_apply_branch "$@"
>  		;;
> -	apply-queued|aq)
> +	apply-queued)
>  		dim_apply_branch drm-intel-next-queued "$@"
>  		;;
> -	apply-fixes|af)
> +	apply-fixes)
>  		dim_apply_branch drm-intel-fixes "$@"
>  		;;
> -	apply-next-fixes|anf)
> +	apply-next-fixes)
>  		dim_apply_branch drm-intel-next-fixes "$@"
>  		;;
> -	apply-resolved|ar)
> +	apply-resolved)
>  		make -j 20 && git add -u && git am --resolved
>  		checkpatch_commit HEAD
>  		git commit --amend &
>  		;;
> -	apply-igt|ai)
> +	apply-igt)
>  		cd ~/xorg/intel-gpu-tools/
>  		git am --whitespace=fix -3 -s
>  		;;
> -	magic-patch|mp)
> +	magic-patch)
>  		dim_magic_patch "$@"
>  		;;
> -	magic-rebase-resolve|mrr)
> +	magic-rebase-resolve)
>  		git diff HEAD | patch -p1 -R
>  		cat .git/rebase-merge/patch | dim mp
>  		make -j 20
> @@ -851,7 +871,7 @@ case "$subcommand" in
>  		git log -1 $sha1 "--pretty=format:Fixes: %H (\"%s\")%n" | \
>  			sed -e 's/\([0-f]\{12\}\)[0-f]*/\1/'
>  		;;
> -	checkpatch|check-patch|cp)
> +	checkpatch)
>  		dim_checkpatch $@
>  		;;
>  	cherry-pick)
> -- 
> 2.1.4
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the Intel-gfx mailing list