All of lore.kernel.org
 help / color / mirror / Atom feed
* [maintainer-tools PATCH v2 00/33] dim: function based subcommand handling
@ 2016-01-28 13:26 Jani Nikula
  2016-01-28 13:26 ` [maintainer-tools PATCH v2 01/33] dim: rename dim_push to dim_push_branch Jani Nikula
                   ` (33 more replies)
  0 siblings, 34 replies; 35+ messages in thread
From: Jani Nikula @ 2016-01-28 13:26 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

This is v2 of [1], with Daniel's concern regarding aliases
addressed. It's much better now.

Patches 1-11 and 15-31 are mostly just mechanical renames or code
movement. They explode the series so big, but I think they're easier to
look at this way.

The real changes are in patches 12-14 and 32-33.

All in all this should make dim more maintainable. It's getting pretty
big for a shell script.

BR,
Jani.


[1] http://mid.gmane.org/cover.1453818220.git.jani.nikula@intel.com


Jani Nikula (33):
  dim: rename dim_push to dim_push_branch
  dim: rename dim_apply to dim_apply_branch
  dim: rename dim_co to dim_checkout
  dim: rename dim_shell_checkpatch to shell_checkpatch
  dim: rename dim_checkpatch to checkpatch_commit
  dim: rename dim_checkrange to dim_checkpatch
  dim: rename setup_dim to dim_setup
  dim: rename create_workdir to dim_create_workdir
  dim: rename update_nightly to dim_rebuild_nightly
  dim: rename magic_patch to dim_magic_patch
  dim: move dim_pull_request parameter check to the function
  dim: separate handling of aliases
  dim: handle subcommands through functions
  dim: add alias command to list aliases
  dim: abstract dim_nightly_forget
  dim: abstract dim_update_branches
  dim: abstract dim_for_each_workdirs
  dim: abstract dim_push_*
  dim: abstract dim_checkout callers
  dim: abstract dim apply* subcommands
  dim: abstract dim_magic_rebase_resolve
  dim: abstract dim_cat_to_fixup
  dim: abstract dim_tc
  dim: abstract dim_fixes
  dim: abstract dim_cherry_pick
  dim: abstract dim_pull_request_*
  dim: abstract dim_update_next
  dim: abstract dim_tag_next
  dim: abstract dim_{create,remove}_branch
  dim: abstract dim_checker
  dim: abstract dim_help
  dim: show usage instead of the man page on unknown subcommands
  dim: add -h option for usage, imrove output on unknown options

 dim     | 738 +++++++++++++++++++++++++++++++++++-----------------------------
 dim.rst |   5 +
 2 files changed, 415 insertions(+), 328 deletions(-)

-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [maintainer-tools PATCH v2 01/33] dim: rename dim_push to dim_push_branch
  2016-01-28 13:26 [maintainer-tools PATCH v2 00/33] dim: function based subcommand handling Jani Nikula
@ 2016-01-28 13:26 ` Jani Nikula
  2016-01-28 13:26 ` [maintainer-tools PATCH v2 02/33] dim: rename dim_apply to dim_apply_branch Jani Nikula
                   ` (32 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: Jani Nikula @ 2016-01-28 13:26 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

Rename to match the subcommand name. Move error checking to the function
too.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 dim | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/dim b/dim
index e08fdffd3d86..faa98114a027 100755
--- a/dim
+++ b/dim
@@ -349,8 +349,13 @@ function update_nightly
 
 # push branch $1, rebuild nightly. the rest of the arguments are passed to git
 # push.
-function dim_push
+function dim_push_branch
 {
+	if [[ "x$1" = "x" ]]; then
+		echo "usage: $0 $subcommand branch"
+		exit 1
+	fi
+
 	branch=$1
 	shift
 
@@ -773,20 +778,16 @@ case "$subcommand" in
 		cat > `cat .fixup_file_path`
 		;;
 	push-branch)
-		if [[ "x$1" = "x" ]]; then
-			echo "usage: $0 $subcommand branch"
-			exit 1
-		fi
-		dim_push "$@"
+		dim_push_branch "$@"
 		;;
 	push-queued|pq)
-		dim_push drm-intel-next-queued "$@"
+		dim_push_branch drm-intel-next-queued "$@"
 		;;
 	push-next-fixes|pnf)
-		dim_push drm-intel-next-fixes "$@"
+		dim_push_branch drm-intel-next-fixes "$@"
 		;;
 	push-fixes|pf)
-		dim_push drm-intel-fixes "$@"
+		dim_push_branch drm-intel-fixes "$@"
 		;;
 	checkout|co)
 		if [[ "x$1" = "x" ]]; then
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [maintainer-tools PATCH v2 02/33] dim: rename dim_apply to dim_apply_branch
  2016-01-28 13:26 [maintainer-tools PATCH v2 00/33] dim: function based subcommand handling Jani Nikula
  2016-01-28 13:26 ` [maintainer-tools PATCH v2 01/33] dim: rename dim_push to dim_push_branch Jani Nikula
@ 2016-01-28 13:26 ` Jani Nikula
  2016-01-28 13:26 ` [maintainer-tools PATCH v2 03/33] dim: rename dim_co to dim_checkout Jani Nikula
                   ` (31 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: Jani Nikula @ 2016-01-28 13:26 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

Rename to match the subcommand name.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 dim | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/dim b/dim
index faa98114a027..aee6e4b87b14 100755
--- a/dim
+++ b/dim
@@ -369,7 +369,7 @@ function dim_push_branch
 
 # ensure we're on branch $1, and apply patches. the rest of the arguments are
 # passed to git am.
-function dim_apply
+function dim_apply_branch
 {
 	local branch=$1
 	shift
@@ -806,16 +806,16 @@ case "$subcommand" in
 		dim_co drm-intel-next-fixes
 		;;
 	apply-branch|ab|sob)
-		dim_apply "$@"
+		dim_apply_branch "$@"
 		;;
 	apply-queued|aq)
-		dim_apply drm-intel-next-queued "$@"
+		dim_apply_branch drm-intel-next-queued "$@"
 		;;
 	apply-fixes|af)
-		dim_apply drm-intel-fixes "$@"
+		dim_apply_branch drm-intel-fixes "$@"
 		;;
 	apply-next-fixes|anf)
-		dim_apply drm-intel-next-fixes "$@"
+		dim_apply_branch drm-intel-next-fixes "$@"
 		;;
 	apply-resolved|ar)
 		make -j 20 && git add -u && git am --resolved
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [maintainer-tools PATCH v2 03/33] dim: rename dim_co to dim_checkout
  2016-01-28 13:26 [maintainer-tools PATCH v2 00/33] dim: function based subcommand handling Jani Nikula
  2016-01-28 13:26 ` [maintainer-tools PATCH v2 01/33] dim: rename dim_push to dim_push_branch Jani Nikula
  2016-01-28 13:26 ` [maintainer-tools PATCH v2 02/33] dim: rename dim_apply to dim_apply_branch Jani Nikula
@ 2016-01-28 13:26 ` Jani Nikula
  2016-01-28 13:26 ` [maintainer-tools PATCH v2 04/33] dim: rename dim_shell_checkpatch to shell_checkpatch Jani Nikula
                   ` (30 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: Jani Nikula @ 2016-01-28 13:26 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

Rename to match the (long) subcommand name. Move error checking to the
function too.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 dim | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/dim b/dim
index aee6e4b87b14..e2d4869fdab0 100755
--- a/dim
+++ b/dim
@@ -440,8 +440,13 @@ function dim_cd
 	cd $path
 }
 
-function dim_co
+function dim_checkout
 {
+	if [[ "x$1" = "x" ]]; then
+		echo "usage: $0 $subcommand branch"
+		exit 1
+	fi
+
 	dim_cd $1
 	if ! git branch | grep $1 > /dev/null ; then
 		git checkout -t $DIM_DRM_INTEL_REMOTE/$1
@@ -744,14 +749,14 @@ case "$subcommand" in
 		check_repo_clean $DIM_PREFIX/$DIM_DRM_INTEL Kernel
 
 		for branch in $dim_branches ; do
-			dim_co $branch
+			dim_checkout $branch
 			if git diff --quiet $DIM_DRM_INTEL_REMOTE/$branch; then
 				$DRY git rebase
 			else
 				$DRY git rebase -i
 			fi
 		done
-		dim_co drm-intel-next
+		dim_checkout drm-intel-next
 		$DRY git reset --hard $DIM_DRM_INTEL_REMOTE/drm-intel-next
 		# TODO: Restore -nightly merge state from the rerere-cache
 		# branch
@@ -790,20 +795,16 @@ case "$subcommand" in
 		dim_push_branch drm-intel-fixes "$@"
 		;;
 	checkout|co)
-		if [[ "x$1" = "x" ]]; then
-			echo "usage: $0 $subcommand branch"
-			exit 1
-		fi
-		dim_co "$@"
+		dim_checkout "$@"
 		;;
 	conq)
-		dim_co drm-intel-next-queued
+		dim_checkout drm-intel-next-queued
 		;;
 	cof)
-		dim_co drm-intel-fixes
+		dim_checkout drm-intel-fixes
 		;;
 	conf)
-		dim_co drm-intel-next-fixes
+		dim_checkout drm-intel-next-fixes
 		;;
 	apply-branch|ab|sob)
 		dim_apply_branch "$@"
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [maintainer-tools PATCH v2 04/33] dim: rename dim_shell_checkpatch to shell_checkpatch
  2016-01-28 13:26 [maintainer-tools PATCH v2 00/33] dim: function based subcommand handling Jani Nikula
                   ` (2 preceding siblings ...)
  2016-01-28 13:26 ` [maintainer-tools PATCH v2 03/33] dim: rename dim_co to dim_checkout Jani Nikula
@ 2016-01-28 13:26 ` Jani Nikula
  2016-01-28 13:26 ` [maintainer-tools PATCH v2 05/33] dim: rename dim_checkpatch to checkpatch_commit Jani Nikula
                   ` (29 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: Jani Nikula @ 2016-01-28 13:26 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

Drop the dim_ prefix as there's no corresponding subcommand.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 dim | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/dim b/dim
index e2d4869fdab0..d26abceb21a6 100755
--- a/dim
+++ b/dim
@@ -386,7 +386,7 @@ function dim_apply_branch
 
 	local message_id=$(message_get_id $file)
 
-	dim_shell_checkpatch "cat $file"
+	shell_checkpatch "cat $file"
 
 	local commiter_email=$(git config --get user.email)
 	local patch_from=$(grep "From:" "$file" | head -1)
@@ -466,7 +466,7 @@ function check_repo_clean
 }
 
 # $1 is the shell command to display the patch/commit
-function dim_shell_checkpatch
+function shell_checkpatch
 {
 	local cmd=$1
 
@@ -483,7 +483,7 @@ function dim_checkpatch
 	local commit=$1
 
 	git --no-pager log --oneline -1 $commit
-	dim_shell_checkpatch "git show $commit --pretty=email"
+	shell_checkpatch "git show $commit --pretty=email"
 }
 
 function dim_checkrange
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [maintainer-tools PATCH v2 05/33] dim: rename dim_checkpatch to checkpatch_commit
  2016-01-28 13:26 [maintainer-tools PATCH v2 00/33] dim: function based subcommand handling Jani Nikula
                   ` (3 preceding siblings ...)
  2016-01-28 13:26 ` [maintainer-tools PATCH v2 04/33] dim: rename dim_shell_checkpatch to shell_checkpatch Jani Nikula
@ 2016-01-28 13:26 ` Jani Nikula
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 06/33] dim: rename dim_checkrange to dim_checkpatch Jani Nikula
                   ` (28 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: Jani Nikula @ 2016-01-28 13:26 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

Rename as there's no corresponding subcommand (the check-patch
subcommand does a slightly different thing).

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 dim | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/dim b/dim
index d26abceb21a6..8865778a34f5 100755
--- a/dim
+++ b/dim
@@ -478,7 +478,7 @@ function shell_checkpatch
 }
 
 # $1 is the git sha1 to check
-function dim_checkpatch
+function checkpatch_commit
 {
 	local commit=$1
 
@@ -499,7 +499,7 @@ function dim_checkrange
 	fi
 
 	for commit in $(git rev-list --reverse $range); do
-		dim_checkpatch $commit || true
+		checkpatch_commit $commit || true
 	done
 }
 
@@ -820,7 +820,7 @@ case "$subcommand" in
 		;;
 	apply-resolved|ar)
 		make -j 20 && git add -u && git am --resolved
-		dim_checkpatch HEAD
+		checkpatch_commit HEAD
 		git commit --amend &
 		;;
 	apply-igt|ai)
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [maintainer-tools PATCH v2 06/33] dim: rename dim_checkrange to dim_checkpatch
  2016-01-28 13:26 [maintainer-tools PATCH v2 00/33] dim: function based subcommand handling Jani Nikula
                   ` (4 preceding siblings ...)
  2016-01-28 13:26 ` [maintainer-tools PATCH v2 05/33] dim: rename dim_checkpatch to checkpatch_commit Jani Nikula
@ 2016-01-28 13:27 ` Jani Nikula
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 07/33] dim: rename setup_dim to dim_setup Jani Nikula
                   ` (27 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: Jani Nikula @ 2016-01-28 13:27 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

Rename to match the subcommand. Also add checkpatch subcommand (without
the hyphen) to match the spelling of the tool.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 dim | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/dim b/dim
index 8865778a34f5..f8da41d71bc1 100755
--- a/dim
+++ b/dim
@@ -486,7 +486,7 @@ function checkpatch_commit
 	shell_checkpatch "git show $commit --pretty=email"
 }
 
-function dim_checkrange
+function dim_checkpatch
 {
 	local range
 
@@ -856,8 +856,8 @@ case "$subcommand" in
 		git log -1 $sha1 "--pretty=format:Fixes: %H (\"%s\")%n" | \
 			sed -e 's/\([0-f]\{12\}\)[0-f]*/\1/'
 		;;
-	check-patch|cp)
-		dim_checkrange $@
+	checkpatch|check-patch|cp)
+		dim_checkpatch $@
 		;;
 	cherry-pick)
 		if [[ "x$1" = "x" ]]; then
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [maintainer-tools PATCH v2 07/33] dim: rename setup_dim to dim_setup
  2016-01-28 13:26 [maintainer-tools PATCH v2 00/33] dim: function based subcommand handling Jani Nikula
                   ` (5 preceding siblings ...)
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 06/33] dim: rename dim_checkrange to dim_checkpatch Jani Nikula
@ 2016-01-28 13:27 ` Jani Nikula
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 08/33] dim: rename create_workdir to dim_create_workdir Jani Nikula
                   ` (26 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: Jani Nikula @ 2016-01-28 13:27 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

Rename to match the subcommand.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 dim | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dim b/dim
index f8da41d71bc1..5d06918f207e 100755
--- a/dim
+++ b/dim
@@ -625,7 +625,7 @@ function dim_pull_request
 		"$addr_drm_maintainer"
 }
 
-function setup_dim
+function dim_setup
 {
 	if [ ! -d $DIM_PREFIX ]; then
 		echo "please set up your repository directory with:"
@@ -734,7 +734,7 @@ function assert_branch
 
 case "$subcommand" in
 	setup)
-		setup_dim
+		dim_setup
 		;;
 	nightly-forget)
 		cd $DIM_PREFIX/drm-intel-nightly
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [maintainer-tools PATCH v2 08/33] dim: rename create_workdir to dim_create_workdir
  2016-01-28 13:26 [maintainer-tools PATCH v2 00/33] dim: function based subcommand handling Jani Nikula
                   ` (6 preceding siblings ...)
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 07/33] dim: rename setup_dim to dim_setup Jani Nikula
@ 2016-01-28 13:27 ` Jani Nikula
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 09/33] dim: rename update_nightly to dim_rebuild_nightly Jani Nikula
                   ` (25 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: Jani Nikula @ 2016-01-28 13:27 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

Add dim_ prefix to functions corresponding to subcommands.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 dim | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dim b/dim
index 5d06918f207e..6f209e360391 100755
--- a/dim
+++ b/dim
@@ -555,7 +555,7 @@ function prep_pull_mail
 	prep_pull_mail_signature >> ~/tmp/dim-pull-request
 }
 
-function create_workdir
+function dim_create_workdir
 {
 	cd $DIM_PREFIX
 	local branches
@@ -763,7 +763,7 @@ case "$subcommand" in
 		update_rerere_cache
 		;;
 	create-workdir)
-		create_workdir $1
+		dim_create_workdir $1
 		;;
 	for-each-workdirs|fw)
 		cd $DIM_PREFIX/$DIM_DRM_INTEL
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [maintainer-tools PATCH v2 09/33] dim: rename update_nightly to dim_rebuild_nightly
  2016-01-28 13:26 [maintainer-tools PATCH v2 00/33] dim: function based subcommand handling Jani Nikula
                   ` (7 preceding siblings ...)
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 08/33] dim: rename create_workdir to dim_create_workdir Jani Nikula
@ 2016-01-28 13:27 ` Jani Nikula
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 10/33] dim: rename magic_patch to dim_magic_patch Jani Nikula
                   ` (24 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: Jani Nikula @ 2016-01-28 13:27 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

Rename to match the subcommand name.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 dim | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/dim b/dim
index 6f209e360391..fa6e896aaf46 100755
--- a/dim
+++ b/dim
@@ -234,7 +234,7 @@ function update_rerere_cache
 	cd -
 }
 
-function update_nightly
+function dim_rebuild_nightly
 {
 	local integration_branch=drm-intel-nightly
 	local specfile=`mktemp`
@@ -363,7 +363,7 @@ function dim_push_branch
 
 	git push $DRY_RUN $DIM_DRM_INTEL_REMOTE $branch "$@"
 
-	update_nightly
+	dim_rebuild_nightly
 	update_linux_next
 }
 
@@ -776,7 +776,7 @@ case "$subcommand" in
 		done
 		;;
 	rebuild-nightly)
-		update_nightly
+		dim_rebuild_nightly
 		;;
 	cat-to-fixup)
 		cd $DIM_PREFIX/drm-intel-nightly
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [maintainer-tools PATCH v2 10/33] dim: rename magic_patch to dim_magic_patch
  2016-01-28 13:26 [maintainer-tools PATCH v2 00/33] dim: function based subcommand handling Jani Nikula
                   ` (8 preceding siblings ...)
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 09/33] dim: rename update_nightly to dim_rebuild_nightly Jani Nikula
@ 2016-01-28 13:27 ` Jani Nikula
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 11/33] dim: move dim_pull_request parameter check to the function Jani Nikula
                   ` (23 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: Jani Nikula @ 2016-01-28 13:27 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

Add dim_ prefix to functions corresponding to subcommands.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 dim | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dim b/dim
index fa6e896aaf46..a2c0d74c37e8 100755
--- a/dim
+++ b/dim
@@ -406,7 +406,7 @@ function dim_apply_branch
 	eval $DRY $DIM_POST_APPLY_ACTION
 }
 
-function magic_patch
+function dim_magic_patch
 {
 	if [[ "$1" = "-a" ]]; then
 		cd `cat ~/.dim-last-path`
@@ -828,7 +828,7 @@ case "$subcommand" in
 		git am --whitespace=fix -3 -s
 		;;
 	magic-patch|mp)
-		magic_patch "$@"
+		dim_magic_patch "$@"
 		;;
 	magic-rebase-resolve|mrr)
 		git diff HEAD | patch -p1 -R
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [maintainer-tools PATCH v2 11/33] dim: move dim_pull_request parameter check to the function
  2016-01-28 13:26 [maintainer-tools PATCH v2 00/33] dim: function based subcommand handling Jani Nikula
                   ` (9 preceding siblings ...)
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 10/33] dim: rename magic_patch to dim_magic_patch Jani Nikula
@ 2016-01-28 13:27 ` Jani Nikula
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 12/33] dim: separate handling of aliases Jani Nikula
                   ` (22 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: Jani Nikula @ 2016-01-28 13:27 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

More abstraction is better, also guards against invalid internal use.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 dim | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/dim b/dim
index a2c0d74c37e8..5833306e35c5 100755
--- a/dim
+++ b/dim
@@ -591,6 +591,11 @@ function dim_create_workdir
 # dim_pull_request branch upstream
 function dim_pull_request
 {
+	if [[ "x$1" = "x" || "x$2" = "x" ]]; then
+		echo "usage: $0 $subcommand branch upstream"
+		exit 1
+	fi
+
 	branch=$1
 	upstream=$2
 
@@ -874,10 +879,6 @@ case "$subcommand" in
 		$DRY git cherry-pick $1
 		;;
 	pull-request)
-		if [[ "x$1" = "x" || "x$2" = "x" ]]; then
-			echo "usage: $0 $subcommand branch upstream"
-			exit 1
-		fi
 		dim_pull_request $*
 		;;
 	pull-request-next)
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [maintainer-tools PATCH v2 12/33] dim: separate handling of aliases
  2016-01-28 13:26 [maintainer-tools PATCH v2 00/33] dim: function based subcommand handling Jani Nikula
                   ` (10 preceding siblings ...)
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 11/33] dim: move dim_pull_request parameter check to the function Jani Nikula
@ 2016-01-28 13:27 ` Jani Nikula
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 13/33] dim: handle subcommands through functions Jani Nikula
                   ` (21 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: Jani Nikula @ 2016-01-28 13:27 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

Allow specifying dim subcommand aliases using variables of the format
dim_alias_<ALIAS>. The value of the variable should be the name of the
actual subcommand. The user can specify aliases in the dimrc.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 dim | 56 ++++++++++++++++++++++++++++++++++++++++----------------
 1 file changed, 40 insertions(+), 16 deletions(-)

diff --git a/dim b/dim
index 5833306e35c5..2c8b9e6f8fea 100755
--- a/dim
+++ b/dim
@@ -369,6 +369,8 @@ function dim_push_branch
 
 # ensure we're on branch $1, and apply patches. the rest of the arguments are
 # passed to git am.
+dim_alias_ab=apply-branch
+dim_alias_sob=apply-branch
 function dim_apply_branch
 {
 	local branch=$1
@@ -406,6 +408,7 @@ function dim_apply_branch
 	eval $DRY $DIM_POST_APPLY_ACTION
 }
 
+dim_alias_mp=magic-patch
 function dim_magic_patch
 {
 	if [[ "$1" = "-a" ]]; then
@@ -440,6 +443,7 @@ function dim_cd
 	cd $path
 }
 
+dim_alias_co=checkout
 function dim_checkout
 {
 	if [[ "x$1" = "x" ]]; then
@@ -486,6 +490,8 @@ function checkpatch_commit
 	shell_checkpatch "git show $commit --pretty=email"
 }
 
+dim_alias_check_patch=checkpatch
+dim_alias_cp=checkpatch
 function dim_checkpatch
 {
 	local range
@@ -737,7 +743,25 @@ function assert_branch
 	fi
 }
 
-case "$subcommand" in
+# dim subcommand aliases
+dim_alias_af=apply-fixes
+dim_alias_ai=apply-igt
+dim_alias_anf=apply-next-fixes
+dim_alias_aq=apply-queued
+dim_alias_ar=apply-resolved
+dim_alias_fw=for-each-workdirs
+dim_alias_mrr=magic-rebase-resolve
+dim_alias_pf=push-fixes
+dim_alias_pnf=push-next-fixes
+dim_alias_pq=push-queued
+dim_alias_ub=update-branches
+
+declare -n subcmd=dim_alias_${subcommand//-/_}
+if [ -z "$subcmd" ]; then
+	subcmd="$subcommand"
+fi
+
+case "$subcmd" in
 	setup)
 		dim_setup
 		;;
@@ -748,7 +772,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
@@ -770,7 +794,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
@@ -790,16 +814,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)
@@ -811,31 +835,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
@@ -861,7 +885,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

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [maintainer-tools PATCH v2 13/33] dim: handle subcommands through functions
  2016-01-28 13:26 [maintainer-tools PATCH v2 00/33] dim: function based subcommand handling Jani Nikula
                   ` (11 preceding siblings ...)
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 12/33] dim: separate handling of aliases Jani Nikula
@ 2016-01-28 13:27 ` Jani Nikula
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 14/33] dim: add alias command to list aliases Jani Nikula
                   ` (20 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: Jani Nikula @ 2016-01-28 13:27 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

If there's a dim_ prefixed function matching the subcommand, call it to
handle the subcommand without going through the big switch case.

Drop the cases which already match the convention. Once all the cases
are converted to functions, the handling of subcommands becomes much
cleaner.

This also allows extending of dim by the user via functions declared
outside of dim. The current aliases could also be made the user's
responsibility to define as the user wishes (the user could define dim_
prefixed functions in the dimrc).

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 dim | 36 +++++++++---------------------------
 1 file changed, 9 insertions(+), 27 deletions(-)

diff --git a/dim b/dim
index 2c8b9e6f8fea..98b090eadf33 100755
--- a/dim
+++ b/dim
@@ -761,10 +761,16 @@ if [ -z "$subcmd" ]; then
 	subcmd="$subcommand"
 fi
 
+# if there's a function by the subcommand name, call it
+subcmd_func=dim_${subcmd//-/_}
+if declare -f $subcmd_func >/dev/null; then
+	$subcmd_func "$@"
+	exit 0
+fi
+
+# XXX: abscract each case to a dim_ prefixed function, and turn the help|*) case
+# into an else branch in the above check for functions.
 case "$subcmd" in
-	setup)
-		dim_setup
-		;;
 	nightly-forget)
 		cd $DIM_PREFIX/drm-intel-nightly
 		git fetch origin >& /dev/null
@@ -791,9 +797,6 @@ case "$subcmd" in
 		# branch
 		update_rerere_cache
 		;;
-	create-workdir)
-		dim_create_workdir $1
-		;;
 	for-each-workdirs)
 		cd $DIM_PREFIX/$DIM_DRM_INTEL
 		$@
@@ -804,16 +807,10 @@ case "$subcmd" in
 			fi
 		done
 		;;
-	rebuild-nightly)
-		dim_rebuild_nightly
-		;;
 	cat-to-fixup)
 		cd $DIM_PREFIX/drm-intel-nightly
 		cat > `cat .fixup_file_path`
 		;;
-	push-branch)
-		dim_push_branch "$@"
-		;;
 	push-queued)
 		dim_push_branch drm-intel-next-queued "$@"
 		;;
@@ -823,9 +820,6 @@ case "$subcmd" in
 	push-fixes)
 		dim_push_branch drm-intel-fixes "$@"
 		;;
-	checkout)
-		dim_checkout "$@"
-		;;
 	conq)
 		dim_checkout drm-intel-next-queued
 		;;
@@ -835,9 +829,6 @@ case "$subcmd" in
 	conf)
 		dim_checkout drm-intel-next-fixes
 		;;
-	apply-branch)
-		dim_apply_branch "$@"
-		;;
 	apply-queued)
 		dim_apply_branch drm-intel-next-queued "$@"
 		;;
@@ -856,9 +847,6 @@ case "$subcmd" in
 		cd ~/xorg/intel-gpu-tools/
 		git am --whitespace=fix -3 -s
 		;;
-	magic-patch)
-		dim_magic_patch "$@"
-		;;
 	magic-rebase-resolve)
 		git diff HEAD | patch -p1 -R
 		cat .git/rebase-merge/patch | dim mp
@@ -885,9 +873,6 @@ case "$subcmd" in
 		git log -1 $sha1 "--pretty=format:Fixes: %H (\"%s\")%n" | \
 			sed -e 's/\([0-f]\{12\}\)[0-f]*/\1/'
 		;;
-	checkpatch)
-		dim_checkpatch $@
-		;;
 	cherry-pick)
 		if [[ "x$1" = "x" ]]; then
 			echo "usage: $0 $subcommand commit-ish"
@@ -902,9 +887,6 @@ case "$subcmd" in
 		git log --grep=$sha_short --pretty=oneline $sha..$DIM_DRM_INTEL_REMOTE/drm-intel-nightly
 		$DRY git cherry-pick $1
 		;;
-	pull-request)
-		dim_pull_request $*
-		;;
 	pull-request-next)
 		upstream=${1:-$DIM_DRM_UPSTREAM_REMOTE/drm-next}
 		dim_pull_request drm-intel-next $upstream
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [maintainer-tools PATCH v2 14/33] dim: add alias command to list aliases
  2016-01-28 13:26 [maintainer-tools PATCH v2 00/33] dim: function based subcommand handling Jani Nikula
                   ` (12 preceding siblings ...)
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 13/33] dim: handle subcommands through functions Jani Nikula
@ 2016-01-28 13:27 ` Jani Nikula
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 15/33] dim: abstract dim_nightly_forget Jani Nikula
                   ` (19 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: Jani Nikula @ 2016-01-28 13:27 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

Helpful convenience.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 dim     | 7 +++++++
 dim.rst | 5 +++++
 2 files changed, 12 insertions(+)

diff --git a/dim b/dim
index 98b090eadf33..651ee5882ca3 100755
--- a/dim
+++ b/dim
@@ -743,6 +743,13 @@ function assert_branch
 	fi
 }
 
+function dim_alias
+{
+	# use posix mode to omit functions in set output
+	( set -o posix; set ) | grep "^dim_alias_[a-zA-Z0-9_]*=" |\
+		sed 's/^dim_alias_/\t/;s/=/\t/'
+}
+
 # dim subcommand aliases
 dim_alias_af=apply-fixes
 dim_alias_ai=apply-igt
diff --git a/dim.rst b/dim.rst
index 7b8930269aa8..61bec7f29731 100644
--- a/dim.rst
+++ b/dim.rst
@@ -273,6 +273,11 @@ for-each-workdir|fw *command*
 Run the given command in all active workdirs including the main repository under
 \$DIM_DRM_INTEL.
 
+alias
+-----
+
+List all aliases for the subcommand names.
+
 help
 ----
 Show this help. Install **rst2man(1)** for best results.
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [maintainer-tools PATCH v2 15/33] dim: abstract dim_nightly_forget
  2016-01-28 13:26 [maintainer-tools PATCH v2 00/33] dim: function based subcommand handling Jani Nikula
                   ` (13 preceding siblings ...)
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 14/33] dim: add alias command to list aliases Jani Nikula
@ 2016-01-28 13:27 ` Jani Nikula
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 16/33] dim: abstract dim_update_branches Jani Nikula
                   ` (18 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: Jani Nikula @ 2016-01-28 13:27 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 dim | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/dim b/dim
index 651ee5882ca3..c8daacfdf9f4 100755
--- a/dim
+++ b/dim
@@ -347,6 +347,15 @@ function dim_rebuild_nightly
 
 }
 
+function dim_nightly_forget
+{
+	cd $DIM_PREFIX/drm-intel-nightly
+	git fetch origin >& /dev/null
+	git reset --hard origin/drm-intel-next-queued >& /dev/null
+	git merge origin/drm-intel-fixes
+	git rerere forget
+}
+
 # push branch $1, rebuild nightly. the rest of the arguments are passed to git
 # push.
 function dim_push_branch
@@ -778,13 +787,6 @@ fi
 # XXX: abscract each case to a dim_ prefixed function, and turn the help|*) case
 # into an else branch in the above check for functions.
 case "$subcmd" in
-	nightly-forget)
-		cd $DIM_PREFIX/drm-intel-nightly
-		git fetch origin >& /dev/null
-		git reset --hard origin/drm-intel-next-queued >& /dev/null
-		git merge origin/drm-intel-fixes
-		git rerere forget
-		;;
 	update-branches)
 		cd $DIM_PREFIX/$DIM_DRM_INTEL
 		git fetch $DIM_DRM_INTEL_REMOTE
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [maintainer-tools PATCH v2 16/33] dim: abstract dim_update_branches
  2016-01-28 13:26 [maintainer-tools PATCH v2 00/33] dim: function based subcommand handling Jani Nikula
                   ` (14 preceding siblings ...)
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 15/33] dim: abstract dim_nightly_forget Jani Nikula
@ 2016-01-28 13:27 ` Jani Nikula
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 17/33] dim: abstract dim_for_each_workdirs Jani Nikula
                   ` (17 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: Jani Nikula @ 2016-01-28 13:27 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 dim | 42 ++++++++++++++++++++++--------------------
 1 file changed, 22 insertions(+), 20 deletions(-)

diff --git a/dim b/dim
index c8daacfdf9f4..fd61ce5a7f49 100755
--- a/dim
+++ b/dim
@@ -645,6 +645,28 @@ function dim_pull_request
 		"$addr_drm_maintainer"
 }
 
+dim_alias_ub=update-branches
+function dim_update_branches
+{
+	cd $DIM_PREFIX/$DIM_DRM_INTEL
+	git fetch $DIM_DRM_INTEL_REMOTE
+	check_repo_clean $DIM_PREFIX/$DIM_DRM_INTEL Kernel
+
+	for branch in $dim_branches ; do
+		dim_checkout $branch
+		if git diff --quiet $DIM_DRM_INTEL_REMOTE/$branch; then
+			$DRY git rebase
+		else
+			$DRY git rebase -i
+		fi
+	done
+	dim_checkout drm-intel-next
+	$DRY git reset --hard $DIM_DRM_INTEL_REMOTE/drm-intel-next
+	# TODO: Restore -nightly merge state from the rerere-cache
+	# branch
+	update_rerere_cache
+}
+
 function dim_setup
 {
 	if [ ! -d $DIM_PREFIX ]; then
@@ -770,7 +792,6 @@ dim_alias_mrr=magic-rebase-resolve
 dim_alias_pf=push-fixes
 dim_alias_pnf=push-next-fixes
 dim_alias_pq=push-queued
-dim_alias_ub=update-branches
 
 declare -n subcmd=dim_alias_${subcommand//-/_}
 if [ -z "$subcmd" ]; then
@@ -787,25 +808,6 @@ fi
 # XXX: abscract each case to a dim_ prefixed function, and turn the help|*) case
 # into an else branch in the above check for functions.
 case "$subcmd" in
-	update-branches)
-		cd $DIM_PREFIX/$DIM_DRM_INTEL
-		git fetch $DIM_DRM_INTEL_REMOTE
-		check_repo_clean $DIM_PREFIX/$DIM_DRM_INTEL Kernel
-
-		for branch in $dim_branches ; do
-			dim_checkout $branch
-			if git diff --quiet $DIM_DRM_INTEL_REMOTE/$branch; then
-				$DRY git rebase
-			else
-				$DRY git rebase -i
-			fi
-		done
-		dim_checkout drm-intel-next
-		$DRY git reset --hard $DIM_DRM_INTEL_REMOTE/drm-intel-next
-		# TODO: Restore -nightly merge state from the rerere-cache
-		# branch
-		update_rerere_cache
-		;;
 	for-each-workdirs)
 		cd $DIM_PREFIX/$DIM_DRM_INTEL
 		$@
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [maintainer-tools PATCH v2 17/33] dim: abstract dim_for_each_workdirs
  2016-01-28 13:26 [maintainer-tools PATCH v2 00/33] dim: function based subcommand handling Jani Nikula
                   ` (15 preceding siblings ...)
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 16/33] dim: abstract dim_update_branches Jani Nikula
@ 2016-01-28 13:27 ` Jani Nikula
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 18/33] dim: abstract dim_push_* Jani Nikula
                   ` (16 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: Jani Nikula @ 2016-01-28 13:27 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 dim | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/dim b/dim
index fd61ce5a7f49..d887a9afc426 100755
--- a/dim
+++ b/dim
@@ -603,6 +603,19 @@ function dim_create_workdir
 	done
 }
 
+dim_alias_fw=for-each-workdirs
+function dim_for_each_workdirs
+{
+	cd $DIM_PREFIX/$DIM_DRM_INTEL
+	$@
+	for branch in $dim_branches ; do
+		if [[ -d $DIM_PREFIX/$branch ]] ; then
+			cd $DIM_PREFIX/$branch
+			$@
+		fi
+	done
+}
+
 # dim_pull_request branch upstream
 function dim_pull_request
 {
@@ -787,7 +800,6 @@ dim_alias_ai=apply-igt
 dim_alias_anf=apply-next-fixes
 dim_alias_aq=apply-queued
 dim_alias_ar=apply-resolved
-dim_alias_fw=for-each-workdirs
 dim_alias_mrr=magic-rebase-resolve
 dim_alias_pf=push-fixes
 dim_alias_pnf=push-next-fixes
@@ -808,16 +820,6 @@ fi
 # XXX: abscract each case to a dim_ prefixed function, and turn the help|*) case
 # into an else branch in the above check for functions.
 case "$subcmd" in
-	for-each-workdirs)
-		cd $DIM_PREFIX/$DIM_DRM_INTEL
-		$@
-		for branch in $dim_branches ; do
-			if [[ -d $DIM_PREFIX/$branch ]] ; then
-				cd $DIM_PREFIX/$branch
-				$@
-			fi
-		done
-		;;
 	cat-to-fixup)
 		cd $DIM_PREFIX/drm-intel-nightly
 		cat > `cat .fixup_file_path`
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [maintainer-tools PATCH v2 18/33] dim: abstract dim_push_*
  2016-01-28 13:26 [maintainer-tools PATCH v2 00/33] dim: function based subcommand handling Jani Nikula
                   ` (16 preceding siblings ...)
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 17/33] dim: abstract dim_for_each_workdirs Jani Nikula
@ 2016-01-28 13:27 ` Jani Nikula
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 19/33] dim: abstract dim_checkout callers Jani Nikula
                   ` (15 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: Jani Nikula @ 2016-01-28 13:27 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 dim | 30 ++++++++++++++++++------------
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git a/dim b/dim
index d887a9afc426..07ef5d70db1e 100755
--- a/dim
+++ b/dim
@@ -376,6 +376,24 @@ function dim_push_branch
 	update_linux_next
 }
 
+dim_alias_pq=push-queued
+function dim_push_queued
+{
+	dim_push_branch drm-intel-next-queued "$@"
+}
+
+dim_alias_pnf=push-next-fixes
+function dim_push_next_fixes
+{
+	dim_push_branch drm-intel-next-fixes "$@"
+}
+
+dim_alias_pf=push-fixes
+function dim_push_fixes
+{
+	dim_push_branch drm-intel-fixes "$@"
+}
+
 # ensure we're on branch $1, and apply patches. the rest of the arguments are
 # passed to git am.
 dim_alias_ab=apply-branch
@@ -801,9 +819,6 @@ dim_alias_anf=apply-next-fixes
 dim_alias_aq=apply-queued
 dim_alias_ar=apply-resolved
 dim_alias_mrr=magic-rebase-resolve
-dim_alias_pf=push-fixes
-dim_alias_pnf=push-next-fixes
-dim_alias_pq=push-queued
 
 declare -n subcmd=dim_alias_${subcommand//-/_}
 if [ -z "$subcmd" ]; then
@@ -824,15 +839,6 @@ case "$subcmd" in
 		cd $DIM_PREFIX/drm-intel-nightly
 		cat > `cat .fixup_file_path`
 		;;
-	push-queued)
-		dim_push_branch drm-intel-next-queued "$@"
-		;;
-	push-next-fixes)
-		dim_push_branch drm-intel-next-fixes "$@"
-		;;
-	push-fixes)
-		dim_push_branch drm-intel-fixes "$@"
-		;;
 	conq)
 		dim_checkout drm-intel-next-queued
 		;;
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [maintainer-tools PATCH v2 19/33] dim: abstract dim_checkout callers
  2016-01-28 13:26 [maintainer-tools PATCH v2 00/33] dim: function based subcommand handling Jani Nikula
                   ` (17 preceding siblings ...)
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 18/33] dim: abstract dim_push_* Jani Nikula
@ 2016-01-28 13:27 ` Jani Nikula
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 20/33] dim: abstract dim apply* subcommands Jani Nikula
                   ` (14 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: Jani Nikula @ 2016-01-28 13:27 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 dim | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/dim b/dim
index 07ef5d70db1e..519d09a1cdc8 100755
--- a/dim
+++ b/dim
@@ -486,6 +486,21 @@ function dim_checkout
 	fi
 }
 
+function dim_conq
+{
+	dim_checkout drm-intel-next-queued "$@"
+}
+
+function dim_coq
+{
+	dim_checkout drm-intel-fixes "$@"
+}
+
+function dim_conf
+{
+	dim_checkout drm-intel-next-fixes "$@"
+}
+
 function check_repo_clean
 {
 	cd $1
@@ -839,15 +854,6 @@ case "$subcmd" in
 		cd $DIM_PREFIX/drm-intel-nightly
 		cat > `cat .fixup_file_path`
 		;;
-	conq)
-		dim_checkout drm-intel-next-queued
-		;;
-	cof)
-		dim_checkout drm-intel-fixes
-		;;
-	conf)
-		dim_checkout drm-intel-next-fixes
-		;;
 	apply-queued)
 		dim_apply_branch drm-intel-next-queued "$@"
 		;;
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [maintainer-tools PATCH v2 20/33] dim: abstract dim apply* subcommands
  2016-01-28 13:26 [maintainer-tools PATCH v2 00/33] dim: function based subcommand handling Jani Nikula
                   ` (18 preceding siblings ...)
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 19/33] dim: abstract dim_checkout callers Jani Nikula
@ 2016-01-28 13:27 ` Jani Nikula
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 21/33] dim: abstract dim_magic_rebase_resolve Jani Nikula
                   ` (13 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: Jani Nikula @ 2016-01-28 13:27 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 dim | 56 +++++++++++++++++++++++++++++++++-----------------------
 1 file changed, 33 insertions(+), 23 deletions(-)

diff --git a/dim b/dim
index 519d09a1cdc8..898889a28c69 100755
--- a/dim
+++ b/dim
@@ -435,6 +435,39 @@ function dim_apply_branch
 	eval $DRY $DIM_POST_APPLY_ACTION
 }
 
+dim_alias_aq=apply-queued
+function dim_apply_queued
+{
+	dim_apply_branch drm-intel-next-queued "$@"
+}
+
+dim_alias_af=apply-fixes
+function dim_apply_fixes
+{
+	dim_apply_branch drm-intel-fixes "$@"
+}
+
+dim_alias_anf=apply-next-fixes
+function dim_apply_next_fixes
+{
+	dim_apply_branch drm-intel-next-fixes "$@"
+}
+
+dim_alias_ar=apply-resolved
+function dim_apply_resolved
+{
+	make -j 20 && git add -u && git am --resolved
+	checkpatch_commit HEAD
+	git commit --amend &
+}
+
+dim_alias_ai=apply-igt
+function dim_apply_igt
+{
+	cd ~/xorg/intel-gpu-tools/
+	git am --whitespace=fix -3 -s
+}
+
 dim_alias_mp=magic-patch
 function dim_magic_patch
 {
@@ -828,11 +861,6 @@ function dim_alias
 }
 
 # dim subcommand aliases
-dim_alias_af=apply-fixes
-dim_alias_ai=apply-igt
-dim_alias_anf=apply-next-fixes
-dim_alias_aq=apply-queued
-dim_alias_ar=apply-resolved
 dim_alias_mrr=magic-rebase-resolve
 
 declare -n subcmd=dim_alias_${subcommand//-/_}
@@ -854,24 +882,6 @@ case "$subcmd" in
 		cd $DIM_PREFIX/drm-intel-nightly
 		cat > `cat .fixup_file_path`
 		;;
-	apply-queued)
-		dim_apply_branch drm-intel-next-queued "$@"
-		;;
-	apply-fixes)
-		dim_apply_branch drm-intel-fixes "$@"
-		;;
-	apply-next-fixes)
-		dim_apply_branch drm-intel-next-fixes "$@"
-		;;
-	apply-resolved)
-		make -j 20 && git add -u && git am --resolved
-		checkpatch_commit HEAD
-		git commit --amend &
-		;;
-	apply-igt)
-		cd ~/xorg/intel-gpu-tools/
-		git am --whitespace=fix -3 -s
-		;;
 	magic-rebase-resolve)
 		git diff HEAD | patch -p1 -R
 		cat .git/rebase-merge/patch | dim mp
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [maintainer-tools PATCH v2 21/33] dim: abstract dim_magic_rebase_resolve
  2016-01-28 13:26 [maintainer-tools PATCH v2 00/33] dim: function based subcommand handling Jani Nikula
                   ` (19 preceding siblings ...)
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 20/33] dim: abstract dim apply* subcommands Jani Nikula
@ 2016-01-28 13:27 ` Jani Nikula
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 22/33] dim: abstract dim_cat_to_fixup Jani Nikula
                   ` (12 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: Jani Nikula @ 2016-01-28 13:27 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 dim | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/dim b/dim
index 898889a28c69..f86ba6253e49 100755
--- a/dim
+++ b/dim
@@ -461,6 +461,16 @@ function dim_apply_resolved
 	git commit --amend &
 }
 
+dim_alias_mrr=magic-rebase-resolve
+function dim_magic_rebase_resolve
+{
+	git diff HEAD | patch -p1 -R
+	cat .git/rebase-merge/patch | dim mp
+	make -j 20
+	git add -u
+	git rebase --continue
+}
+
 dim_alias_ai=apply-igt
 function dim_apply_igt
 {
@@ -861,8 +871,6 @@ function dim_alias
 }
 
 # dim subcommand aliases
-dim_alias_mrr=magic-rebase-resolve
-
 declare -n subcmd=dim_alias_${subcommand//-/_}
 if [ -z "$subcmd" ]; then
 	subcmd="$subcommand"
@@ -882,13 +890,6 @@ case "$subcmd" in
 		cd $DIM_PREFIX/drm-intel-nightly
 		cat > `cat .fixup_file_path`
 		;;
-	magic-rebase-resolve)
-		git diff HEAD | patch -p1 -R
-		cat .git/rebase-merge/patch | dim mp
-		make -j 20
-		git add -u
-		git rebase --continue
-		;;
 	tc)
 		cd $DIM_PREFIX/$DIM_DRM_INTEL
 		tag=$(git tag --contains $1 | grep ^v | sort -V | head -n 1)
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [maintainer-tools PATCH v2 22/33] dim: abstract dim_cat_to_fixup
  2016-01-28 13:26 [maintainer-tools PATCH v2 00/33] dim: function based subcommand handling Jani Nikula
                   ` (20 preceding siblings ...)
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 21/33] dim: abstract dim_magic_rebase_resolve Jani Nikula
@ 2016-01-28 13:27 ` Jani Nikula
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 23/33] dim: abstract dim_tc Jani Nikula
                   ` (11 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: Jani Nikula @ 2016-01-28 13:27 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 dim | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/dim b/dim
index f86ba6253e49..808c9c74a8d4 100755
--- a/dim
+++ b/dim
@@ -870,6 +870,12 @@ function dim_alias
 		sed 's/^dim_alias_/\t/;s/=/\t/'
 }
 
+function dim_cat_to_fixup
+{
+	cd $DIM_PREFIX/drm-intel-nightly
+	cat > `cat .fixup_file_path`
+}
+
 # dim subcommand aliases
 declare -n subcmd=dim_alias_${subcommand//-/_}
 if [ -z "$subcmd" ]; then
@@ -886,10 +892,6 @@ fi
 # XXX: abscract each case to a dim_ prefixed function, and turn the help|*) case
 # into an else branch in the above check for functions.
 case "$subcmd" in
-	cat-to-fixup)
-		cd $DIM_PREFIX/drm-intel-nightly
-		cat > `cat .fixup_file_path`
-		;;
 	tc)
 		cd $DIM_PREFIX/$DIM_DRM_INTEL
 		tag=$(git tag --contains $1 | grep ^v | sort -V | head -n 1)
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [maintainer-tools PATCH v2 23/33] dim: abstract dim_tc
  2016-01-28 13:26 [maintainer-tools PATCH v2 00/33] dim: function based subcommand handling Jani Nikula
                   ` (21 preceding siblings ...)
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 22/33] dim: abstract dim_cat_to_fixup Jani Nikula
@ 2016-01-28 13:27 ` Jani Nikula
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 24/33] dim: abstract dim_fixes Jani Nikula
                   ` (10 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: Jani Nikula @ 2016-01-28 13:27 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 dim | 30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/dim b/dim
index 808c9c74a8d4..8c21c4d905b6 100755
--- a/dim
+++ b/dim
@@ -876,6 +876,22 @@ function dim_cat_to_fixup
 	cat > `cat .fixup_file_path`
 }
 
+function dim_tc
+{
+	cd $DIM_PREFIX/$DIM_DRM_INTEL
+	tag=$(git tag --contains $1 | grep ^v | sort -V | head -n 1)
+	if [[ -n "$tag" ]]; then
+		echo "$tag"
+	else
+		# not in a tagged release, show upstream branches
+		git branch -r --contains $1 \
+		    $DIM_DRM_INTEL_REMOTE/* \
+		    $DIM_DRM_UPSTREAM_REMOTE/drm-next \
+		    $DIM_DRM_UPSTREAM_REMOTE/drm-fixes \
+		    origin/master | sed 's/^ *//'
+	fi
+}
+
 # dim subcommand aliases
 declare -n subcmd=dim_alias_${subcommand//-/_}
 if [ -z "$subcmd" ]; then
@@ -892,20 +908,6 @@ fi
 # XXX: abscract each case to a dim_ prefixed function, and turn the help|*) case
 # into an else branch in the above check for functions.
 case "$subcmd" in
-	tc)
-		cd $DIM_PREFIX/$DIM_DRM_INTEL
-		tag=$(git tag --contains $1 | grep ^v | sort -V | head -n 1)
-		if [[ -n "$tag" ]]; then
-			echo "$tag"
-		else
-			# not in a tagged release, show upstream branches
-			git branch -r --contains $1 \
-			    $DIM_DRM_INTEL_REMOTE/* \
-			    $DIM_DRM_UPSTREAM_REMOTE/drm-next \
-			    $DIM_DRM_UPSTREAM_REMOTE/drm-fixes \
-			    origin/master | sed 's/^ *//'
-		fi
-		;;
 	fixes)
 		sha1=$1
 		git log -1 $sha1 "--pretty=format:Fixes: %H (\"%s\")%n" | \
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [maintainer-tools PATCH v2 24/33] dim: abstract dim_fixes
  2016-01-28 13:26 [maintainer-tools PATCH v2 00/33] dim: function based subcommand handling Jani Nikula
                   ` (22 preceding siblings ...)
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 23/33] dim: abstract dim_tc Jani Nikula
@ 2016-01-28 13:27 ` Jani Nikula
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 25/33] dim: abstract dim_cherry_pick Jani Nikula
                   ` (9 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: Jani Nikula @ 2016-01-28 13:27 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 dim | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/dim b/dim
index 8c21c4d905b6..4942b1684f74 100755
--- a/dim
+++ b/dim
@@ -892,6 +892,13 @@ function dim_tc
 	fi
 }
 
+function dim_fixes
+{
+	sha1=$1
+	git log -1 $sha1 "--pretty=format:Fixes: %H (\"%s\")%n" | \
+		sed -e 's/\([0-f]\{12\}\)[0-f]*/\1/'
+}
+
 # dim subcommand aliases
 declare -n subcmd=dim_alias_${subcommand//-/_}
 if [ -z "$subcmd" ]; then
@@ -908,11 +915,6 @@ fi
 # XXX: abscract each case to a dim_ prefixed function, and turn the help|*) case
 # into an else branch in the above check for functions.
 case "$subcmd" in
-	fixes)
-		sha1=$1
-		git log -1 $sha1 "--pretty=format:Fixes: %H (\"%s\")%n" | \
-			sed -e 's/\([0-f]\{12\}\)[0-f]*/\1/'
-		;;
 	cherry-pick)
 		if [[ "x$1" = "x" ]]; then
 			echo "usage: $0 $subcommand commit-ish"
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [maintainer-tools PATCH v2 25/33] dim: abstract dim_cherry_pick
  2016-01-28 13:26 [maintainer-tools PATCH v2 00/33] dim: function based subcommand handling Jani Nikula
                   ` (23 preceding siblings ...)
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 24/33] dim: abstract dim_fixes Jani Nikula
@ 2016-01-28 13:27 ` Jani Nikula
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 26/33] dim: abstract dim_pull_request_* Jani Nikula
                   ` (8 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: Jani Nikula @ 2016-01-28 13:27 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 dim | 30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/dim b/dim
index 4942b1684f74..69c8d6a49495 100755
--- a/dim
+++ b/dim
@@ -453,6 +453,22 @@ function dim_apply_next_fixes
 	dim_apply_branch drm-intel-next-fixes "$@"
 }
 
+function dim_cherry_pick
+{
+	if [[ "x$1" = "x" ]]; then
+		echo "usage: $0 $subcommand commit-ish"
+		exit 1
+	fi
+	sha=`git rev-parse $1`
+	sha_short=${sha:0:8}
+
+	# need latest -nightly
+	git fetch $DIM_DRM_INTEL_REMOTE
+	echo Possible fixup patches for your cherry-pick:
+	git log --grep=$sha_short --pretty=oneline $sha..$DIM_DRM_INTEL_REMOTE/drm-intel-nightly
+	$DRY git cherry-pick $1
+}
+
 dim_alias_ar=apply-resolved
 function dim_apply_resolved
 {
@@ -915,20 +931,6 @@ fi
 # XXX: abscract each case to a dim_ prefixed function, and turn the help|*) case
 # into an else branch in the above check for functions.
 case "$subcmd" in
-	cherry-pick)
-		if [[ "x$1" = "x" ]]; then
-			echo "usage: $0 $subcommand commit-ish"
-			exit 1
-		fi
-		sha=`git rev-parse $1`
-		sha_short=${sha:0:8}
-
-		# need latest -nightly
-		git fetch $DIM_DRM_INTEL_REMOTE
-		echo Possible fixup patches for your cherry-pick:
-		git log --grep=$sha_short --pretty=oneline $sha..$DIM_DRM_INTEL_REMOTE/drm-intel-nightly
-		$DRY git cherry-pick $1
-		;;
 	pull-request-next)
 		upstream=${1:-$DIM_DRM_UPSTREAM_REMOTE/drm-next}
 		dim_pull_request drm-intel-next $upstream
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [maintainer-tools PATCH v2 26/33] dim: abstract dim_pull_request_*
  2016-01-28 13:26 [maintainer-tools PATCH v2 00/33] dim: function based subcommand handling Jani Nikula
                   ` (24 preceding siblings ...)
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 25/33] dim: abstract dim_cherry_pick Jani Nikula
@ 2016-01-28 13:27 ` Jani Nikula
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 27/33] dim: abstract dim_update_next Jani Nikula
                   ` (7 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: Jani Nikula @ 2016-01-28 13:27 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 dim | 30 ++++++++++++++++++------------
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git a/dim b/dim
index 69c8d6a49495..1ecdfefc4f11 100755
--- a/dim
+++ b/dim
@@ -750,6 +750,24 @@ function dim_pull_request
 		"$addr_drm_maintainer"
 }
 
+function dim_pull_request_next
+{
+	upstream=${1:-$DIM_DRM_UPSTREAM_REMOTE/drm-next}
+	dim_pull_request drm-intel-next $upstream
+}
+
+function dim_pull_request_fixes
+{
+	upstream=${1:-origin/master}
+	dim_pull_request drm-intel-fixes $upstream
+}
+
+function dim_pull_request_next_fixes
+{
+	upstream=${1:-$DIM_DRM_UPSTREAM_REMOTE/drm-next}
+	dim_pull_request drm-intel-next-fixes $upstream
+}
+
 dim_alias_ub=update-branches
 function dim_update_branches
 {
@@ -931,18 +949,6 @@ fi
 # XXX: abscract each case to a dim_ prefixed function, and turn the help|*) case
 # into an else branch in the above check for functions.
 case "$subcmd" in
-	pull-request-next)
-		upstream=${1:-$DIM_DRM_UPSTREAM_REMOTE/drm-next}
-		dim_pull_request drm-intel-next $upstream
-		;;
-	pull-request-fixes)
-		upstream=${1:-origin/master}
-		dim_pull_request drm-intel-fixes $upstream
-		;;
-	pull-request-next-fixes)
-		upstream=${1:-$DIM_DRM_UPSTREAM_REMOTE/drm-next}
-		dim_pull_request drm-intel-next-fixes $upstream
-		;;
 	update-next)
 		assert_branch drm-intel-next-queued
 
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [maintainer-tools PATCH v2 27/33] dim: abstract dim_update_next
  2016-01-28 13:26 [maintainer-tools PATCH v2 00/33] dim: function based subcommand handling Jani Nikula
                   ` (25 preceding siblings ...)
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 26/33] dim: abstract dim_pull_request_* Jani Nikula
@ 2016-01-28 13:27 ` Jani Nikula
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 28/33] dim: abstract dim_tag_next Jani Nikula
                   ` (6 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: Jani Nikula @ 2016-01-28 13:27 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 dim | 126 +++++++++++++++++++++++++++++++++++---------------------------------
 1 file changed, 64 insertions(+), 62 deletions(-)

diff --git a/dim b/dim
index 1ecdfefc4f11..25597743e2a0 100755
--- a/dim
+++ b/dim
@@ -708,6 +708,70 @@ function dim_for_each_workdirs
 	done
 }
 
+function dim_update_next
+{
+	assert_branch drm-intel-next-queued
+
+	git pull --ff-only
+
+	if ! git branch --merged $DIM_DRM_INTEL_REMOTE/drm-intel-nightly | grep drm-intel-fixes &> /dev/null ; then
+		echo "drm-intel-fixes not merged into -nigthly, please update!"
+		exit 2
+	fi
+	if ! git branch --merged $DIM_DRM_INTEL_REMOTE/drm-intel-nightly | grep drm-intel-next-queued &> /dev/null ; then
+		echo "drm-intel-next-queued not merged into -nigthly, please update!"
+		exit 2
+	fi
+
+	driver_date=`date +%Y%m%d`
+	$DRY sed -i -e "s/^#define DRIVER_DATE.*\"[0-9]*\"$/#define DRIVER_DATE\t\t\"$driver_date\"/" \
+	     drivers/gpu/drm/i915/i915_drv.h
+	$DRY git add drivers/gpu/drm/i915/i915_drv.h
+	echo -e "drm/i915: Update DRIVER_DATE to $driver_date\n\nSigned-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>" | \
+		git commit -s -F -
+
+	gitk drm-intel-next-queued ^$DIM_DRM_UPSTREAM_REMOTE/drm-next &
+
+	# try to push dinq first in case someone raced
+	dim push-queued
+
+	git push $DRY_RUN $DIM_DRM_INTEL_REMOTE drm-intel-next-queued:drm-intel-next
+	tag=drm-intel-next-$today
+	$DRY git tag -f -a $tag $DIM_DRM_INTEL_REMOTE/drm-intel-next
+	git push $DRY_RUN -f $DIM_DRM_INTEL_REMOTE $tag
+
+	echo "Updating -testing to latest -nightly"
+	git push $DRY_RUN $DIM_DRM_INTEL_REMOTE +$DIM_DRM_INTEL_REMOTE/drm-intel-nightly:drm-intel-testing
+	$DRY git tag -f drm-intel-testing-$today $DIM_DRM_INTEL_REMOTE/drm-intel-testing
+	$DRY git push -f $DIM_DRM_INTEL_REMOTE drm-intel-testing-$today
+
+	cat > ~/tmp/test-request <<-HERE
+		Hi all,
+
+		New -testing cycle with cool stuff:
+		HERE
+	obj=`git rev-parse $tag`
+	if [[ `git cat-file -t $obj` == "tag" ]] ; then
+		git cat-file -p $obj | tail -n+6 >> ~/tmp/test-request
+	else
+		echo "<tag doesn't contain a changelog overview, fix this>" >> ~/tmp/test-request
+	fi
+	cat >> ~/tmp/test-request <<-HERE
+
+		Happy testing!
+
+		Cheers, Daniel
+		HERE
+
+	$DRY $DIM_MUA -s "Updated drm-intel-testing" \
+	     -i ~/tmp/test-request \
+	     -c "$addr_intel_gfx" \
+	     -c "$addr_intel_gfx_maintainer1" \
+	     -c "$addr_intel_gfx_maintainer2" \
+	     "$addr_intel_qa1" \
+	     "$addr_intel_qa2"
+}
+
 # dim_pull_request branch upstream
 function dim_pull_request
 {
@@ -949,68 +1013,6 @@ fi
 # XXX: abscract each case to a dim_ prefixed function, and turn the help|*) case
 # into an else branch in the above check for functions.
 case "$subcmd" in
-	update-next)
-		assert_branch drm-intel-next-queued
-
-		git pull --ff-only
-
-		if ! git branch --merged $DIM_DRM_INTEL_REMOTE/drm-intel-nightly | grep drm-intel-fixes &> /dev/null ; then
-			echo "drm-intel-fixes not merged into -nigthly, please update!"
-			exit 2
-		fi
-		if ! git branch --merged $DIM_DRM_INTEL_REMOTE/drm-intel-nightly | grep drm-intel-next-queued &> /dev/null ; then
-			echo "drm-intel-next-queued not merged into -nigthly, please update!"
-			exit 2
-		fi
-
-		driver_date=`date +%Y%m%d`
-		$DRY sed -i -e "s/^#define DRIVER_DATE.*\"[0-9]*\"$/#define DRIVER_DATE\t\t\"$driver_date\"/" \
-			drivers/gpu/drm/i915/i915_drv.h
-		$DRY git add drivers/gpu/drm/i915/i915_drv.h
-		echo -e "drm/i915: Update DRIVER_DATE to $driver_date\n\nSigned-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>" | \
-			git commit -s -F -
-
-		gitk drm-intel-next-queued ^$DIM_DRM_UPSTREAM_REMOTE/drm-next &
-
-		# try to push dinq first in case someone raced
-		dim push-queued
-
-		git push $DRY_RUN $DIM_DRM_INTEL_REMOTE drm-intel-next-queued:drm-intel-next
-		tag=drm-intel-next-$today
-		$DRY git tag -f -a $tag $DIM_DRM_INTEL_REMOTE/drm-intel-next
-		git push $DRY_RUN -f $DIM_DRM_INTEL_REMOTE $tag
-
-		echo "Updating -testing to latest -nightly"
-		git push $DRY_RUN $DIM_DRM_INTEL_REMOTE +$DIM_DRM_INTEL_REMOTE/drm-intel-nightly:drm-intel-testing
-		$DRY git tag -f drm-intel-testing-$today $DIM_DRM_INTEL_REMOTE/drm-intel-testing
-		$DRY git push -f $DIM_DRM_INTEL_REMOTE drm-intel-testing-$today
-
-		cat > ~/tmp/test-request <<-HERE
-		Hi all,
-
-		New -testing cycle with cool stuff:
-		HERE
-		obj=`git rev-parse $tag`
-		if [[ `git cat-file -t $obj` == "tag" ]] ; then
-			git cat-file -p $obj | tail -n+6 >> ~/tmp/test-request
-		else
-			echo "<tag doesn't contain a changelog overview, fix this>" >> ~/tmp/test-request
-		fi
-		cat >> ~/tmp/test-request <<-HERE
-
-		Happy testing!
-
-		Cheers, Daniel
-		HERE
-
-		$DRY $DIM_MUA -s "Updated drm-intel-testing" \
-			-i ~/tmp/test-request \
-			-c "$addr_intel_gfx" \
-			-c "$addr_intel_gfx_maintainer1" \
-			-c "$addr_intel_gfx_maintainer2" \
-			"$addr_intel_qa1" \
-			"$addr_intel_qa2"
-		;;
 	tag-next)
 		cd $DIM_PREFIX/$DIM_DRM_INTEL
 		git fetch $DIM_DRM_INTEL_REMOTE
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [maintainer-tools PATCH v2 28/33] dim: abstract dim_tag_next
  2016-01-28 13:26 [maintainer-tools PATCH v2 00/33] dim: function based subcommand handling Jani Nikula
                   ` (26 preceding siblings ...)
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 27/33] dim: abstract dim_update_next Jani Nikula
@ 2016-01-28 13:27 ` Jani Nikula
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 29/33] dim: abstract dim_{create, remove}_branch Jani Nikula
                   ` (5 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: Jani Nikula @ 2016-01-28 13:27 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 dim | 34 ++++++++++++++++++----------------
 1 file changed, 18 insertions(+), 16 deletions(-)

diff --git a/dim b/dim
index 25597743e2a0..88ee7350741d 100755
--- a/dim
+++ b/dim
@@ -772,6 +772,24 @@ function dim_update_next
 	     "$addr_intel_qa2"
 }
 
+function dim_tag_next
+{
+	cd $DIM_PREFIX/$DIM_DRM_INTEL
+	git fetch $DIM_DRM_INTEL_REMOTE
+
+	if [ $(git rev-parse drm-intel-next) == $(git rev-parse drm-intel-next@{u}) ] ; then
+		echo "Tagging current drm-intel-next"
+
+		tag=drm-intel-next-$today
+		$DRY git tag -f $tag $DIM_DRM_INTEL_REMOTE/drm-intel-next
+		git push $DRY_RUN -f $DIM_DRM_INTEL_REMOTE $tag
+	else
+		echo "drm-intel-next not up-to-date, aborting"
+		exit
+	fi
+
+}
+
 # dim_pull_request branch upstream
 function dim_pull_request
 {
@@ -1013,22 +1031,6 @@ fi
 # XXX: abscract each case to a dim_ prefixed function, and turn the help|*) case
 # into an else branch in the above check for functions.
 case "$subcmd" in
-	tag-next)
-		cd $DIM_PREFIX/$DIM_DRM_INTEL
-		git fetch $DIM_DRM_INTEL_REMOTE
-
-		if [ $(git rev-parse drm-intel-next) == $(git rev-parse drm-intel-next@{u}) ] ; then
-			echo "Tagging current drm-intel-next"
-
-			tag=drm-intel-next-$today
-			$DRY git tag -f $tag $DIM_DRM_INTEL_REMOTE/drm-intel-next
-			git push $DRY_RUN -f $DIM_DRM_INTEL_REMOTE $tag
-		else
-			echo "drm-intel-next not up-to-date, aborting"
-			exit
-		fi
-
-		;;
 	create-branch)
 		if [[ "x$1" = "x" ]]; then
 			echo "usage: $0 $subcommand branch [commit-ish]"
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [maintainer-tools PATCH v2 29/33] dim: abstract dim_{create, remove}_branch
  2016-01-28 13:26 [maintainer-tools PATCH v2 00/33] dim: function based subcommand handling Jani Nikula
                   ` (27 preceding siblings ...)
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 28/33] dim: abstract dim_tag_next Jani Nikula
@ 2016-01-28 13:27 ` Jani Nikula
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 30/33] dim: abstract dim_checker Jani Nikula
                   ` (4 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: Jani Nikula @ 2016-01-28 13:27 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 dim | 100 +++++++++++++++++++++++++++++++++++---------------------------------
 1 file changed, 52 insertions(+), 48 deletions(-)

diff --git a/dim b/dim
index 88ee7350741d..4ff903fb3818 100755
--- a/dim
+++ b/dim
@@ -515,6 +515,58 @@ function dim_magic_patch
 	done
 }
 
+function dim_create_branch
+{
+	if [[ "x$1" = "x" ]]; then
+		echo "usage: $0 $subcommand branch [commit-ish]"
+		exit 1
+	fi
+	branch=$1
+	if [[ "x$2" = "x" ]]; then
+		start=HEAD
+	else
+		start=$2
+	fi
+
+	cd $DIM_PREFIX/$DIM_DRM_INTEL
+
+	$DRY git branch $branch $start
+	git push $DRY_RUN $DIM_DRM_INTEL_REMOTE +$branch --set-upstream
+	cd $DIM_PREFIX/drm-intel-rerere
+	$DRY echo "nightly_branches=\"\$nightly_branches origin/$branch\"" \
+	     >> nightly.conf
+	$DRY git add nightly.conf
+	$DRY git commit --quiet -m "Adding $branch to -nightly"
+}
+
+function dim_remove_branch
+{
+	if [[ "x$1" = "x" ]]; then
+		echo "usage: $0 $subcommand branch"
+		exit 1
+	fi
+	branch=$1
+
+	cd $DIM_PREFIX/$DIM_DRM_INTEL
+
+	if ! $DRY git branch -d $branch ; then
+		warn_or_fail "Can't remove $branch in working repo"
+	fi
+
+	if [[ -d $DIM_PREFIX/$branch ]] ; then
+		rm -R $DIM_PREFIX/$branch
+	fi
+
+	cd $DIM_PREFIX/drm-intel-nightly
+	git push $DRY_RUN origin --delete $branch
+	$DRY git fetch origin --prune
+	cd $DIM_PREFIX/drm-intel-rerere
+	full_branch="origin/$branch"
+	$DRY sed -e "/${full_branch//\//\\\/}/d" -i nightly.conf
+	$DRY git add nightly.conf
+	$DRY git commit --quiet -m "Deleted $branch and removed from -nightly"
+}
+
 function dim_cd
 {
 	local path
@@ -1031,54 +1083,6 @@ fi
 # XXX: abscract each case to a dim_ prefixed function, and turn the help|*) case
 # into an else branch in the above check for functions.
 case "$subcmd" in
-	create-branch)
-		if [[ "x$1" = "x" ]]; then
-			echo "usage: $0 $subcommand branch [commit-ish]"
-			exit 1
-		fi
-		branch=$1
-		if [[ "x$2" = "x" ]]; then
-			start=HEAD
-		else
-			start=$2
-		fi
-
-		cd $DIM_PREFIX/$DIM_DRM_INTEL
-
-		$DRY git branch $branch $start
-		git push $DRY_RUN $DIM_DRM_INTEL_REMOTE +$branch --set-upstream
-		cd $DIM_PREFIX/drm-intel-rerere
-		$DRY echo "nightly_branches=\"\$nightly_branches origin/$branch\"" \
-			>> nightly.conf
-		$DRY git add nightly.conf
-		$DRY git commit --quiet -m "Adding $branch to -nightly"
-		;;
-	remove-branch)
-		if [[ "x$1" = "x" ]]; then
-			echo "usage: $0 $subcommand branch"
-			exit 1
-		fi
-		branch=$1
-
-		cd $DIM_PREFIX/$DIM_DRM_INTEL
-
-		if ! $DRY git branch -d $branch ; then
-			warn_or_fail "Can't remove $branch in working repo"
-		fi
-
-		if [[ -d $DIM_PREFIX/$branch ]] ; then
-			rm -R $DIM_PREFIX/$branch
-		fi
-
-		cd $DIM_PREFIX/drm-intel-nightly
-		git push $DRY_RUN origin --delete $branch
-		$DRY git fetch origin --prune
-		cd $DIM_PREFIX/drm-intel-rerere
-		full_branch="origin/$branch"
-		$DRY sed -e "/${full_branch//\//\\\/}/d" -i nightly.conf
-		$DRY git add nightly.conf
-		$DRY git commit --quiet -m "Deleted $branch and removed from -nightly"
-		;;
 	checker)
 		rm drivers/gpu/drm/i915/*.o &> /dev/null || true
 		rm drivers/gpu/drm/i915/*.ko &> /dev/null || true
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [maintainer-tools PATCH v2 30/33] dim: abstract dim_checker
  2016-01-28 13:26 [maintainer-tools PATCH v2 00/33] dim: function based subcommand handling Jani Nikula
                   ` (28 preceding siblings ...)
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 29/33] dim: abstract dim_{create, remove}_branch Jani Nikula
@ 2016-01-28 13:27 ` Jani Nikula
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 31/33] dim: abstract dim_help Jani Nikula
                   ` (3 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: Jani Nikula @ 2016-01-28 13:27 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 dim | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/dim b/dim
index 4ff903fb3818..4370aec28ec0 100755
--- a/dim
+++ b/dim
@@ -662,6 +662,13 @@ function dim_checkpatch
 	done
 }
 
+function dim_checker
+{
+	rm drivers/gpu/drm/i915/*.o &> /dev/null || true
+	rm drivers/gpu/drm/i915/*.ko &> /dev/null || true
+	make C=1 drivers/gpu/drm/i915/i915.ko
+}
+
 function prep_pull_mail_greetings
 {
 	if [ -r $DIM_TEMPLATE_HELLO ]; then
@@ -1083,11 +1090,6 @@ fi
 # XXX: abscract each case to a dim_ prefixed function, and turn the help|*) case
 # into an else branch in the above check for functions.
 case "$subcmd" in
-	checker)
-		rm drivers/gpu/drm/i915/*.o &> /dev/null || true
-		rm drivers/gpu/drm/i915/*.ko &> /dev/null || true
-		make C=1 drivers/gpu/drm/i915/i915.ko
-		;;
 	help|*)
 		manpage=$DIM_PREFIX/maintainer-tools/dim.rst
 		if [ ! -e "$manpage" ]; then
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [maintainer-tools PATCH v2 31/33] dim: abstract dim_help
  2016-01-28 13:26 [maintainer-tools PATCH v2 00/33] dim: function based subcommand handling Jani Nikula
                   ` (29 preceding siblings ...)
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 30/33] dim: abstract dim_checker Jani Nikula
@ 2016-01-28 13:27 ` Jani Nikula
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 32/33] dim: show usage instead of the man page on unknown subcommands Jani Nikula
                   ` (2 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: Jani Nikula @ 2016-01-28 13:27 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

dim help being the last subcommand handled by the switch case,
obliterate it as well, finishing the job we set out to do. Now all
subcommands are handled via dim_ prefixed functions.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 dim | 50 ++++++++++++++++++++++++--------------------------
 1 file changed, 24 insertions(+), 26 deletions(-)

diff --git a/dim b/dim
index 4370aec28ec0..6f50f8b67184 100755
--- a/dim
+++ b/dim
@@ -1074,6 +1074,28 @@ function dim_fixes
 		sed -e 's/\([0-f]\{12\}\)[0-f]*/\1/'
 }
 
+function dim_help
+{
+	manpage=$DIM_PREFIX/maintainer-tools/dim.rst
+	if [ ! -e "$manpage" ]; then
+		manpage=$(dirname $(readlink -f $0))/dim.rst
+		if [ ! -e "$manpage" ]; then
+			echo "Can't find the man page. See http://cgit.freedesktop.org/drm-intel/tree/dim.rst?h=maintainer-tools"
+			exit 1
+		fi
+	fi
+
+	if hash rst2man 2>/dev/null; then
+		renderer=rst2man
+		pager="man -l -"
+	else
+		renderer=cat
+		pager=${PAGER:-cat}
+	fi
+
+	$renderer < $manpage | $pager
+}
+
 # dim subcommand aliases
 declare -n subcmd=dim_alias_${subcommand//-/_}
 if [ -z "$subcmd" ]; then
@@ -1084,30 +1106,6 @@ fi
 subcmd_func=dim_${subcmd//-/_}
 if declare -f $subcmd_func >/dev/null; then
 	$subcmd_func "$@"
-	exit 0
+else
+	dim_help
 fi
-
-# XXX: abscract each case to a dim_ prefixed function, and turn the help|*) case
-# into an else branch in the above check for functions.
-case "$subcmd" in
-	help|*)
-		manpage=$DIM_PREFIX/maintainer-tools/dim.rst
-		if [ ! -e "$manpage" ]; then
-			manpage=$(dirname $(readlink -f $0))/dim.rst
-			if [ ! -e "$manpage" ]; then
-				echo "Can't find the man page. See http://cgit.freedesktop.org/drm-intel/tree/dim.rst?h=maintainer-tools"
-				exit 1
-			fi
-		fi
-
-		if hash rst2man 2>/dev/null; then
-			renderer=rst2man
-			pager="man -l -"
-		else
-			renderer=cat
-			pager=${PAGER:-cat}
-		fi
-
-		$renderer < $manpage | $pager
-		;;
-esac
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [maintainer-tools PATCH v2 32/33] dim: show usage instead of the man page on unknown subcommands
  2016-01-28 13:26 [maintainer-tools PATCH v2 00/33] dim: function based subcommand handling Jani Nikula
                   ` (30 preceding siblings ...)
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 31/33] dim: abstract dim_help Jani Nikula
@ 2016-01-28 13:27 ` Jani Nikula
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 33/33] dim: add -h option for usage, imrove output on unknown options Jani Nikula
  2016-01-28 15:12 ` [maintainer-tools PATCH v2 00/33] dim: function based subcommand handling Jani Nikula
  33 siblings, 0 replies; 35+ messages in thread
From: Jani Nikula @ 2016-01-28 13:27 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

I find displaying the man page on every typo a bit distracting. Now that
we can list all the supported subcommands (by way of listing all the
dim_ prefixed functions), add usage to show quick help. Also make it a
subcommand of its own.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 dim | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/dim b/dim
index 6f50f8b67184..1651b5e8218a 100755
--- a/dim
+++ b/dim
@@ -139,7 +139,7 @@ shift `expr $OPTIND - 1`
 
 # first positional argument is the subcommand
 if [ "$#" = "0" ]; then
-    subcommand="help"
+    subcommand="usage"
 else
     subcommand="$1"
     shift
@@ -149,7 +149,7 @@ fi
 # Sanity checks.
 #
 
-if [ "$subcommand" != "setup" -a "$subcommand" != "help" ]; then
+if [ "$subcommand" != "setup" -a "$subcommand" != "help" -a "$subcommand" != "usage" ]; then
 	for d in $DIM_PREFIX $DIM_PREFIX/$DIM_DRM_INTEL $DIM_PREFIX/drm-intel-rerere $DIM_PREFIX/drm-intel-nightly; do
 		if [ ! -d $d ]; then
 			echo "$d is missing, please check your configuration and/or run dim setup"
@@ -1096,6 +1096,16 @@ function dim_help
 	$renderer < $manpage | $pager
 }
 
+function dim_usage
+{
+	echo "usage: $0 [OPTIONS] SUBCOMMAND [ARGUMENTS]"
+	echo
+	echo "The available subcommands are:"
+	declare -F | grep -o " dim_[a-zA-Z_]*" | sed 's/^ dim_/\t/'
+	echo
+	echo "See '$0 help' for more information."
+}
+
 # dim subcommand aliases
 declare -n subcmd=dim_alias_${subcommand//-/_}
 if [ -z "$subcmd" ]; then
@@ -1107,5 +1117,6 @@ subcmd_func=dim_${subcmd//-/_}
 if declare -f $subcmd_func >/dev/null; then
 	$subcmd_func "$@"
 else
-	dim_help
+	echo "$0: '$subcommand' is not a dim command." >&2
+	dim_usage
 fi
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [maintainer-tools PATCH v2 33/33] dim: add -h option for usage, imrove output on unknown options
  2016-01-28 13:26 [maintainer-tools PATCH v2 00/33] dim: function based subcommand handling Jani Nikula
                   ` (31 preceding siblings ...)
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 32/33] dim: show usage instead of the man page on unknown subcommands Jani Nikula
@ 2016-01-28 13:27 ` Jani Nikula
  2016-01-28 15:12 ` [maintainer-tools PATCH v2 00/33] dim: function based subcommand handling Jani Nikula
  33 siblings, 0 replies; 35+ messages in thread
From: Jani Nikula @ 2016-01-28 13:27 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

Show usage also with the -h option, and improve output on unknown
options.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 dim | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/dim b/dim
index 1651b5e8218a..fe1b2e8f1bad 100755
--- a/dim
+++ b/dim
@@ -107,6 +107,7 @@ DRY_RUN=
 INTERACTIVE=
 DRY=
 FORCE=
+HELP=
 
 function warn_or_fail
 {
@@ -118,7 +119,7 @@ function warn_or_fail
 	fi
 }
 
-while getopts dfi opt; do
+while getopts hdfi opt; do
 	case "$opt" in
 		d)
 			DRY_RUN=--dry-run
@@ -130,15 +131,18 @@ while getopts dfi opt; do
 		i)
 			INTERACTIVE='eval read -rsp "Press any key to continue..." -n1 key2; echo'
 			;;
+		h)
+			HELP=1
+			;;
 		*)
-			echo "Try 'dim help' for more information. $opt"
+			echo "See '$0 help' for more information." >&2
 			exit
 	esac
 done
 shift `expr $OPTIND - 1`
 
 # first positional argument is the subcommand
-if [ "$#" = "0" ]; then
+if [ -n "$HELP" -o "$#" = "0" ]; then
     subcommand="usage"
 else
     subcommand="$1"
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* Re: [maintainer-tools PATCH v2 00/33] dim: function based subcommand handling
  2016-01-28 13:26 [maintainer-tools PATCH v2 00/33] dim: function based subcommand handling Jani Nikula
                   ` (32 preceding siblings ...)
  2016-01-28 13:27 ` [maintainer-tools PATCH v2 33/33] dim: add -h option for usage, imrove output on unknown options Jani Nikula
@ 2016-01-28 15:12 ` Jani Nikula
  33 siblings, 0 replies; 35+ messages in thread
From: Jani Nikula @ 2016-01-28 15:12 UTC (permalink / raw)
  To: intel-gfx

On Thu, 28 Jan 2016, Jani Nikula <jani.nikula@intel.com> wrote:
> This is v2 of [1], with Daniel's concern regarding aliases
> addressed. It's much better now.
>
> Patches 1-11 and 15-31 are mostly just mechanical renames or code
> movement. They explode the series so big, but I think they're easier to
> look at this way.
>
> The real changes are in patches 12-14 and 32-33.
>
> All in all this should make dim more maintainable. It's getting pretty
> big for a shell script.

Pushed the lot with Daniel's IRC ack. Fixed one small typo on the way.

Please report any odd behaviour; it's possible I've screwed up
something...

BR,
Jani.


-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 35+ messages in thread

end of thread, other threads:[~2016-01-28 15:12 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-28 13:26 [maintainer-tools PATCH v2 00/33] dim: function based subcommand handling Jani Nikula
2016-01-28 13:26 ` [maintainer-tools PATCH v2 01/33] dim: rename dim_push to dim_push_branch Jani Nikula
2016-01-28 13:26 ` [maintainer-tools PATCH v2 02/33] dim: rename dim_apply to dim_apply_branch Jani Nikula
2016-01-28 13:26 ` [maintainer-tools PATCH v2 03/33] dim: rename dim_co to dim_checkout Jani Nikula
2016-01-28 13:26 ` [maintainer-tools PATCH v2 04/33] dim: rename dim_shell_checkpatch to shell_checkpatch Jani Nikula
2016-01-28 13:26 ` [maintainer-tools PATCH v2 05/33] dim: rename dim_checkpatch to checkpatch_commit Jani Nikula
2016-01-28 13:27 ` [maintainer-tools PATCH v2 06/33] dim: rename dim_checkrange to dim_checkpatch Jani Nikula
2016-01-28 13:27 ` [maintainer-tools PATCH v2 07/33] dim: rename setup_dim to dim_setup Jani Nikula
2016-01-28 13:27 ` [maintainer-tools PATCH v2 08/33] dim: rename create_workdir to dim_create_workdir Jani Nikula
2016-01-28 13:27 ` [maintainer-tools PATCH v2 09/33] dim: rename update_nightly to dim_rebuild_nightly Jani Nikula
2016-01-28 13:27 ` [maintainer-tools PATCH v2 10/33] dim: rename magic_patch to dim_magic_patch Jani Nikula
2016-01-28 13:27 ` [maintainer-tools PATCH v2 11/33] dim: move dim_pull_request parameter check to the function Jani Nikula
2016-01-28 13:27 ` [maintainer-tools PATCH v2 12/33] dim: separate handling of aliases Jani Nikula
2016-01-28 13:27 ` [maintainer-tools PATCH v2 13/33] dim: handle subcommands through functions Jani Nikula
2016-01-28 13:27 ` [maintainer-tools PATCH v2 14/33] dim: add alias command to list aliases Jani Nikula
2016-01-28 13:27 ` [maintainer-tools PATCH v2 15/33] dim: abstract dim_nightly_forget Jani Nikula
2016-01-28 13:27 ` [maintainer-tools PATCH v2 16/33] dim: abstract dim_update_branches Jani Nikula
2016-01-28 13:27 ` [maintainer-tools PATCH v2 17/33] dim: abstract dim_for_each_workdirs Jani Nikula
2016-01-28 13:27 ` [maintainer-tools PATCH v2 18/33] dim: abstract dim_push_* Jani Nikula
2016-01-28 13:27 ` [maintainer-tools PATCH v2 19/33] dim: abstract dim_checkout callers Jani Nikula
2016-01-28 13:27 ` [maintainer-tools PATCH v2 20/33] dim: abstract dim apply* subcommands Jani Nikula
2016-01-28 13:27 ` [maintainer-tools PATCH v2 21/33] dim: abstract dim_magic_rebase_resolve Jani Nikula
2016-01-28 13:27 ` [maintainer-tools PATCH v2 22/33] dim: abstract dim_cat_to_fixup Jani Nikula
2016-01-28 13:27 ` [maintainer-tools PATCH v2 23/33] dim: abstract dim_tc Jani Nikula
2016-01-28 13:27 ` [maintainer-tools PATCH v2 24/33] dim: abstract dim_fixes Jani Nikula
2016-01-28 13:27 ` [maintainer-tools PATCH v2 25/33] dim: abstract dim_cherry_pick Jani Nikula
2016-01-28 13:27 ` [maintainer-tools PATCH v2 26/33] dim: abstract dim_pull_request_* Jani Nikula
2016-01-28 13:27 ` [maintainer-tools PATCH v2 27/33] dim: abstract dim_update_next Jani Nikula
2016-01-28 13:27 ` [maintainer-tools PATCH v2 28/33] dim: abstract dim_tag_next Jani Nikula
2016-01-28 13:27 ` [maintainer-tools PATCH v2 29/33] dim: abstract dim_{create, remove}_branch Jani Nikula
2016-01-28 13:27 ` [maintainer-tools PATCH v2 30/33] dim: abstract dim_checker Jani Nikula
2016-01-28 13:27 ` [maintainer-tools PATCH v2 31/33] dim: abstract dim_help Jani Nikula
2016-01-28 13:27 ` [maintainer-tools PATCH v2 32/33] dim: show usage instead of the man page on unknown subcommands Jani Nikula
2016-01-28 13:27 ` [maintainer-tools PATCH v2 33/33] dim: add -h option for usage, imrove output on unknown options Jani Nikula
2016-01-28 15:12 ` [maintainer-tools PATCH v2 00/33] dim: function based subcommand handling Jani Nikula

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.