Skip to contentSkip to conversation

completion: shellcheck bash completion and fix issues

PATCH In review Jani Nikula 2 participants 10 messages Mar 24, 2017 – Mar 27, 2017 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/7 completion: shellcheck bash completion and fix issues

Add bash_completion to 'make shellcheck' target, and fix the failures.

---
 Makefile        |  2 +-
 bash_completion | 13 +++++++------
 2 files changed, 8 insertions(+), 7 deletions(-)
Makefile +1 -1
index 30fc3dd3bff8..c1fe02c1b565 100644
@@ -30,7 +30,7 @@ SC_EXCLUDE := \
 	-e SC2143
 
 shellcheck:
-	shellcheck $(SC_EXCLUDE) dim
+	shellcheck $(SC_EXCLUDE) dim bash_completion
 
 clean:
 	rm -f drm-intel.html drm-intel-flow.svg dim.html drm-misc.html
bash_completion +7 -6
index 9f659b4ebcce..7dfc4b86cb13 100644
@@ -3,7 +3,7 @@
 dim ()
 {
 	if [[ "x$1" = "xcd" ]]; then
-		cd `cat ~/.dim-last-path`
+		cd $(cat ~/.dim-last-path) || exit
 	else
 		command dim "$@"
 	fi
@@ -12,6 +12,7 @@ dim ()
 _dim ()
 {
 	local args arg cur prev words cword split
+	local nightly_branches upstream_branches opts cmds aliasref
 
 	# require bash-completion with _init_completion
 	type -t _init_completion >/dev/null 2>&1 || return
@@ -26,18 +27,18 @@ _dim ()
 	# args = number of arguments
 	_count_args
 
-	local nightly_branches="$(dim list-branches)"
-	local upstream_branches="$(dim list-upstreams)"
+	nightly_branches="$(dim list-branches)"
+	upstream_branches="$(dim list-upstreams)"
 
 	if [ -z "${arg}" ]; then
 		# top level completion
 		case "${cur}" in
 			-*)
-				local opts="-d -f -i"
+				opts="-d -f -i"
 				COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
 				;;
 			*)
-				local cmds="$(dim list-commands) $(dim list-aliases | sed 's/\t.*//')"
+				cmds="$(dim list-commands) $(dim list-aliases | sed 's/\t.*//')"
 				COMPREPLY=( $(compgen -W "${cmds}" -- ${cur}) )
 				;;
 		esac
@@ -45,7 +46,7 @@ _dim ()
 	fi
 
 	# complete aliases like the actual command
-	local aliasref=$(dim list-aliases | sed -n "s/^${arg}\t\(.*\)/\1/p")
+	aliasref=$(dim list-aliases | sed -n "s/^${arg}\t\(.*\)/\1/p")
 	if [[ -n "$aliasref" ]]; then
 		arg="$aliasref"
 	fi
Signature · 6 lines
2.1.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH 2/7 dim: return error exit status on unknown subcommands

---
 dim | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
dim +5 -4
index 989674ab7a91..fc72cd619dbd 100755
@@ -1840,11 +1840,12 @@ if ! declare -n subcmd=dim_alias_${subcommand//-/_} &> /dev/null || \
 	subcmd="$subcommand"
 fi
 
-# if there's a function by the subcommand name, call it
+# look up the function by the subcommand name
 subcmd_func=dim_${subcmd//-/_}
-if declare -f $subcmd_func >/dev/null; then
-	$subcmd_func "$@"
-else
+if ! declare -f $subcmd_func >/dev/null; then
 	echoerr "'$subcommand' is not a dim command."
 	dim_usage
+	exit 1
 fi
+
+$subcmd_func "$@"
Signature · 6 lines
2.1.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

PATCH 3/7 dim: add 'make mancheck' target to check all subcommands have been documented

In reply to Jani Nikula

Just a simple grep.

---
 Makefile | 7 +++++++
 1 file changed, 7 insertions(+)
Makefile +7 -0
index c1fe02c1b565..ce283114c4aa 100644
@@ -32,6 +32,13 @@ SC_EXCLUDE := \
 shellcheck:
 	shellcheck $(SC_EXCLUDE) dim bash_completion
 
+mancheck:
+	@for cmd in $$(dim list-commands); do \
+		if ! grep -q "^$$cmd" dim.rst; then \
+			echo "$$cmd not documented"; \
+		fi \
+	done
+
 clean:
 	rm -f drm-intel.html drm-intel-flow.svg dim.html drm-misc.html
 
Signature · 6 lines
2.1.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

Re: [dim PATCH 3/7] dim: add 'make mancheck' target to check all subcommands have been documented

Quoted 12 lines · Jani Nikula

Just a simple grep.

---
 Makefile | 7 +++++++
 1 file changed, 7 insertions(+)
Makefile +0 -0
index c1fe02c1b565..ce283114c4aa 100644

Makefile SC_EXCLUDE := \ · line 41

Quoted 10 lines
Makefile +7 -0
@@ -32,6 +32,13 @@ SC_EXCLUDE := \
 shellcheck:
 	shellcheck $(SC_EXCLUDE) dim bash_completion
 
+mancheck:
+	@for cmd in $$(dim list-commands); do \
+		if ! grep -q "^$$cmd" dim.rst; then \
+			echo "$$cmd not documented"; \
+		fi \
+	done
+

Please add

check: mancheck shellcheck all

or whatever the Makefile magic for this is. I don't want to remember running piles of commands before pushing/sending out some dim patches :-)

With that, acked.
-Daniel

Quoted 10 lines
Makefile +0 -0
 clean:
 	rm -f drm-intel.html drm-intel-flow.svg dim.html drm-misc.html
 
Signature · 6 lines
2.1.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw

PATCH 4/7 dim: remove aliases from the man page

In reply to Jani Nikula

Increase clarity. People can list the aliases using 'dim list-aliases' and add their own.

---
 dim.rst | 55 +++++++++++++++++++++++++++++--------------------------
 1 file changed, 29 insertions(+), 26 deletions(-)
dim.rst +29 -26
index 1bec3838bace..aa1c5d62606e 100644
@@ -101,6 +101,9 @@ OPTIONS
 COMMANDS
 ========
 
+Many of the commands have default aliases. See **dim list-aliases** for the list
+of aliases.
+
 setup *prefix*
 --------------
 Setup git maintainer branches in the given prefix.
@@ -137,22 +140,22 @@ Pipes stdin into the fixup patch file for the current drm-tip merge.
 push-branch branch [*git push arguments*]
 -----------------------------------------
 
-push-fixes|pf [*git push arguments*]
-------------------------------------
+push-fixes [*git push arguments*]
+---------------------------------
 
-push-next-fixes|pnf [*git push arguments*]
-------------------------------------------
+push-next-fixes [*git push arguments*]
+--------------------------------------
 
-push-queued|pq [*git push arguments*]
--------------------------------------
+push-queued [*git push arguments*]
+----------------------------------
 
 Updates the named branch, or drm-intel-fixes, drm-intel-next-fixes or the
 drm-intel-next-queued branch respectively. Complains if that's not the current
 branch, assuming that patches got merged to the wrong branch. After pushing also
 updates linux-next and drm-tip branches.
 
-checkout|co *branch*
---------------------
+checkout *branch*
+-----------------
 Checks out the named branch.
 
 conq
@@ -166,19 +169,19 @@ conf
 Checks out the drm-intel-fixes branch, dinf or dinq respectively for merging
 patches.
 
-apply-branch|ab|sob branch [*git am arguments*]
------------------------------------------------
+apply-branch branch [*git am arguments*]
+----------------------------------------
 Applys a patch to the given branch, complaining if it is not
 checked out yet.
 
-apply-fixes|af [*git am arguments*]
------------------------------------
+apply-fixes [*git am arguments*]
+--------------------------------
 
-apply-next-fixes|anf [*git am arguments*]
------------------------------------------
+apply-next-fixes [*git am arguments*]
+-------------------------------------
 
-apply-queued|aq [*git am arguments*]
-------------------------------------
+apply-queued [*git am arguments*]
+---------------------------------
 Applies a patch to -fixes, -next-fixes or -next-queued respectively, complains
 if it's not the right branch. Additional arguments are passed to git am.
 
@@ -198,8 +201,8 @@ This extracts various tags (eg. Reviwed-by:) from emails and applies them to the
 top commit on the given branch. You can give the comamnd a rangeish to add the
 tags from the same email to multiple already applied patches.
 
-magic-patch|mp [-a]
--------------------
+magic-patch [-a]
+----------------
 Apply a patch using patch and then wiggle in any conflicts. When passing the
 option -a automatically changes the working directory into the git repository
 used by the last previous branch-specific command. This is useful with the
@@ -219,8 +222,8 @@ add-link-next-fixes
 
 This command adds the Link: tag (for patches that failed to apply directly).
 
-magic-rebase-resolve|mrr
-------------------------
+magic-rebase-resolve
+--------------------
 Tries to resolve a rebase conflict by first resetting the tree
 and the using the magic patch tool. Then builds the tree, adds
 any changes with git add -u and continues the rebase.
@@ -232,13 +235,13 @@ branch-specific command. This is implemented as a bash-function to make it
 useful in interactive shells and scripts. Only available when the bash
 completion is sourced.
 
-apply-resolved|ar
------------------
+apply-resolved
+--------------
 Compile-test the current tree and if successfully resolve a
 confilicted git am. Also runs the patch checker afterwards.
 
-apply-igt|ai
-------------
+apply-igt
+---------
 Apply a patch to the i-g-t repository.
 
 tc *commit-ish*
@@ -320,8 +323,8 @@ remote is up-to-date. Useful if drm-intel-next has been changed since the last
 run of the update-next command (e.g. to apply a hotfix before sending out the
 pull request).
 
-checkpatch|check-patch|cp [*commit-ish* [.. *commit-ish*]]
-----------------------------------------------------------
+checkpatch [*commit-ish* [.. *commit-ish*]]
+-------------------------------------------
 Runs the given commit range commit-ish..commit-ish through the check tools.
 
 If no commit-ish is passed, defaults to HEAD^..HEAD. If one commit-ish is passed
Signature · 6 lines
2.1.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw

PATCH 5/7 dim: remove apply-igt subcommand

In reply to Jani Nikula

Out of scope for dim, and relies on hard coded paths. People can add the function to their .dimrc if needed.

---
 dim     | 7 -------
 dim.rst | 4 ----
 2 files changed, 11 deletions(-)
dim +0 -7
index fc72cd619dbd..b7d6b2aafff6 100755
@@ -915,13 +915,6 @@ function dim_magic_rebase_resolve
 	git rebase --continue
 }
 
-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
 {
dim.rst +0 -4
index aa1c5d62606e..1fc64e4799a4 100644
@@ -240,10 +240,6 @@ apply-resolved
 Compile-test the current tree and if successfully resolve a
 confilicted git am. Also runs the patch checker afterwards.
 
-apply-igt
----------
-Apply a patch to the i-g-t repository.
-
 tc *commit-ish*
 ---------------
 Print the oldest Linux kernel release or -rc tag that contains the supplied
Signature · 6 lines
2.1.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw

PATCH 6/7 dim: document drm-intel specific shorthands separately from the generic ones

In reply to Jani Nikula

Hopefully increases clarity for people not working on drm-intel.

---
 dim.rst | 57 +++++++++++++++++++++++++++++----------------------------
 1 file changed, 29 insertions(+), 28 deletions(-)
dim.rst +29 -28
index 1fc64e4799a4..f595f10ab0e7 100644
@@ -139,6 +139,9 @@ Pipes stdin into the fixup patch file for the current drm-tip merge.
 
 push-branch branch [*git push arguments*]
 -----------------------------------------
+Updates the named branch. Complains if that's not the current branch, assuming
+that patches got merged to the wrong branch. After pushing also updates
+linux-next and drm-tip branches.
 
 push-fixes [*git push arguments*]
 ---------------------------------
@@ -148,31 +151,27 @@ push-next-fixes [*git push arguments*]
 
 push-queued [*git push arguments*]
 ----------------------------------
-
-Updates the named branch, or drm-intel-fixes, drm-intel-next-fixes or the
-drm-intel-next-queued branch respectively. Complains if that's not the current
-branch, assuming that patches got merged to the wrong branch. After pushing also
-updates linux-next and drm-tip branches.
+**push-branch** shorthands for *drm-intel-fixes*, *drm-intel-next-fixes*, and
+*drm-intel-next-queued* branches respectively.
 
 checkout *branch*
 -----------------
 Checks out the named branch.
 
-conq
-----
-
 cof
 ---
 
 conf
 ----
-Checks out the drm-intel-fixes branch, dinf or dinq respectively for merging
-patches.
+
+conq
+----
+**checkout** shorthands for *drm-intel-fixes*, *drm-intel-next-fixes*, and
+*drm-intel-next-queued* branches respectively.
 
 apply-branch branch [*git am arguments*]
 ----------------------------------------
-Applys a patch to the given branch, complaining if it is not
-checked out yet.
+Applys a patch to the given branch, complaining if it is not checked out yet.
 
 apply-fixes [*git am arguments*]
 --------------------------------
@@ -182,14 +181,14 @@ apply-next-fixes [*git am arguments*]
 
 apply-queued [*git am arguments*]
 ---------------------------------
-Applies a patch to -fixes, -next-fixes or -next-queued respectively, complains
-if it's not the right branch. Additional arguments are passed to git am.
+**apply-branch** shorthands for *drm-intel-fixes*, *drm-intel-next-fixes*, and
+*drm-intel-next-queued* branches respectively.
 
 extract-tags *branch* [*git-rangeish*]
 --------------------------------------
-
-extract-queued [*git-rangeish*]
--------------------------------
+This extracts various tags (eg. Reviwed-by:) from emails and applies them to the
+top commit on the given branch. You can give the command a rangeish to add the
+tags from the same email to multiple already applied patches.
 
 extract-fixes [*git-rangeish*]
 ------------------------------
@@ -197,9 +196,10 @@ extract-fixes [*git-rangeish*]
 extract-next-fixes [*git-rangeish*]
 -----------------------------------
 
-This extracts various tags (eg. Reviwed-by:) from emails and applies them to the
-top commit on the given branch. You can give the comamnd a rangeish to add the
-tags from the same email to multiple already applied patches.
+extract-queued [*git-rangeish*]
+-------------------------------
+**extract-tags** shorthands for *drm-intel-fixes*, *drm-intel-next-fixes*, and
+*drm-intel-next-queued* branches respectively.
 
 magic-patch [-a]
 ----------------
@@ -210,9 +210,7 @@ per-branch workdir model.
 
 add-link *branch*
 -----------------
-
-add-link-queued
----------------
+This command adds the Link: tag (for patches that failed to apply directly).
 
 add-link-fixes
 --------------
@@ -220,7 +218,10 @@ add-link-fixes
 add-link-next-fixes
 -------------------
 
-This command adds the Link: tag (for patches that failed to apply directly).
+add-link-queued
+---------------
+**add-link** shorthands for *drm-intel-fixes*, *drm-intel-next-fixes*, and
+*drm-intel-next-queued* branches respectively.
 
 magic-rebase-resolve
 --------------------
@@ -282,13 +283,13 @@ regenerated with the same commands if something goes wrong.
 
 pull-request-fixes [*upstream*]
 -------------------------------
-This is a special case of **pull-request**, with *drm-intel-fixes* as the
-branch and *origin/master* as the default upstream.
+**pull-request** shorthand for *drm-intel-fixes* as the branch and
+*origin/master* as the default upstream.
 
 pull-request-next-fixes [*upstream*]
 ------------------------------------
-This is a special case of **pull-request**, with *drm-intel-next-fixes* as
-the branch and *\$DRM_UPSTREAM/drm-next* as the default upstream.
+**pull-request** shorthand for *drm-intel-next-fixes* as the branch and
+*\$DRM_UPSTREAM/drm-next* as the default upstream.
 
 pull-request-next [*upstream*]
 ------------------------------
Signature · 6 lines
2.1.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#7 lore raw

PATCH 7/7 dim: group command documentation in the man page by target audiences

In reply to Jani Nikula

Group the man page by:

- commands for developers
- commands for committers and maintainers
- advanced commands for committers and maintainers
- commands for maintainers
- dim help commands.

We have so many commands by now that it should be helpful to group them a little.

---
 dim.rst | 225 ++++++++++++++++++++++++++++++++--------------------------------
 1 file changed, 113 insertions(+), 112 deletions(-)
dim.rst +113 -112
index f595f10ab0e7..22b2e1487d1b 100644
@@ -101,58 +101,72 @@ OPTIONS
 COMMANDS
 ========
 
-Many of the commands have default aliases. See **dim list-aliases** for the list
-of aliases.
+The commands are grouped by target audiences and functionality below. Many of
+the commands have default aliases. See **dim list-aliases** for the list of
+aliases.
 
-setup *prefix*
---------------
-Setup git maintainer branches in the given prefix.
+COMMANDS FOR DEVELOPERS
+=======================
 
-update-branches
+tc *commit-ish*
 ---------------
-Updates all maintainer branches. Useful to synchronize all branches when other
-maintainers and committers pushed patches meanwhile.
+Print the oldest Linux kernel release or -rc tag that contains the supplied
+*commit-ish*, or, if none do, print the upstream branches that contain it.
 
-status
-------
+cite *commit-ish*
+-----------------
+Cite the supplied *commit-ish* in format 'sha1 ("commit subject")'.
 
-Lists all branches with unmerged patches, and how many patches are unmerged.
+fixes *commit-ish*
+------------------
+Print the Fixes: and Cc: lines for the supplied *commit-ish* in the linux kernel
+CodingStyle approved format.
 
-rebuild-tip
------------
-Rebuild and push the integration tree.
+checkpatch [*commit-ish* [.. *commit-ish*]]
+-------------------------------------------
+Runs the given commit range commit-ish..commit-ish through the check tools.
 
-revert-rerere *rerere-cache-commit-ish*
+If no commit-ish is passed, defaults to HEAD^..HEAD. If one commit-ish is passed
+instead of a range, the range commit-ish..HEAD is used.
+
+sparse [*commit-ish* [.. *commit-ish*]]
 ---------------------------------------
+Run sparse on the files changed by the given commit range.
 
-When a stored conflict resolution in the integration tree is wrong, this command
-can be used to fix up the mess. First figure out which commit in the
-*rerere-cache* branch contains the bogus conflict resolution, then revert it
-using this command. This ensures the resolution is also purged from any local
-caches, to make sure it doesn't get resurrected. Then run *rebuild-tip* to
-redo the merges, correctly.
+If no commit-ish is passed, defaults to HEAD^..HEAD. If one commit-ish is passed
+instead of a range, the range commit-ish..HEAD is used.
 
-cat-to-fixup
-------------
+checker
+-------
+Run sparse on drm/i915.
 
-Pipes stdin into the fixup patch file for the current drm-tip merge.
+retip [*branch*] [*git-rebase option* ...]
+------------------------------------------
+Rebase the given local branch, current branch by default, onto drm-tip. Options
+after the branch will be passed to **git-rebase**.
 
-push-branch branch [*git push arguments*]
------------------------------------------
-Updates the named branch. Complains if that's not the current branch, assuming
-that patches got merged to the wrong branch. After pushing also updates
-linux-next and drm-tip branches.
+COMMANDS FOR COMMITTERS AND MAINTAINERS
+=======================================
 
-push-fixes [*git push arguments*]
----------------------------------
+setup *prefix*
+--------------
+Setup git maintainer branches in the given prefix.
 
-push-next-fixes [*git push arguments*]
---------------------------------------
+update-branches
+---------------
+Updates all maintainer branches. Useful to synchronize all branches when other
+maintainers and committers pushed patches meanwhile.
 
-push-queued [*git push arguments*]
-----------------------------------
-**push-branch** shorthands for *drm-intel-fixes*, *drm-intel-next-fixes*, and
-*drm-intel-next-queued* branches respectively.
+status
+------
+Lists all branches with unmerged patches, and how many patches are unmerged.
+
+cd
+--
+Changes the working directory into the git repository used by the last previous
+branch-specific command. This is implemented as a bash-function to make it
+useful in interactive shells and scripts. Only available when the bash
+completion is sourced.
 
 checkout *branch*
 -----------------
@@ -201,6 +215,43 @@ extract-queued [*git-rangeish*]
 **extract-tags** shorthands for *drm-intel-fixes*, *drm-intel-next-fixes*, and
 *drm-intel-next-queued* branches respectively.
 
+push-branch branch [*git push arguments*]
+-----------------------------------------
+Updates the named branch. Complains if that's not the current branch, assuming
+that patches got merged to the wrong branch. After pushing also updates
+linux-next and drm-tip branches.
+
+push-fixes [*git push arguments*]
+---------------------------------
+
+push-next-fixes [*git push arguments*]
+--------------------------------------
+
+push-queued [*git push arguments*]
+----------------------------------
+**push-branch** shorthands for *drm-intel-fixes*, *drm-intel-next-fixes*, and
+*drm-intel-next-queued* branches respectively.
+
+rebuild-tip
+-----------
+Rebuild and push the integration tree.
+
+ADVANCED COMMANDS FOR COMMITTERS AND MAINTAINERS
+================================================
+
+revert-rerere *rerere-cache-commit-ish*
+---------------------------------------
+When a stored conflict resolution in the integration tree is wrong, this command
+can be used to fix up the mess. First figure out which commit in the
+*rerere-cache* branch contains the bogus conflict resolution, then revert it
+using this command. This ensures the resolution is also purged from any local
+caches, to make sure it doesn't get resurrected. Then run *rebuild-tip* to redo
+the merges, correctly.
+
+cat-to-fixup
+------------
+Pipes stdin into the fixup patch file for the current drm-tip merge.
+
 magic-patch [-a]
 ----------------
 Apply a patch using patch and then wiggle in any conflicts. When passing the
@@ -229,35 +280,39 @@ Tries to resolve a rebase conflict by first resetting the tree
 and the using the magic patch tool. Then builds the tree, adds
 any changes with git add -u and continues the rebase.
 
-cd
---
-Changes the working directory into the git repository used by the last previous
-branch-specific command. This is implemented as a bash-function to make it
-useful in interactive shells and scripts. Only available when the bash
-completion is sourced.
-
 apply-resolved
 --------------
 Compile-test the current tree and if successfully resolve a
 confilicted git am. Also runs the patch checker afterwards.
 
-tc *commit-ish*
----------------
-Print the oldest Linux kernel release or -rc tag that contains the supplied
-*commit-ish*, or, if none do, print the upstream branches that contain it.
+create-branch *branch* [*commit-ish*]
+-------------------------------------
+Create a new topic branch with the given name. Note that topic/ is not
+automatically prepended. The branch starts at HEAD or the given commit-ish. Note
+that by default the new branch is created in the drm-intel.git repository. If
+you want to create a branch somewhere else, then you need to prepend the remote
+name from nigthly.conf, e.g. "drm-misc/topic/branch".
 
-cite *commit-ish*
------------------
-Cite the supplied *commit-ish* in format 'sha1 ("commit subject")'.
+remove-branch *branch*
+----------------------
+Remove the given topic branch.
 
-fixes *commit-ish*
-------------------
-Print the Fixes: and Cc: lines for the supplied *commit-ish* in the linux kernel
-CodingStyle approved format.
+create-workdir (*branch* | all)
+-------------------------------
+Create a separate workdir for the branch with the given name (requires that
+git-new-workdir from git-core contrib is installed), or for all branches if
+"all" is given.
+
+for-each-workdir|fw *command*
+-----------------------------
+Run the given command in all active workdirs including the main repository under
+\$DIM_DRM_INTEL.
+
+COMMANDS FOR MAINTAINERS
+========================
 
 cherry-pick *commit-ish* [*git cherry-pick arguments*]
 ------------------------------------------------------
-
 Improved git cherry-pick version which also scans drm-tip picked, too. In
 dry-run mode/-d only the patch list is generated.
 
@@ -266,7 +321,6 @@ cherry-pick-fixes
 
 cherry-pick-next-fixes
 ----------------------
-
 Look for non-upstreamed fixes (commits tagged Cc: [email protected] or Cc:
 [email protected]) in drm-intel-next-queued, and try to
 cherry-pick them to drm-intel-fixes or drm-intel-next-fixes.
@@ -314,56 +368,13 @@ merged into drm-tip to avoid operator error.
 
 tag-next
 --------
-
 Pushes a new tag for the current drm-intel-next state after checking that the
 remote is up-to-date. Useful if drm-intel-next has been changed since the last
 run of the update-next command (e.g. to apply a hotfix before sending out the
 pull request).
 
-checkpatch [*commit-ish* [.. *commit-ish*]]
--------------------------------------------
-Runs the given commit range commit-ish..commit-ish through the check tools.
-
-If no commit-ish is passed, defaults to HEAD^..HEAD. If one commit-ish is passed
-instead of a range, the range commit-ish..HEAD is used.
-
-sparse [*commit-ish* [.. *commit-ish*]]
----------------------------------------
-Run sparse on the files changed by the given commit range.
-
-If no commit-ish is passed, defaults to HEAD^..HEAD. If one commit-ish is passed
-instead of a range, the range commit-ish..HEAD is used.
-
-checker
--------
-Run sparse on drm/i915.
-
-create-branch *branch* [*commit-ish*]
--------------------------------------
-
-Create a new topic branch with the given name. Note that topic/ is not
-automatically prepended. The branch starts at HEAD or the given commit-ish. Note
-that by default the new branch is created in the drm-intel.git repository. If
-you want to create a branch somewhere else, then you need to prepend the remote
-name from nigthly.conf, e.g. "drm-misc/topic/branch".
-
-remove-branch *branch*
-----------------------
-
-Remove the given topic branch.
-
-create-workdir (*branch* | all)
--------------------------------
-
-Create a separate workdir for the branch with the given name (requires that
-git-new-workdir from git-core contrib is installed), or for all branches if
-"all" is given.
-
-for-each-workdir|fw *command*
------------------------------
-
-Run the given command in all active workdirs including the main repository under
-\$DIM_DRM_INTEL.
+DIM HELP COMMANDS
+=================
 
 list-aliases
 ------------
@@ -373,18 +384,15 @@ See \$dim_alias_<alias> under ENVIRONMENT below on how to define aliases.
 
 list-branches
 -------------
-
 List all branches (main and topic) managed by dim. Useful for autocompletion
 scripts.
 
 list-commands
 -------------
-
 List all subcommand names, including aliases. Useful for autocompletion scripts.
 
 list-upstreams
 --------------
-
 List of all upstreams commonly used for pull requests. Useful for autocompletion
 scripts.
 
@@ -392,19 +400,12 @@ uptodate
 --------
 Try to check if you're running an up-to-date version of **dim**.
 
-retip [*branch*] [*git-rebase option* ...]
-------------------------------------------
-
-Rebase the given local branch, current branch by default, onto drm-tip. Options
-after the branch will be passed to **git-rebase**.
-
 help
 ----
 Show this help. Install **rst2man(1)** for best results.
 
 usage
 -----
-
 Short form usage help listening all subcommands. Run by default or if an unknown
 subcommand was passed on the cmdline.
 
Signature · 6 lines
2.1.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Acked-by on v1 7/7
#8 lore raw

Re: [dim PATCH 7/7] dim: group command documentation in the man page by target audiences

Quoted 8 lines · Jani Nikula

Group the man page by:

- commands for developers
- commands for committers and maintainers
- advanced commands for committers and maintainers
- commands for maintainers
- dim help commands.

Quoted 4 lines

We have so many commands by now that it should be helpful to group them a little.

Awesome!

All the remaining patches, this one included:

Quoted 334 lines
---
 dim.rst | 225 ++++++++++++++++++++++++++++++++--------------------------------
 1 file changed, 113 insertions(+), 112 deletions(-)
dim.rst +113 -112
index f595f10ab0e7..22b2e1487d1b 100644
@@ -101,58 +101,72 @@ OPTIONS
 COMMANDS
 ========
 
-Many of the commands have default aliases. See **dim list-aliases** for the list
-of aliases.
+The commands are grouped by target audiences and functionality below. Many of
+the commands have default aliases. See **dim list-aliases** for the list of
+aliases.
 
-setup *prefix*
---------------
-Setup git maintainer branches in the given prefix.
+COMMANDS FOR DEVELOPERS
+=======================
 
-update-branches
+tc *commit-ish*
 ---------------
-Updates all maintainer branches. Useful to synchronize all branches when other
-maintainers and committers pushed patches meanwhile.
+Print the oldest Linux kernel release or -rc tag that contains the supplied
+*commit-ish*, or, if none do, print the upstream branches that contain it.
 
-status
-------
+cite *commit-ish*
+-----------------
+Cite the supplied *commit-ish* in format 'sha1 ("commit subject")'.
 
-Lists all branches with unmerged patches, and how many patches are unmerged.
+fixes *commit-ish*
+------------------
+Print the Fixes: and Cc: lines for the supplied *commit-ish* in the linux kernel
+CodingStyle approved format.
 
-rebuild-tip
------------
-Rebuild and push the integration tree.
+checkpatch [*commit-ish* [.. *commit-ish*]]
+-------------------------------------------
+Runs the given commit range commit-ish..commit-ish through the check tools.
 
-revert-rerere *rerere-cache-commit-ish*
+If no commit-ish is passed, defaults to HEAD^..HEAD. If one commit-ish is passed
+instead of a range, the range commit-ish..HEAD is used.
+
+sparse [*commit-ish* [.. *commit-ish*]]
 ---------------------------------------
+Run sparse on the files changed by the given commit range.
 
-When a stored conflict resolution in the integration tree is wrong, this command
-can be used to fix up the mess. First figure out which commit in the
-*rerere-cache* branch contains the bogus conflict resolution, then revert it
-using this command. This ensures the resolution is also purged from any local
-caches, to make sure it doesn't get resurrected. Then run *rebuild-tip* to
-redo the merges, correctly.
+If no commit-ish is passed, defaults to HEAD^..HEAD. If one commit-ish is passed
+instead of a range, the range commit-ish..HEAD is used.
 
-cat-to-fixup
-------------
+checker
+-------
+Run sparse on drm/i915.
 
-Pipes stdin into the fixup patch file for the current drm-tip merge.
+retip [*branch*] [*git-rebase option* ...]
+------------------------------------------
+Rebase the given local branch, current branch by default, onto drm-tip. Options
+after the branch will be passed to **git-rebase**.
 
-push-branch branch [*git push arguments*]
------------------------------------------
-Updates the named branch. Complains if that's not the current branch, assuming
-that patches got merged to the wrong branch. After pushing also updates
-linux-next and drm-tip branches.
+COMMANDS FOR COMMITTERS AND MAINTAINERS
+=======================================
 
-push-fixes [*git push arguments*]
----------------------------------
+setup *prefix*
+--------------
+Setup git maintainer branches in the given prefix.
 
-push-next-fixes [*git push arguments*]
---------------------------------------
+update-branches
+---------------
+Updates all maintainer branches. Useful to synchronize all branches when other
+maintainers and committers pushed patches meanwhile.
 
-push-queued [*git push arguments*]
-----------------------------------
-**push-branch** shorthands for *drm-intel-fixes*, *drm-intel-next-fixes*, and
-*drm-intel-next-queued* branches respectively.
+status
+------
+Lists all branches with unmerged patches, and how many patches are unmerged.
+
+cd
+--
+Changes the working directory into the git repository used by the last previous
+branch-specific command. This is implemented as a bash-function to make it
+useful in interactive shells and scripts. Only available when the bash
+completion is sourced.
 
 checkout *branch*
 -----------------
@@ -201,6 +215,43 @@ extract-queued [*git-rangeish*]
 **extract-tags** shorthands for *drm-intel-fixes*, *drm-intel-next-fixes*, and
 *drm-intel-next-queued* branches respectively.
 
+push-branch branch [*git push arguments*]
+-----------------------------------------
+Updates the named branch. Complains if that's not the current branch, assuming
+that patches got merged to the wrong branch. After pushing also updates
+linux-next and drm-tip branches.
+
+push-fixes [*git push arguments*]
+---------------------------------
+
+push-next-fixes [*git push arguments*]
+--------------------------------------
+
+push-queued [*git push arguments*]
+----------------------------------
+**push-branch** shorthands for *drm-intel-fixes*, *drm-intel-next-fixes*, and
+*drm-intel-next-queued* branches respectively.
+
+rebuild-tip
+-----------
+Rebuild and push the integration tree.
+
+ADVANCED COMMANDS FOR COMMITTERS AND MAINTAINERS
+================================================
+
+revert-rerere *rerere-cache-commit-ish*
+---------------------------------------
+When a stored conflict resolution in the integration tree is wrong, this command
+can be used to fix up the mess. First figure out which commit in the
+*rerere-cache* branch contains the bogus conflict resolution, then revert it
+using this command. This ensures the resolution is also purged from any local
+caches, to make sure it doesn't get resurrected. Then run *rebuild-tip* to redo
+the merges, correctly.
+
+cat-to-fixup
+------------
+Pipes stdin into the fixup patch file for the current drm-tip merge.
+
 magic-patch [-a]
 ----------------
 Apply a patch using patch and then wiggle in any conflicts. When passing the
@@ -229,35 +280,39 @@ Tries to resolve a rebase conflict by first resetting the tree
 and the using the magic patch tool. Then builds the tree, adds
 any changes with git add -u and continues the rebase.
 
-cd
---
-Changes the working directory into the git repository used by the last previous
-branch-specific command. This is implemented as a bash-function to make it
-useful in interactive shells and scripts. Only available when the bash
-completion is sourced.
-
 apply-resolved
 --------------
 Compile-test the current tree and if successfully resolve a
 confilicted git am. Also runs the patch checker afterwards.
 
-tc *commit-ish*
----------------
-Print the oldest Linux kernel release or -rc tag that contains the supplied
-*commit-ish*, or, if none do, print the upstream branches that contain it.
+create-branch *branch* [*commit-ish*]
+-------------------------------------
+Create a new topic branch with the given name. Note that topic/ is not
+automatically prepended. The branch starts at HEAD or the given commit-ish. Note
+that by default the new branch is created in the drm-intel.git repository. If
+you want to create a branch somewhere else, then you need to prepend the remote
+name from nigthly.conf, e.g. "drm-misc/topic/branch".
 
-cite *commit-ish*
------------------
-Cite the supplied *commit-ish* in format 'sha1 ("commit subject")'.
+remove-branch *branch*
+----------------------
+Remove the given topic branch.
 
-fixes *commit-ish*
-------------------
-Print the Fixes: and Cc: lines for the supplied *commit-ish* in the linux kernel
-CodingStyle approved format.
+create-workdir (*branch* | all)
+-------------------------------
+Create a separate workdir for the branch with the given name (requires that
+git-new-workdir from git-core contrib is installed), or for all branches if
+"all" is given.
+
+for-each-workdir|fw *command*
+-----------------------------
+Run the given command in all active workdirs including the main repository under
+\$DIM_DRM_INTEL.
+
+COMMANDS FOR MAINTAINERS
+========================
 
 cherry-pick *commit-ish* [*git cherry-pick arguments*]
 ------------------------------------------------------
-
 Improved git cherry-pick version which also scans drm-tip picked, too. In
 dry-run mode/-d only the patch list is generated.
 
@@ -266,7 +321,6 @@ cherry-pick-fixes
 
 cherry-pick-next-fixes
 ----------------------
-
 Look for non-upstreamed fixes (commits tagged Cc: [email protected] or Cc:
 [email protected]) in drm-intel-next-queued, and try to
 cherry-pick them to drm-intel-fixes or drm-intel-next-fixes.
@@ -314,56 +368,13 @@ merged into drm-tip to avoid operator error.
 
 tag-next
 --------
-
 Pushes a new tag for the current drm-intel-next state after checking that the
 remote is up-to-date. Useful if drm-intel-next has been changed since the last
 run of the update-next command (e.g. to apply a hotfix before sending out the
 pull request).
 
-checkpatch [*commit-ish* [.. *commit-ish*]]
--------------------------------------------
-Runs the given commit range commit-ish..commit-ish through the check tools.
-
-If no commit-ish is passed, defaults to HEAD^..HEAD. If one commit-ish is passed
-instead of a range, the range commit-ish..HEAD is used.
-
-sparse [*commit-ish* [.. *commit-ish*]]
----------------------------------------
-Run sparse on the files changed by the given commit range.
-
-If no commit-ish is passed, defaults to HEAD^..HEAD. If one commit-ish is passed
-instead of a range, the range commit-ish..HEAD is used.
-
-checker
--------
-Run sparse on drm/i915.
-
-create-branch *branch* [*commit-ish*]
--------------------------------------
-
-Create a new topic branch with the given name. Note that topic/ is not
-automatically prepended. The branch starts at HEAD or the given commit-ish. Note
-that by default the new branch is created in the drm-intel.git repository. If
-you want to create a branch somewhere else, then you need to prepend the remote
-name from nigthly.conf, e.g. "drm-misc/topic/branch".
-
-remove-branch *branch*
-----------------------
-
-Remove the given topic branch.
-
-create-workdir (*branch* | all)
--------------------------------
-
-Create a separate workdir for the branch with the given name (requires that
-git-new-workdir from git-core contrib is installed), or for all branches if
-"all" is given.
-
-for-each-workdir|fw *command*
------------------------------
-
-Run the given command in all active workdirs including the main repository under
-\$DIM_DRM_INTEL.
+DIM HELP COMMANDS
+=================
 
 list-aliases
 ------------
@@ -373,18 +384,15 @@ See \$dim_alias_<alias> under ENVIRONMENT below on how to define aliases.
 
 list-branches
 -------------
-
 List all branches (main and topic) managed by dim. Useful for autocompletion
 scripts.
 
 list-commands
 -------------
-
 List all subcommand names, including aliases. Useful for autocompletion scripts.
 
 list-upstreams
 --------------
-
 List of all upstreams commonly used for pull requests. Useful for autocompletion
 scripts.
 
@@ -392,19 +400,12 @@ uptodate
 --------
 Try to check if you're running an up-to-date version of **dim**.
 
-retip [*branch*] [*git-rebase option* ...]
-------------------------------------------
-
-Rebase the given local branch, current branch by default, onto drm-tip. Options
-after the branch will be passed to **git-rebase**.
-
 help
 ----
 Show this help. Install **rst2man(1)** for best results.
 
 usage
 -----
-
 Short form usage help listening all subcommands. Run by default or if an unknown
 subcommand was passed on the cmdline.
 
Signature · 6 lines
2.1.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Acked-by on v1 1/7
#9 lore raw
In reply to Jani Nikula
Quoted 43 lines · Jani Nikula

Add bash_completion to 'make shellcheck' target, and fix the failures.

---
 Makefile        |  2 +-
 bash_completion | 13 +++++++------
 2 files changed, 8 insertions(+), 7 deletions(-)
Makefile +1 -1
index 30fc3dd3bff8..c1fe02c1b565 100644
@@ -30,7 +30,7 @@ SC_EXCLUDE := \
 	-e SC2143
 
 shellcheck:
-	shellcheck $(SC_EXCLUDE) dim
+	shellcheck $(SC_EXCLUDE) dim bash_completion
 
 clean:
 	rm -f drm-intel.html drm-intel-flow.svg dim.html drm-misc.html
bash_completion +2 -1
index 9f659b4ebcce..7dfc4b86cb13 100644
@@ -3,7 +3,7 @@
 dim ()
 {
 	if [[ "x$1" = "xcd" ]]; then
-		cd `cat ~/.dim-last-path`
+		cd $(cat ~/.dim-last-path) || exit
 	else
 		command dim "$@"
 	fi
@@ -12,6 +12,7 @@ dim ()
 _dim ()
 {
 	local args arg cur prev words cword split
+	local nightly_branches upstream_branches opts cmds aliasref
 
 	# require bash-completion with _init_completion
 	type -t _init_completion >/dev/null 2>&1 || return

bash_completion _dim () · line 31

Quoted 7 lines
bash_completion +2 -2
@@ -26,18 +27,18 @@ _dim ()
 	# args = number of arguments
 	_count_args
 
-	local nightly_branches="$(dim list-branches)"
-	local upstream_branches="$(dim list-upstreams)"
+	nightly_branches="$(dim list-branches)"
+	upstream_branches="$(dim list-upstreams)"

Let's hope this didn't eat errors in some obscure corner case and now another dim command silently fails :-)

Quoted 31 lines
bash_completion +3 -3
 	if [ -z "${arg}" ]; then
 		# top level completion
 		case "${cur}" in
 			-*)
-				local opts="-d -f -i"
+				opts="-d -f -i"
 				COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
 				;;
 			*)
-				local cmds="$(dim list-commands) $(dim list-aliases | sed 's/\t.*//')"
+				cmds="$(dim list-commands) $(dim list-aliases | sed 's/\t.*//')"
 				COMPREPLY=( $(compgen -W "${cmds}" -- ${cur}) )
 				;;
 		esac
@@ -45,7 +46,7 @@ _dim ()
 	fi
 
 	# complete aliases like the actual command
-	local aliasref=$(dim list-aliases | sed -n "s/^${arg}\t\(.*\)/\1/p")
+	aliasref=$(dim list-aliases | sed -n "s/^${arg}\t\(.*\)/\1/p")
 	if [[ -n "$aliasref" ]]; then
 		arg="$aliasref"
 	fi
Signature · 6 lines
2.1.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx