[PATCH 16/18] dim: remove DIM_DRM_UPSTREAM_REMOTE config var

Daniel Vetter daniel.vetter at ffwll.ch
Fri Oct 21 19:36:58 UTC 2016


With the automatic remote lookup this is no longer needed. That means
moving get_remote_name a bit, and I'm too lazy to rebase that out.

v2: Wrap strings in "" (Jani).

Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
---
 dim          | 56 +++++++++++++++++++++++++++-----------------------------
 dim.rst      |  4 ----
 dimrc.sample |  4 ----
 3 files changed, 27 insertions(+), 37 deletions(-)

diff --git a/dim b/dim
index fc99108b6e55..1ab86d5a4ee9 100755
--- a/dim
+++ b/dim
@@ -50,9 +50,6 @@ DIM_DRM_INTEL=${DIM_DRM_INTEL:-src}
 # name of the $drm_intel_ssh remote within $DIM_DRM_INTEL
 DIM_DRM_INTEL_REMOTE=${DIM_DRM_INTEL_REMOTE:-danvet}
 
-# name of the $drm_upstream_git remote within $DIM_DRM_INTEL
-DIM_DRM_UPSTREAM_REMOTE=${DIM_DRM_UPSTREAM_REMOTE:-airlied}
-
 # mail user agent. must support a subset of mutt(1) command line options:
 # usage: $DIM_MUA [-s subject] [-i file] [-c cc-addr] to-addr [...]
 DIM_MUA=${DIM_MUA:-mutt}
@@ -150,6 +147,24 @@ fi
 # Sanity checks.
 #
 
+function get_remote_name
+{
+	local remote_url=$1
+
+	local remote=`git remote -v | grep $remote_url | \
+		head -n1 | cut -f 1`
+
+	if [[ $remote == "" ]] ; then
+		echoerr "No git remote for $remote_url found in `pwd`."
+		echoerr "Please set it up using"
+		echoerr "    $ git remote add '<name>' $remote_url"
+		echoerr "with a name of your choice."
+		exit 1
+	fi
+
+	echo $remote
+}
+
 if [ "$subcommand" != "setup" -a "$subcommand" != "help" -a "$subcommand" != "usage" ]; then
 	for d in $DIM_PREFIX $DIM_PREFIX/$DIM_DRM_INTEL $DIM_PREFIX/drm-rerere $DIM_PREFIX/drm-tip; do
 		if [ ! -d $d ]; then
@@ -165,6 +180,7 @@ if [ "$subcommand" != "setup" -a "$subcommand" != "help" -a "$subcommand" != "us
 	dim_branches=`(source $DIM_PREFIX/drm-rerere/nightly.conf ; echo $nightly_branches) | \
 		xargs -n 1 echo | grep '^\(drm-intel\|drm-misc\)' | \
 		sed -e 's/^\(drm-intel\|drm-misc\)\///'`
+	dim_drm_uptream_remote=`cd $DIM_PREFIX/$DIM_DRM_INTEL; get_remote_name $drm_upstream_git`
 fi
 
 function dim_uptodate
@@ -192,24 +208,6 @@ if [[ "$((`date +%s` % 100))" -eq "0" ]] ; then
         dim_uptodate
 fi
 
-function get_remote_name
-{
-	local remote_url=$1
-
-	local remote=`git remote -v | grep $remote_url | \
-		head -n1 | cut -f 1`
-
-	if [[ $remote == "" ]] ; then
-		echoerr No git remote for $remote_url found in `pwd`.
-		echoerr Please set it up using
-		echoerr     $ git remote add '<name>' $remote_url
-		echoerr with a name of your choice.
-		exit 1
-	fi
-
-	echo $remote
-}
-
 function get_remote_for_branch
 {
 	local remote=`git rev-parse --abbrev-ref --symbolic-full-name $1@{upstream}`
@@ -938,7 +936,7 @@ function dim_update_next
 	echo -e "drm/i915: Update DRIVER_DATE to $driver_date\n\nSigned-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>" | \
 		git commit -s -F -
 
-	gitk drm-intel-next-queued ^$DIM_DRM_UPSTREAM_REMOTE/drm-next &
+	gitk drm-intel-next-queued ^$dim_drm_uptream_remote/drm-next &
 
 	# try to push dinq first in case someone raced
 	dim push-queued
@@ -1051,7 +1049,7 @@ function dim_pull_request
 
 function dim_pull_request_next
 {
-	upstream=${1:-$DIM_DRM_UPSTREAM_REMOTE/drm-next}
+	upstream=${1:-$dim_drm_uptream_remote/drm-next}
 	dim_pull_request drm-intel-next $upstream
 }
 
@@ -1063,7 +1061,7 @@ function dim_pull_request_fixes
 
 function dim_pull_request_next_fixes
 {
-	upstream=${1:-$DIM_DRM_UPSTREAM_REMOTE/drm-next}
+	upstream=${1:-$dim_drm_uptream_remote/drm-next}
 	dim_pull_request drm-intel-next-fixes $upstream
 }
 
@@ -1071,8 +1069,8 @@ function dim_pull_request_next_fixes
 function dim_list_upstreams
 {
 	echo origin/master
-	echo $DIM_DRM_UPSTREAM_REMOTE/drm-next
-	echo $DIM_DRM_UPSTREAM_REMOTE/drm-fixes
+	echo $dim_drm_uptream_remote/drm-next
+	echo $dim_drm_uptream_remote/drm-fixes
 }
 
 # Note: used by bash completion
@@ -1085,7 +1083,7 @@ dim_alias_ub=update-branches
 function dim_update_branches
 {
 	cd $DIM_PREFIX/$DIM_DRM_INTEL
-	for remote in $DIM_DRM_INTEL_REMOTE $DIM_DRM_UPSTREAM_REMOTE origin; do
+	for remote in $DIM_DRM_INTEL_REMOTE $dim_drm_uptream_remote origin; do
 		git fetch $remote
 	done
 
@@ -1237,8 +1235,8 @@ function dim_tc
 		# 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 \
+		    $dim_drm_uptream_remote/drm-next \
+		    $dim_drm_uptream_remote/drm-fixes \
 		    origin/master | sed 's/^ *//'
 	fi
 }
diff --git a/dim.rst b/dim.rst
index ca9670ebc1b5..171c71bfdb6d 100644
--- a/dim.rst
+++ b/dim.rst
@@ -359,10 +359,6 @@ DIM_DRM_INTEL_REMOTE
 --------------------
 Name of the $drm_intel_ssh remote within \$DIM_DRM_INTEL.
 
-DIM_DRM_UPSTREAM_REMOTE
------------------------
-Name of the $drm_upstream_git remote within \$DIM_DRM_INTEL.
-
 DIM_MUA
 -------
 Mail user agent. Must support the following subset of **mutt(1)** command line
diff --git a/dimrc.sample b/dimrc.sample
index 42612a3a9fdf..be7b99cb6b76 100644
--- a/dimrc.sample
+++ b/dimrc.sample
@@ -14,10 +14,6 @@
 # $DIM_DRM_INTEL
 #DIM_DRM_INTEL_REMOTE=danvet
 
-# Name of the remote for git://people.freedesktop.org/~airlied/linux
-# within $DIM_DRM_INTEL
-#DIM_DRM_UPSTREAM_REMOTE=airlied
-
 # Mail User Agent supporting a subset of mutt(1) command line options:
 # [-s subject] [-i file] [-c cc-addr] to-addr [...]
 #DIM_MUA=mutt
-- 
2.9.3



More information about the dri-devel mailing list