[PATCH] dim: allow all developer commands without full setup

Daniel Vetter daniel.vetter at ffwll.ch
Tue Nov 28 13:52:15 UTC 2017


Requested by Arek (so CI can use sparse/checkpatch) and Chris (because
it's more useful for developers this way).

v2: Remove debug leftover. Oops (Chris).

v3: dim retip requires the integration configuration to figure out
where drm-tip is:
- Read the integration config even for developer cmds, but only when
  available.
- Add a fallback trick for dim retip to make a good educated guess
  about where drm-tip is.

v4: Add break (Chris, Gustavo)

Acked-by: Gustavo Padovan <gustavo.padovan at collabora.com>
Cc: Gustavo Padovan <gustavo.padovan at collabora.com>
Cc: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Arkadiusz Hiler <arkadiusz.hiler at intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
---
 dim     | 42 ++++++++++++++++++++++++++++++++++++++----
 dim.rst |  2 ++
 2 files changed, 40 insertions(+), 4 deletions(-)

diff --git a/dim b/dim
index 283ae882f113..8b8621d157b2 100755
--- a/dim
+++ b/dim
@@ -421,7 +421,7 @@ function git_find_tip
 # $1: branch [optional]
 function dim_retip
 {
-	local branch upstream remote
+	local branch upstream new_upstream
 
 	branch="$1"
 
@@ -431,7 +431,11 @@ function dim_retip
 		branch=$(git symbolic-ref --short HEAD)
 	fi
 
-	remote=$(repo_to_remote drm-tip)
+	if repo_to_remote drm-tip &> /dev/null ; then
+		new_upstream=$(repo_to_remote drm-tip)/drm-tip
+	else
+		new_upstream=$(git branch -r | grep \/drm-tip$)
+	fi
 	upstream=$(git_find_tip "$branch")
 
 	if [[ -z "$upstream" ]]; then
@@ -439,7 +443,7 @@ function dim_retip
 		return 1
 	fi
 
-	git rebase --onto $remote/drm-tip $upstream $branch "$@"
+	git rebase --onto $new_upstream $upstream $branch "$@"
 }
 
 # update for-linux-next and for-linux-next-fixes branches
@@ -2129,7 +2133,33 @@ if ! declare -f $subcmd_func >/dev/null; then
 	exit 1
 fi
 
-if [ "$subcmd" != "setup" ] && [ "$subcmd" != "help" ] && [ "$subcmd" != "usage" ]; then
+# functions useful for developers don't need a full dim setup
+developer_commands=(
+	# developer commands
+	# these should match the developer section in dim.rst
+	"tc"
+	"cite"
+	"fixes"
+	"checkpatch"
+	"sparse"
+	"checker"
+	"retip"
+	# help commands
+	"help"
+	"usage"
+	# include setup
+	"setup"
+)
+
+developer_command=0
+for cmd in "${developer_commands[@]}" ; do
+	if [ $cmd = $subcmd ] ; then
+		developer_command=1
+		break;
+	fi
+done
+
+if [ $developer_command = "0" ]; then
 	for d in $DIM_PREFIX $DIM_PREFIX/$DIM_REPO $DIM_PREFIX/drm-rerere $DIM_PREFIX/drm-tip; do
 		if [ ! -d $d ]; then
 			echoerr "$d is missing, please check your configuration and/or run dim setup"
@@ -2138,6 +2168,10 @@ if [ "$subcmd" != "setup" ] && [ "$subcmd" != "help" ] && [ "$subcmd" != "usage"
 	done
 
 	read_integration_config
+else
+	if [ -r $DIM_PREFIX/drm-rerere/$integration_config ]; then
+		read_integration_config
+	fi
 fi
 
 # throw away to not confuse list-aliases
diff --git a/dim.rst b/dim.rst
index d123135b2c0d..ba834192785f 100644
--- a/dim.rst
+++ b/dim.rst
@@ -114,6 +114,8 @@ aliases.
 COMMANDS FOR DEVELOPERS
 =======================
 
+These commands can all be run without a full dim setup.
+
 tc *commit-ish*
 ---------------
 Print the oldest Linux kernel release or -rc tag that contains the supplied
-- 
2.15.0



More information about the dim-tools mailing list