All of lore.kernel.org
 help / color / mirror / Atom feed
* dim: some repo/remote refactoring
@ 2017-10-03 13:38 Jani Nikula
  2017-10-03 13:38 ` [dim PATCH 1/6] dim: require explicit repo in create-branch Jani Nikula
                   ` (6 more replies)
  0 siblings, 7 replies; 14+ messages in thread
From: Jani Nikula @ 2017-10-03 13:38 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

I have more in store, but here's the first batch.

BR,
Jani.


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

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

* [dim PATCH 1/6] dim: require explicit repo in create-branch
  2017-10-03 13:38 dim: some repo/remote refactoring Jani Nikula
@ 2017-10-03 13:38 ` Jani Nikula
  2017-10-03 13:38 ` [dim PATCH 2/6] dim: url_to_remote can't normally fail Jani Nikula
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 14+ messages in thread
From: Jani Nikula @ 2017-10-03 13:38 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

No longer consider drm-intel as the default. All repos need to be
explicitly specified. Improve error reporting in repo_to_remote for
unknown repos.

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

diff --git a/dim b/dim
index fc16d114632f..7832ddca692c 100755
--- a/dim
+++ b/dim
@@ -335,7 +335,17 @@ function branch_to_remote # branch
 
 function repo_to_remote # repo
 {
-	url_to_remote ${drm_tip_repos[$1]}
+	local repo url_list
+
+	repo=$1
+	url_list=${drm_tip_repos[$repo]}
+
+	if [[ -z "$url_list" ]]; then
+		echoerr "unknown repo $repo"
+		return 1
+	fi
+
+	url_to_remote $url_list
 }
 
 function branch_to_repo # branch
@@ -1208,9 +1218,11 @@ function dim_create_branch
 
 	cd $DIM_PREFIX/$DIM_DRM_INTEL
 
-	if ( repo_to_remote ${branch%%/*} ) &> /dev/null ; then
-		repo=${branch%%/*}
-		branch=${branch#*/}
+	repo=${branch%%/*}
+	branch=${branch#*/}
+	if [[ "$repo" = "$branch" ]]; then
+		echoerr "give branch in format repo/branch"
+		return 1
 	fi
 
 	remote=$(repo_to_remote $repo)
diff --git a/dim.rst b/dim.rst
index 65e652e8bc75..41e55a6c9b7c 100644
--- a/dim.rst
+++ b/dim.rst
@@ -298,13 +298,11 @@ Compile-test the current tree and if successful resolve a
 conflicted git am. Also runs the patch checker afterwards. This fails to add the
 Link: tag, so you'll need to add it manually or use the **add-link** subcommand.
 
-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 nightly.conf, e.g. "drm-misc/topic/branch".
+create-branch *repo*/*branch* [*commit-ish*]
+--------------------------------------------
+Create a new topic branch in the given *repo* named *branch*. The branch starts
+at HEAD or the given *commit-ish*. Note that topic/ is not automatically added
+to the branch name. Branch names should be unique across repos.
 
 remove-branch *branch*
 ----------------------
-- 
2.11.0

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

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

* [dim PATCH 2/6] dim: url_to_remote can't normally fail
  2017-10-03 13:38 dim: some repo/remote refactoring Jani Nikula
  2017-10-03 13:38 ` [dim PATCH 1/6] dim: require explicit repo in create-branch Jani Nikula
@ 2017-10-03 13:38 ` Jani Nikula
  2017-10-03 15:17   ` Jani Nikula
  2017-10-05 17:05   ` Daniel Vetter
  2017-10-03 13:38 ` [dim PATCH 3/6] dim: look at all tip branches in dim tc Jani Nikula
                   ` (4 subsequent siblings)
  6 siblings, 2 replies; 14+ messages in thread
From: Jani Nikula @ 2017-10-03 13:38 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula, Daniel Vetter, Rodrigo Vivi

Since commit cad37e1910f9 ("dim: auto-add remotes") url_to_remote can't
really fail. Same for repo_to_remote when the repo exists. Redirecting
their output when the remote isn't there leads to url_to_remote waiting
for user input without prompting, giving an appearance of a hang.

While at it, change the exit to a return. set -e at the top takes care
of aborting.

Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Sean Paul <seanpaul@chromium.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 dim | 24 ++++++++----------------
 1 file changed, 8 insertions(+), 16 deletions(-)

diff --git a/dim b/dim
index 7832ddca692c..ae8f30b8db83 100755
--- a/dim
+++ b/dim
@@ -282,7 +282,7 @@ function url_to_remote # url [url ...]
 		echoerr "Please set it up yourself using:"
 		echoerr "    $ git remote add <name> $url"
 		echoerr "with a name of your choice."
-		exit 1
+		return 1
 	fi
 
 	git remote add $remote $url
@@ -1749,10 +1749,7 @@ function dim_list_upstreams
 {
 	local dim_drm_upstream_remote
 
-	# Handle failures gracefully
-	if ! dim_drm_upstream_remote=$(url_to_remote $drm_upstream_git 2>/dev/null); then
-		return 0
-	fi
+	dim_drm_upstream_remote=$(url_to_remote $drm_upstream_git)
 
 	echo origin/master
 	echo $dim_drm_upstream_remote/drm-next
@@ -1772,17 +1769,14 @@ function dim_update_branches
 
 	cd $DIM_PREFIX/$DIM_DRM_INTEL
 
-	if remote=$(url_to_remote $linux_upstream_git 2>/dev/null); then
-		echo -n "Fetching linux (local remote $remote)... "
-		git_fetch_helper $remote
-		echo "Done."
-	fi
+	remote=$(url_to_remote $linux_upstream_git)
+	echo -n "Fetching linux (local remote $remote)... "
+	git_fetch_helper $remote
+	echo "Done."
 
 	for repo in "${!drm_tip_repos[@]}"; do
 		url_list=${drm_tip_repos[$repo]}
-		if ! remote=$(url_to_remote $url_list 2>/dev/null); then
-			continue
-		fi
+		remote=$(url_to_remote $url_list)
 		echo -n "Fetching $repo (local remote $remote)... "
 		git_fetch_helper $remote
 		echo "Done."
@@ -1826,9 +1820,7 @@ function dim_status
 
 	for branch in $dim_branches ; do
 		repo=$(branch_to_repo $branch)
-		if ! remote=$(repo_to_remote $repo) ; then
-			continue
-		fi
+		remote=$(repo_to_remote $repo)
 
 		patches=$(git log --oneline $remote/$branch ^origin/master ^$drm_remote/drm-next ^$drm_remote/drm-fixes | wc -l)
 
-- 
2.11.0

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

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

* [dim PATCH 3/6] dim: look at all tip branches in dim tc
  2017-10-03 13:38 dim: some repo/remote refactoring Jani Nikula
  2017-10-03 13:38 ` [dim PATCH 1/6] dim: require explicit repo in create-branch Jani Nikula
  2017-10-03 13:38 ` [dim PATCH 2/6] dim: url_to_remote can't normally fail Jani Nikula
@ 2017-10-03 13:38 ` Jani Nikula
  2017-10-03 13:38 ` [dim PATCH 4/6] dim: s/DIM_DRM_INTEL/DIM_REPO/ Jani Nikula
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 14+ messages in thread
From: Jani Nikula @ 2017-10-03 13:38 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

The hard-coded list of remotes and branches has gone stale.

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

diff --git a/dim b/dim
index ae8f30b8db83..f2cc25fc4ce9 100755
--- a/dim
+++ b/dim
@@ -1953,7 +1953,7 @@ function dim_cat_to_fixup
 
 function dim_tc
 {
-	local sha1 tag dim_drm_upstream_remote
+	local sha1 tag conf remote_branches
 
 	sha1=${1:?$usage}
 
@@ -1961,15 +1961,22 @@ function dim_tc
 	tag=$(git tag --contains $sha1 | grep ^v | sort -V | head -n 1)
 	if [[ -n "$tag" ]]; then
 		echo "$tag"
-	else
-		dim_drm_upstream_remote=$(url_to_remote $drm_upstream_git)
-		# not in a tagged release, show upstream branches
-		git branch -r --contains $sha1 \
-		    $DIM_DRM_INTEL_REMOTE/* \
-		    $dim_drm_upstream_remote/drm-next \
-		    $dim_drm_upstream_remote/drm-fixes \
-		    origin/master | sed 's/^ *//'
+		return 0
 	fi
+
+	# not in a tagged release, show upstream branches
+	remote_branches="origin/master"
+	for conf in "${drm_tip_config[@]}"; do
+		local repo branch override url_list remote
+
+		read -r repo branch override <<< $conf
+		url_list=${drm_tip_repos[$repo]}
+		remote=$(url_to_remote $url_list)
+
+		remote_branches="$remote_branches $remote/$branch"
+	done
+
+	git branch -r --contains $sha1 $remote_branches | sed 's/^ *//' | sort
 }
 
 function dim_cite
-- 
2.11.0

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

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

* [dim PATCH 4/6] dim: s/DIM_DRM_INTEL/DIM_REPO/
  2017-10-03 13:38 dim: some repo/remote refactoring Jani Nikula
                   ` (2 preceding siblings ...)
  2017-10-03 13:38 ` [dim PATCH 3/6] dim: look at all tip branches in dim tc Jani Nikula
@ 2017-10-03 13:38 ` Jani Nikula
  2017-10-03 13:38 ` [dim PATCH 5/6] dim: figure drm-intel remote out automatically Jani Nikula
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 14+ messages in thread
From: Jani Nikula @ 2017-10-03 13:38 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

The maintainer repo hasn't been Intel specific for a while now. Rename
the variable. DIM_DRM_INTEL is used as a default for DIM_REPO for
backward compatibility.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 dim          | 48 ++++++++++++++++++++++++------------------------
 dim.rst      | 10 +++++-----
 dimrc.sample |  6 +++---
 3 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/dim b/dim
index f2cc25fc4ce9..610f65a1a903 100755
--- a/dim
+++ b/dim
@@ -46,9 +46,9 @@ fi
 DIM_PREFIX=${DIM_PREFIX:-$HOME/linux}
 
 # main maintainer repo under $DIM_PREFIX
-DIM_DRM_INTEL=${DIM_DRM_INTEL:-src}
+DIM_REPO=${DIM_REPO:-${DIM_DRM_INTEL:-src}}
 
-# name of the $drm_intel_ssh remote within $DIM_DRM_INTEL
+# name of the $drm_intel_ssh remote within $DIM_REPO
 DIM_DRM_INTEL_REMOTE=${DIM_DRM_INTEL_REMOTE:-drm-intel}
 
 # mail user agent. must support a subset of mutt(1) command line options:
@@ -224,7 +224,7 @@ fi
 export __dim_running=1
 
 if [ "$subcommand" != "setup" ] && [ "$subcommand" != "help" ] && [ "$subcommand" != "usage" ]; then
-	for d in $DIM_PREFIX $DIM_PREFIX/$DIM_DRM_INTEL $DIM_PREFIX/drm-rerere $DIM_PREFIX/drm-tip; do
+	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"
 			exit 1
@@ -566,7 +566,7 @@ function rr_cache_dir
 	if [ -d $DIM_PREFIX/drm-tip/.git/ ] ; then
 		echo $DIM_PREFIX/drm-tip/.git/rr-cache
 	else
-		echo $DIM_PREFIX/$DIM_DRM_INTEL/.git/rr-cache
+		echo $DIM_PREFIX/$DIM_REPO/.git/rr-cache
 	fi
 }
 
@@ -1216,7 +1216,7 @@ function dim_create_branch
 	start=${2:-HEAD}
 	repo="drm-intel"
 
-	cd $DIM_PREFIX/$DIM_DRM_INTEL
+	cd $DIM_PREFIX/$DIM_REPO
 
 	repo=${branch%%/*}
 	branch=${branch#*/}
@@ -1243,7 +1243,7 @@ function dim_remove_branch
 
 	branch=${1:?$usage}
 
-	cd $DIM_PREFIX/$DIM_DRM_INTEL
+	cd $DIM_PREFIX/$DIM_REPO
 
 	if [[ -d $DIM_PREFIX/$branch ]] ; then
 		rm -R $DIM_PREFIX/$branch
@@ -1284,7 +1284,7 @@ function dim_cd
 	if [[ -d $DIM_PREFIX/$1 ]] ; then
 		path=$DIM_PREFIX/$1
 	else
-		path=$DIM_PREFIX/$DIM_DRM_INTEL
+		path=$DIM_PREFIX/$DIM_REPO
 	fi
 
 	echo $path > ~/.dim-last-path
@@ -1537,12 +1537,12 @@ function dim_create_workdir
 
 		if git help worktree &> /dev/null; then
 			# native worktree support was added in git 2.5
-			cd $DIM_DRM_INTEL
+			cd $DIM_REPO
 			$DRY git worktree prune
 			$DRY git worktree add $DIM_PREFIX/$branch $branch
 			cd $DIM_PREFIX
 		else
-			$DRY git-new-workdir $DIM_DRM_INTEL $branch $branch
+			$DRY git-new-workdir $DIM_REPO $branch $branch
 		fi
 	done
 }
@@ -1550,7 +1550,7 @@ function dim_create_workdir
 dim_alias_fw=for-each-workdir
 function dim_for_each_workdir
 {
-	cd $DIM_PREFIX/$DIM_DRM_INTEL
+	cd $DIM_PREFIX/$DIM_REPO
 	"$@"
 	for branch in $dim_branches ; do
 		if [[ -d $DIM_PREFIX/$branch ]] ; then
@@ -1639,7 +1639,7 @@ function dim_tag_next
 {
 	local tag suffix
 
-	cd $DIM_PREFIX/$DIM_DRM_INTEL
+	cd $DIM_PREFIX/$DIM_REPO
 	git fetch $DIM_DRM_INTEL_REMOTE
 
 	if [ $(git rev-parse drm-intel-next) == $(git rev-parse "drm-intel-next@{u}") ] ; then
@@ -1690,7 +1690,7 @@ function dim_pull_request
 	if [ "$branch" != "drm-intel-next" ]; then
 		assert_branch $branch
 	else
-		cd $DIM_PREFIX/$DIM_DRM_INTEL
+		cd $DIM_PREFIX/$DIM_REPO
 	fi
 
 	git_fetch_helper ${upstream%%/*}
@@ -1767,7 +1767,7 @@ function dim_update_branches
 {
 	local repo remote url_list
 
-	cd $DIM_PREFIX/$DIM_DRM_INTEL
+	cd $DIM_PREFIX/$DIM_REPO
 
 	remote=$(url_to_remote $linux_upstream_git)
 	echo -n "Fetching linux (local remote $remote)... "
@@ -1814,7 +1814,7 @@ function dim_status
 {
 	local repo remote drm_remote patches
 
-	cd $DIM_PREFIX/$DIM_DRM_INTEL
+	cd $DIM_PREFIX/$DIM_REPO
 
 	drm_remote=$(url_to_remote $drm_upstream_git)
 
@@ -1842,7 +1842,7 @@ function setup_aux_checkout # name url directory
 
 	if [ ! -d $dir ]; then
 		if git help worktree &> /dev/null ; then
-			cd $DIM_PREFIX/$DIM_DRM_INTEL
+			cd $DIM_PREFIX/$DIM_REPO
 			remote=$(url_to_remote $url)
 			if ! git_branch_exists $name ; then
 				git_fetch_helper $remote
@@ -1850,10 +1850,10 @@ function setup_aux_checkout # name url directory
 			fi
 			git worktree add $DIM_PREFIX/$dir $name
 		else
-			git clone --reference=$DIM_PREFIX/$DIM_DRM_INTEL/.git $url $dir
+			git clone --reference=$DIM_PREFIX/$DIM_REPO/.git $url $dir
 			cd $dir
 			git config remote.origin.url $url
-			echo "$DIM_PREFIX/$DIM_DRM_INTEL/.git/objects" > .git/objects/info/alternates
+			echo "$DIM_PREFIX/$DIM_REPO/.git/objects" > .git/objects/info/alternates
 			git repack -a -d -l
 			remote=origin
 		fi
@@ -1880,11 +1880,11 @@ function dim_setup
 	fi
 	cd $DIM_PREFIX
 
-	if [ ! -d $DIM_PREFIX/$DIM_DRM_INTEL/.git ]; then
-		echoerr "No git checkout found in $DIM_PREFIX/$DIM_DRM_INTEL."
-		echoerr "Please set up your maintainer linux repository at $DIM_PREFIX/$DIM_DRM_INTEL with"
+	if [ ! -d $DIM_PREFIX/$DIM_REPO/.git ]; then
+		echoerr "No git checkout found in $DIM_PREFIX/$DIM_REPO."
+		echoerr "Please set up your maintainer linux repository at $DIM_PREFIX/$DIM_REPO with"
 		echoerr "    cd $DIM_PREFIX"
-		echoerr "    git clone $linux_upstream_git $DIM_DRM_INTEL"
+		echoerr "    git clone $linux_upstream_git $DIM_REPO"
 		echoerr "or update your configuration (see dimrc.sample)."
 		exit 1
 	fi
@@ -1957,7 +1957,7 @@ function dim_tc
 
 	sha1=${1:?$usage}
 
-	cd $DIM_PREFIX/$DIM_DRM_INTEL
+	cd $DIM_PREFIX/$DIM_REPO
 	tag=$(git tag --contains $sha1 | grep ^v | sort -V | head -n 1)
 	if [[ -n "$tag" ]]; then
 		echo "$tag"
@@ -1985,7 +1985,7 @@ function dim_cite
 
 	sha1=${1:?$usage}
 
-	cd $DIM_PREFIX/$DIM_DRM_INTEL
+	cd $DIM_PREFIX/$DIM_REPO
 
 	git log -1 $sha1 "--pretty=format:%H (\"%s\")%n" | \
 		sed -e 's/\([0-f]\{12\}\)[0-f]*/\1/'
@@ -1997,7 +1997,7 @@ function dim_fixes
 
 	sha1=${1:?$usage}
 
-	cd $DIM_PREFIX/$DIM_DRM_INTEL
+	cd $DIM_PREFIX/$DIM_REPO
 	echo "Fixes: $(dim_cite $sha1)"
 
 	(
diff --git a/dim.rst b/dim.rst
index 41e55a6c9b7c..29d145d40f08 100644
--- a/dim.rst
+++ b/dim.rst
@@ -64,7 +64,7 @@ when adding a remote and, if it's not already done, you should add a new entry i
     $ printf '\nHost git.freedesktop.org\n\tUser <username>' >> ~/.ssh/config
 
 You should now have a main repository for patch application. The directory
-corresponding to this repository is defined by DIM_DRM_INTEL in your .dimrc.
+corresponding to this repository is defined by DIM_REPO in your .dimrc.
 You should also have directories called maintainer-tools, drm-tip (for
 rebuilding the tree), and drm-rerere for some dim-internal book-keeping.
 
@@ -316,7 +316,7 @@ branches if "all" is given.
 for-each-workdir *command*
 --------------------------
 Run the given command in all active workdirs including the main repository under
-\$DIM_DRM_INTEL.
+\$DIM_REPO.
 
 COMMANDS FOR MAINTAINERS
 ========================
@@ -473,13 +473,13 @@ DIM_PREFIX
 ----------
 Path prefix for kernel repositories.
 
-DIM_DRM_INTEL
--------------
+DIM_REPO
+--------
 The main maintainer repository under \$DIM_PREFIX.
 
 DIM_DRM_INTEL_REMOTE
 --------------------
-Name of the $drm_intel_ssh remote within \$DIM_DRM_INTEL.
+Name of the $drm_intel_ssh remote within \$DIM_REPO.
 
 DIM_MUA
 -------
diff --git a/dimrc.sample b/dimrc.sample
index be7b99cb6b76..9f6b786af52f 100644
--- a/dimrc.sample
+++ b/dimrc.sample
@@ -4,14 +4,14 @@
 # Defaults are in the comments below.
 
 # Prefix for the repo directories. The prefix will contain
-# $DIM_DRM_INTEL, drm-tip, maintainer-tools, etc.
+# $DIM_REPO, drm-tip, maintainer-tools, etc.
 #DIM_PREFIX=$HOME/linux
 
 # Name of the main maintainer repo under $DIM_PREFIX.
-#DIM_DRM_INTEL=src
+#DIM_REPO=src
 
 # Name of the remote for ssh://git.freedesktop.org/git/drm-intel within
-# $DIM_DRM_INTEL
+# $DIM_REPO
 #DIM_DRM_INTEL_REMOTE=danvet
 
 # Mail User Agent supporting a subset of mutt(1) command line options:
-- 
2.11.0

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

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

* [dim PATCH 5/6] dim: figure drm-intel remote out automatically
  2017-10-03 13:38 dim: some repo/remote refactoring Jani Nikula
                   ` (3 preceding siblings ...)
  2017-10-03 13:38 ` [dim PATCH 4/6] dim: s/DIM_DRM_INTEL/DIM_REPO/ Jani Nikula
@ 2017-10-03 13:38 ` Jani Nikula
  2017-10-03 13:38 ` [dim PATCH 6/6] dim: reduce dependency on hard-coded repo URLs Jani Nikula
  2017-10-05  8:53 ` [dim PATCH] dim: cd to dim repo in list-upstreams Jani Nikula
  6 siblings, 0 replies; 14+ messages in thread
From: Jani Nikula @ 2017-10-03 13:38 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

We have all the plumbing necessary to figure out the drm-intel
remote. No need to configure it separately.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 dim          | 40 ++++++++++++++++++++++------------------
 dim.rst      |  4 ----
 dimrc.sample |  4 ----
 3 files changed, 22 insertions(+), 26 deletions(-)

diff --git a/dim b/dim
index 610f65a1a903..dea82095123a 100755
--- a/dim
+++ b/dim
@@ -48,9 +48,6 @@ DIM_PREFIX=${DIM_PREFIX:-$HOME/linux}
 # main maintainer repo under $DIM_PREFIX
 DIM_REPO=${DIM_REPO:-${DIM_DRM_INTEL:-src}}
 
-# name of the $drm_intel_ssh remote within $DIM_REPO
-DIM_DRM_INTEL_REMOTE=${DIM_DRM_INTEL_REMOTE:-drm-intel}
-
 # 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}
@@ -1089,14 +1086,16 @@ function git_list_fixes
 
 function cherry_pick_branch
 {
-	local branch log fail_log needed have_fixes
+	local branch log fail_log intel_remote needed have_fixes
 
 	branch=${1:?$usage}
 	log=$(mktemp)
 	fail_log=$(mktemp)
 
+	intel_remote=$(url_to_remote $drm_intel_ssh)
+
 	# Look for commits in dinq tagged as fixes.
-	for commit in $(git_list_fixes $DIM_DRM_INTEL_REMOTE/$branch..$DIM_DRM_INTEL_REMOTE/drm-intel-next-queued -- drivers/gpu/drm/i915); do
+	for commit in $(git_list_fixes $intel_remote/$branch..$intel_remote/drm-intel-next-queued -- drivers/gpu/drm/i915); do
 		echo -n "Considering $(dim_cite $commit)... "
 
 		# Look at history for already cherry-picked fixes.
@@ -1597,13 +1596,14 @@ function dim_update_next
 
 function dim_update_next_continue
 {
-	local remote req_file suffix tag tag_testing
+	local remote intel_remote req_file suffix tag tag_testing
 
 	assert_branch drm-intel-next-queued
 
+	intel_remote=$(url_to_remote $drm_intel_ssh)
 	remote=$(url_to_remote $drm_tip_ssh)
 
-	git push $DRY_RUN -f $DIM_DRM_INTEL_REMOTE drm-intel-next-queued:drm-intel-next
+	git push $DRY_RUN -f $intel_remote drm-intel-next-queued:drm-intel-next
 	tag=drm-intel-next-$today
 	tag_testing=drm-intel-testing-$today
 
@@ -1612,13 +1612,13 @@ function dim_update_next_continue
 		tag_testing="drm-intel-testing-$today-$((++suffix))"
 	done
 
-	$DRY git tag -a $DIM_GPG_KEYID $tag $DIM_DRM_INTEL_REMOTE/drm-intel-next
-	git push $DRY_RUN $DIM_DRM_INTEL_REMOTE $tag
+	$DRY git tag -a $DIM_GPG_KEYID $tag $intel_remote/drm-intel-next
+	git push $DRY_RUN $intel_remote $tag
 
 	echo "Updating drm-intel-testing to latest drm-tip"
-	git push $DRY_RUN $DIM_DRM_INTEL_REMOTE +$remote/drm-tip:drm-intel-testing
-	$DRY git tag $tag_testing $DIM_DRM_INTEL_REMOTE/drm-intel-testing
-	$DRY git push $DIM_DRM_INTEL_REMOTE $tag_testing
+	git push $DRY_RUN $intel_remote +$remote/drm-tip:drm-intel-testing
+	$DRY git tag $tag_testing $intel_remote/drm-intel-testing
+	$DRY git push $intel_remote $tag_testing
 
 	req_file=$(mktemp)
 	cat > $req_file <<-HERE
@@ -1637,10 +1637,12 @@ function dim_update_next_continue
 
 function dim_tag_next
 {
-	local tag suffix
+	local intel_remote tag suffix
 
 	cd $DIM_PREFIX/$DIM_REPO
-	git fetch $DIM_DRM_INTEL_REMOTE
+
+	intel_remote=$(url_to_remote $drm_intel_ssh)
+	git fetch $intel_remote
 
 	if [ $(git rev-parse drm-intel-next) == $(git rev-parse "drm-intel-next@{u}") ] ; then
 		echo "Tagging current drm-intel-next"
@@ -1650,8 +1652,8 @@ function dim_tag_next
 			tag="drm-intel-next-$today-$((++suffix))"
 		done
 
-		$DRY git tag -a $DIM_GPG_KEYID $tag $DIM_DRM_INTEL_REMOTE/drm-intel-next
-		git push $DRY_RUN $DIM_DRM_INTEL_REMOTE $tag
+		$DRY git tag -a $DIM_GPG_KEYID $tag $intel_remote/drm-intel-next
+		git push $DRY_RUN $intel_remote $tag
 	else
 		echo "drm-intel-next not up-to-date, aborting"
 		exit
@@ -1765,7 +1767,7 @@ function dim_list_branches
 dim_alias_ub=update-branches
 function dim_update_branches
 {
-	local repo remote url_list
+	local repo remote url_list intel_remote
 
 	cd $DIM_PREFIX/$DIM_REPO
 
@@ -1797,8 +1799,10 @@ function dim_update_branches
 		fi
 	done
 	if git_branch_exists drm-intel-next ; then
+		intel_remote=$(url_to_remote $drm_intel_ssh)
+
 		dim_checkout drm-intel-next
-		$DRY git reset --hard $DIM_DRM_INTEL_REMOTE/drm-intel-next
+		$DRY git reset --hard $intel_remote/drm-intel-next
 	fi
 
 	cd $DIM_PREFIX/maintainer-tools
diff --git a/dim.rst b/dim.rst
index 29d145d40f08..b9bdd74eb862 100644
--- a/dim.rst
+++ b/dim.rst
@@ -477,10 +477,6 @@ DIM_REPO
 --------
 The main maintainer repository under \$DIM_PREFIX.
 
-DIM_DRM_INTEL_REMOTE
---------------------
-Name of the $drm_intel_ssh remote within \$DIM_REPO.
-
 DIM_MUA
 -------
 Mail user agent. Must support the following subset of **mutt(1)** command line
diff --git a/dimrc.sample b/dimrc.sample
index 9f6b786af52f..1b522fa47e8c 100644
--- a/dimrc.sample
+++ b/dimrc.sample
@@ -10,10 +10,6 @@
 # Name of the main maintainer repo under $DIM_PREFIX.
 #DIM_REPO=src
 
-# Name of the remote for ssh://git.freedesktop.org/git/drm-intel within
-# $DIM_REPO
-#DIM_DRM_INTEL_REMOTE=danvet
-
 # 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.11.0

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

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

* [dim PATCH 6/6] dim: reduce dependency on hard-coded repo URLs
  2017-10-03 13:38 dim: some repo/remote refactoring Jani Nikula
                   ` (4 preceding siblings ...)
  2017-10-03 13:38 ` [dim PATCH 5/6] dim: figure drm-intel remote out automatically Jani Nikula
@ 2017-10-03 13:38 ` Jani Nikula
  2017-10-05 17:08   ` Daniel Vetter
  2017-10-05  8:53 ` [dim PATCH] dim: cd to dim repo in list-upstreams Jani Nikula
  6 siblings, 1 reply; 14+ messages in thread
From: Jani Nikula @ 2017-10-03 13:38 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

Look up the remotes using the repo names in nightly.conf.

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

diff --git a/dim b/dim
index dea82095123a..d4c0b72abf6e 100755
--- a/dim
+++ b/dim
@@ -1092,7 +1092,7 @@ function cherry_pick_branch
 	log=$(mktemp)
 	fail_log=$(mktemp)
 
-	intel_remote=$(url_to_remote $drm_intel_ssh)
+	intel_remote=$(repo_to_remote drm-intel)
 
 	# Look for commits in dinq tagged as fixes.
 	for commit in $(git_list_fixes $intel_remote/$branch..$intel_remote/drm-intel-next-queued -- drivers/gpu/drm/i915); do
@@ -1586,7 +1586,7 @@ function dim_update_next
 	$DRY git add drivers/gpu/drm/i915/i915_drv.h
 	git commit $DRY_RUN -sm "drm/i915: Update DRIVER_DATE to $driver_date"
 
-	gitk drm-intel-next-queued ^$(url_to_remote $drm_upstream_git)/drm-next &
+	gitk drm-intel-next-queued ^$(repo_to_remote drm-upstream)/drm-next &
 
 	# try to push dinq first in case someone raced
 	FORCE=1 dim_push_queued
@@ -1600,7 +1600,7 @@ function dim_update_next_continue
 
 	assert_branch drm-intel-next-queued
 
-	intel_remote=$(url_to_remote $drm_intel_ssh)
+	intel_remote=$(repo_to_remote drm-intel)
 	remote=$(url_to_remote $drm_tip_ssh)
 
 	git push $DRY_RUN -f $intel_remote drm-intel-next-queued:drm-intel-next
@@ -1641,7 +1641,7 @@ function dim_tag_next
 
 	cd $DIM_PREFIX/$DIM_REPO
 
-	intel_remote=$(url_to_remote $drm_intel_ssh)
+	intel_remote=$(repo_to_remote drm-intel)
 	git fetch $intel_remote
 
 	if [ $(git rev-parse drm-intel-next) == $(git rev-parse "drm-intel-next@{u}") ] ; then
@@ -1730,7 +1730,7 @@ function dim_pull_request
 
 function dim_pull_request_next
 {
-	upstream=${1:-$(url_to_remote $drm_upstream_git)/drm-next}
+	upstream=${1:-$(repo_to_remote drm-upstream)/drm-next}
 	dim_pull_request drm-intel-next $upstream
 }
 
@@ -1742,7 +1742,7 @@ function dim_pull_request_fixes
 
 function dim_pull_request_next_fixes
 {
-	upstream=${1:-$(url_to_remote $drm_upstream_git)/drm-next}
+	upstream=${1:-$(repo_to_remote drm-upstream)/drm-next}
 	dim_pull_request drm-intel-next-fixes $upstream
 }
 
@@ -1751,7 +1751,7 @@ function dim_list_upstreams
 {
 	local dim_drm_upstream_remote
 
-	dim_drm_upstream_remote=$(url_to_remote $drm_upstream_git)
+	dim_drm_upstream_remote=$(repo_to_remote drm-upstream)
 
 	echo origin/master
 	echo $dim_drm_upstream_remote/drm-next
@@ -1799,7 +1799,7 @@ function dim_update_branches
 		fi
 	done
 	if git_branch_exists drm-intel-next ; then
-		intel_remote=$(url_to_remote $drm_intel_ssh)
+		intel_remote=$(repo_to_remote drm-intel)
 
 		dim_checkout drm-intel-next
 		$DRY git reset --hard $intel_remote/drm-intel-next
@@ -1820,7 +1820,7 @@ function dim_status
 
 	cd $DIM_PREFIX/$DIM_REPO
 
-	drm_remote=$(url_to_remote $drm_upstream_git)
+	drm_remote=$(repo_to_remote drm-upstream)
 
 	for branch in $dim_branches ; do
 		repo=$(branch_to_repo $branch)
-- 
2.11.0

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

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

* Re: [dim PATCH 2/6] dim: url_to_remote can't normally fail
  2017-10-03 13:38 ` [dim PATCH 2/6] dim: url_to_remote can't normally fail Jani Nikula
@ 2017-10-03 15:17   ` Jani Nikula
  2017-10-05  8:57     ` Jani Nikula
  2017-10-05 17:05   ` Daniel Vetter
  1 sibling, 1 reply; 14+ messages in thread
From: Jani Nikula @ 2017-10-03 15:17 UTC (permalink / raw)
  To: intel-gfx; +Cc: Daniel Vetter, Rodrigo Vivi

On Tue, 03 Oct 2017, Jani Nikula <jani.nikula@intel.com> wrote:
> Since commit cad37e1910f9 ("dim: auto-add remotes") url_to_remote can't
> really fail. Same for repo_to_remote when the repo exists. Redirecting
> their output when the remote isn't there leads to url_to_remote waiting
> for user input without prompting, giving an appearance of a hang.

Wah. I've been going back and forth with this, but I'm now leaning
towards reverting cad37e1910f9 ("dim: auto-add remotes") and going back
to the drawing board with it.

The problem is, url_to_remote, repo_to_remote and friends are low-level
helpers in the script. That kind of things are better off returning
true/false status instead of going out of their way to interactively fix
stuff up. The *caller*, where applicable, should auto-add remotes,
depending on the case.

I hit the problem first on one machine which doesn't use worktrees. I
conceded we could make worktrees a requirement. However, I have a strict
separation between maintainer and developer repos, with no push access
at all to the remotes from the developer repo. I have no desire to give
up on that safety measure. However, dim is helpful in the developer repo
too.

Also, there's been requests to move dim more towards working in the CWD
instead of cd to predefined repo. I'm not sure it's reasonable to
require that all of them have all of the remotes available, for no
particularly good reason. With worktrees the remotes are shared, but if
you don't use a common tree for all of them, that benefit is lost.

BR,
Jani.



>
> While at it, change the exit to a return. set -e at the top takes care
> of aborting.
>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: Sean Paul <seanpaul@chromium.org>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
>  dim | 24 ++++++++----------------
>  1 file changed, 8 insertions(+), 16 deletions(-)
>
> diff --git a/dim b/dim
> index 7832ddca692c..ae8f30b8db83 100755
> --- a/dim
> +++ b/dim
> @@ -282,7 +282,7 @@ function url_to_remote # url [url ...]
>  		echoerr "Please set it up yourself using:"
>  		echoerr "    $ git remote add <name> $url"
>  		echoerr "with a name of your choice."
> -		exit 1
> +		return 1
>  	fi
>  
>  	git remote add $remote $url
> @@ -1749,10 +1749,7 @@ function dim_list_upstreams
>  {
>  	local dim_drm_upstream_remote
>  
> -	# Handle failures gracefully
> -	if ! dim_drm_upstream_remote=$(url_to_remote $drm_upstream_git 2>/dev/null); then
> -		return 0
> -	fi
> +	dim_drm_upstream_remote=$(url_to_remote $drm_upstream_git)
>  
>  	echo origin/master
>  	echo $dim_drm_upstream_remote/drm-next
> @@ -1772,17 +1769,14 @@ function dim_update_branches
>  
>  	cd $DIM_PREFIX/$DIM_DRM_INTEL
>  
> -	if remote=$(url_to_remote $linux_upstream_git 2>/dev/null); then
> -		echo -n "Fetching linux (local remote $remote)... "
> -		git_fetch_helper $remote
> -		echo "Done."
> -	fi
> +	remote=$(url_to_remote $linux_upstream_git)
> +	echo -n "Fetching linux (local remote $remote)... "
> +	git_fetch_helper $remote
> +	echo "Done."
>  
>  	for repo in "${!drm_tip_repos[@]}"; do
>  		url_list=${drm_tip_repos[$repo]}
> -		if ! remote=$(url_to_remote $url_list 2>/dev/null); then
> -			continue
> -		fi
> +		remote=$(url_to_remote $url_list)
>  		echo -n "Fetching $repo (local remote $remote)... "
>  		git_fetch_helper $remote
>  		echo "Done."
> @@ -1826,9 +1820,7 @@ function dim_status
>  
>  	for branch in $dim_branches ; do
>  		repo=$(branch_to_repo $branch)
> -		if ! remote=$(repo_to_remote $repo) ; then
> -			continue
> -		fi
> +		remote=$(repo_to_remote $repo)
>  
>  		patches=$(git log --oneline $remote/$branch ^origin/master ^$drm_remote/drm-next ^$drm_remote/drm-fixes | wc -l)

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

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

* [dim PATCH] dim: cd to dim repo in list-upstreams
  2017-10-03 13:38 dim: some repo/remote refactoring Jani Nikula
                   ` (5 preceding siblings ...)
  2017-10-03 13:38 ` [dim PATCH 6/6] dim: reduce dependency on hard-coded repo URLs Jani Nikula
@ 2017-10-05  8:53 ` Jani Nikula
  2017-10-05 17:09   ` Daniel Vetter
  6 siblings, 1 reply; 14+ messages in thread
From: Jani Nikula @ 2017-10-05  8:53 UTC (permalink / raw)
  To: Jani Nikula, intel-gfx

Don't assume current directory works.

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

diff --git a/dim b/dim
index d4c0b72abf6e..79e4fbddd6e1 100755
--- a/dim
+++ b/dim
@@ -1751,6 +1751,8 @@ function dim_list_upstreams
 {
 	local dim_drm_upstream_remote
 
+	cd $DIM_PREFIX/$DIM_REPO
+
 	dim_drm_upstream_remote=$(repo_to_remote drm-upstream)
 
 	echo origin/master
-- 
2.11.0

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

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

* Re: [dim PATCH 2/6] dim: url_to_remote can't normally fail
  2017-10-03 15:17   ` Jani Nikula
@ 2017-10-05  8:57     ` Jani Nikula
  0 siblings, 0 replies; 14+ messages in thread
From: Jani Nikula @ 2017-10-05  8:57 UTC (permalink / raw)
  To: intel-gfx; +Cc: Daniel Vetter, Rodrigo Vivi

On Tue, 03 Oct 2017, Jani Nikula <jani.nikula@intel.com> wrote:
> On Tue, 03 Oct 2017, Jani Nikula <jani.nikula@intel.com> wrote:
>> Since commit cad37e1910f9 ("dim: auto-add remotes") url_to_remote can't
>> really fail. Same for repo_to_remote when the repo exists. Redirecting
>> their output when the remote isn't there leads to url_to_remote waiting
>> for user input without prompting, giving an appearance of a hang.
>
> Wah. I've been going back and forth with this, but I'm now leaning
> towards reverting cad37e1910f9 ("dim: auto-add remotes") and going back
> to the drawing board with it.
>
> The problem is, url_to_remote, repo_to_remote and friends are low-level
> helpers in the script. That kind of things are better off returning
> true/false status instead of going out of their way to interactively fix
> stuff up. The *caller*, where applicable, should auto-add remotes,
> depending on the case.
>
> I hit the problem first on one machine which doesn't use worktrees. I
> conceded we could make worktrees a requirement. However, I have a strict
> separation between maintainer and developer repos, with no push access
> at all to the remotes from the developer repo. I have no desire to give
> up on that safety measure. However, dim is helpful in the developer repo
> too.
>
> Also, there's been requests to move dim more towards working in the CWD
> instead of cd to predefined repo. I'm not sure it's reasonable to
> require that all of them have all of the remotes available, for no
> particularly good reason. With worktrees the remotes are shared, but if
> you don't use a common tree for all of them, that benefit is lost.

Okay, I admit defeat. I don't have the time or chrystal clear idea how
to fix all this cleanly and nicely, and we can't block on this
indefinitely. One of the problems with tab completion was that
list-upstreams operated in the current dir; I sent a fix on top of this
series. In general, I think we need a better idea on what should work
and operate in CWD. The mixture we have now is not ideal.

So if you would be so kind to review this set so we can move forward,
and let's improve upon this gradually as issues arise.

BR,
Jani.


>
> BR,
> Jani.
>
>
>
>>
>> While at it, change the exit to a return. set -e at the top takes care
>> of aborting.
>>
>> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
>> Cc: Sean Paul <seanpaul@chromium.org>
>> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
>> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>> ---
>>  dim | 24 ++++++++----------------
>>  1 file changed, 8 insertions(+), 16 deletions(-)
>>
>> diff --git a/dim b/dim
>> index 7832ddca692c..ae8f30b8db83 100755
>> --- a/dim
>> +++ b/dim
>> @@ -282,7 +282,7 @@ function url_to_remote # url [url ...]
>>  		echoerr "Please set it up yourself using:"
>>  		echoerr "    $ git remote add <name> $url"
>>  		echoerr "with a name of your choice."
>> -		exit 1
>> +		return 1
>>  	fi
>>  
>>  	git remote add $remote $url
>> @@ -1749,10 +1749,7 @@ function dim_list_upstreams
>>  {
>>  	local dim_drm_upstream_remote
>>  
>> -	# Handle failures gracefully
>> -	if ! dim_drm_upstream_remote=$(url_to_remote $drm_upstream_git 2>/dev/null); then
>> -		return 0
>> -	fi
>> +	dim_drm_upstream_remote=$(url_to_remote $drm_upstream_git)
>>  
>>  	echo origin/master
>>  	echo $dim_drm_upstream_remote/drm-next
>> @@ -1772,17 +1769,14 @@ function dim_update_branches
>>  
>>  	cd $DIM_PREFIX/$DIM_DRM_INTEL
>>  
>> -	if remote=$(url_to_remote $linux_upstream_git 2>/dev/null); then
>> -		echo -n "Fetching linux (local remote $remote)... "
>> -		git_fetch_helper $remote
>> -		echo "Done."
>> -	fi
>> +	remote=$(url_to_remote $linux_upstream_git)
>> +	echo -n "Fetching linux (local remote $remote)... "
>> +	git_fetch_helper $remote
>> +	echo "Done."
>>  
>>  	for repo in "${!drm_tip_repos[@]}"; do
>>  		url_list=${drm_tip_repos[$repo]}
>> -		if ! remote=$(url_to_remote $url_list 2>/dev/null); then
>> -			continue
>> -		fi
>> +		remote=$(url_to_remote $url_list)
>>  		echo -n "Fetching $repo (local remote $remote)... "
>>  		git_fetch_helper $remote
>>  		echo "Done."
>> @@ -1826,9 +1820,7 @@ function dim_status
>>  
>>  	for branch in $dim_branches ; do
>>  		repo=$(branch_to_repo $branch)
>> -		if ! remote=$(repo_to_remote $repo) ; then
>> -			continue
>> -		fi
>> +		remote=$(repo_to_remote $repo)
>>  
>>  		patches=$(git log --oneline $remote/$branch ^origin/master ^$drm_remote/drm-next ^$drm_remote/drm-fixes | wc -l)

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

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

* Re: [dim PATCH 2/6] dim: url_to_remote can't normally fail
  2017-10-03 13:38 ` [dim PATCH 2/6] dim: url_to_remote can't normally fail Jani Nikula
  2017-10-03 15:17   ` Jani Nikula
@ 2017-10-05 17:05   ` Daniel Vetter
  2017-10-06  8:54     ` Jani Nikula
  1 sibling, 1 reply; 14+ messages in thread
From: Daniel Vetter @ 2017-10-05 17:05 UTC (permalink / raw)
  To: Jani Nikula; +Cc: Daniel Vetter, intel-gfx, Rodrigo Vivi

On Tue, Oct 03, 2017 at 04:38:04PM +0300, Jani Nikula wrote:
> Since commit cad37e1910f9 ("dim: auto-add remotes") url_to_remote can't
> really fail. Same for repo_to_remote when the repo exists. Redirecting
> their output when the remote isn't there leads to url_to_remote waiting
> for user input without prompting, giving an appearance of a hang.
> 
> While at it, change the exit to a return. set -e at the top takes care
> of aborting.
> 
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: Sean Paul <seanpaul@chromium.org>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
>  dim | 24 ++++++++----------------
>  1 file changed, 8 insertions(+), 16 deletions(-)
> 
> diff --git a/dim b/dim
> index 7832ddca692c..ae8f30b8db83 100755
> --- a/dim
> +++ b/dim
> @@ -282,7 +282,7 @@ function url_to_remote # url [url ...]
>  		echoerr "Please set it up yourself using:"
>  		echoerr "    $ git remote add <name> $url"
>  		echoerr "with a name of your choice."
> -		exit 1
> +		return 1
>  	fi
>  
>  	git remote add $remote $url
> @@ -1749,10 +1749,7 @@ function dim_list_upstreams
>  {
>  	local dim_drm_upstream_remote
>  
> -	# Handle failures gracefully
> -	if ! dim_drm_upstream_remote=$(url_to_remote $drm_upstream_git 2>/dev/null); then
> -		return 0
> -	fi
> +	dim_drm_upstream_remote=$(url_to_remote $drm_upstream_git)
>  
>  	echo origin/master
>  	echo $dim_drm_upstream_remote/drm-next
> @@ -1772,17 +1769,14 @@ function dim_update_branches
>  
>  	cd $DIM_PREFIX/$DIM_DRM_INTEL
>  
> -	if remote=$(url_to_remote $linux_upstream_git 2>/dev/null); then
> -		echo -n "Fetching linux (local remote $remote)... "
> -		git_fetch_helper $remote
> -		echo "Done."
> -	fi
> +	remote=$(url_to_remote $linux_upstream_git)
> +	echo -n "Fetching linux (local remote $remote)... "
> +	git_fetch_helper $remote
> +	echo "Done."

So this practically makes worktrees mandatory since we now need all the
remotes everywhere. I'm ok with that, worktree is the default (with no
easy way to intentionally fall back) anyway. Might be good to mention in
the commit message though.
-Daniel

>  
>  	for repo in "${!drm_tip_repos[@]}"; do
>  		url_list=${drm_tip_repos[$repo]}
> -		if ! remote=$(url_to_remote $url_list 2>/dev/null); then
> -			continue
> -		fi
> +		remote=$(url_to_remote $url_list)
>  		echo -n "Fetching $repo (local remote $remote)... "
>  		git_fetch_helper $remote
>  		echo "Done."
> @@ -1826,9 +1820,7 @@ function dim_status
>  
>  	for branch in $dim_branches ; do
>  		repo=$(branch_to_repo $branch)
> -		if ! remote=$(repo_to_remote $repo) ; then
> -			continue
> -		fi
> +		remote=$(repo_to_remote $repo)
>  
>  		patches=$(git log --oneline $remote/$branch ^origin/master ^$drm_remote/drm-next ^$drm_remote/drm-fixes | wc -l)
>  
> -- 
> 2.11.0
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [dim PATCH 6/6] dim: reduce dependency on hard-coded repo URLs
  2017-10-03 13:38 ` [dim PATCH 6/6] dim: reduce dependency on hard-coded repo URLs Jani Nikula
@ 2017-10-05 17:08   ` Daniel Vetter
  0 siblings, 0 replies; 14+ messages in thread
From: Daniel Vetter @ 2017-10-05 17:08 UTC (permalink / raw)
  To: Jani Nikula; +Cc: intel-gfx

On Tue, Oct 03, 2017 at 04:38:08PM +0300, Jani Nikula wrote:
> Look up the remotes using the repo names in nightly.conf.
> 
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>

Aw, last user of $drm_intel_ssh is the maintainer-tools setup. I really
should move that to drm-tip, but I still haven't figured out a neat way to
auto-migrate. Oh well.
-Daniel

> ---
>  dim | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/dim b/dim
> index dea82095123a..d4c0b72abf6e 100755
> --- a/dim
> +++ b/dim
> @@ -1092,7 +1092,7 @@ function cherry_pick_branch
>  	log=$(mktemp)
>  	fail_log=$(mktemp)
>  
> -	intel_remote=$(url_to_remote $drm_intel_ssh)
> +	intel_remote=$(repo_to_remote drm-intel)
>  
>  	# Look for commits in dinq tagged as fixes.
>  	for commit in $(git_list_fixes $intel_remote/$branch..$intel_remote/drm-intel-next-queued -- drivers/gpu/drm/i915); do
> @@ -1586,7 +1586,7 @@ function dim_update_next
>  	$DRY git add drivers/gpu/drm/i915/i915_drv.h
>  	git commit $DRY_RUN -sm "drm/i915: Update DRIVER_DATE to $driver_date"
>  
> -	gitk drm-intel-next-queued ^$(url_to_remote $drm_upstream_git)/drm-next &
> +	gitk drm-intel-next-queued ^$(repo_to_remote drm-upstream)/drm-next &
>  
>  	# try to push dinq first in case someone raced
>  	FORCE=1 dim_push_queued
> @@ -1600,7 +1600,7 @@ function dim_update_next_continue
>  
>  	assert_branch drm-intel-next-queued
>  
> -	intel_remote=$(url_to_remote $drm_intel_ssh)
> +	intel_remote=$(repo_to_remote drm-intel)
>  	remote=$(url_to_remote $drm_tip_ssh)
>  
>  	git push $DRY_RUN -f $intel_remote drm-intel-next-queued:drm-intel-next
> @@ -1641,7 +1641,7 @@ function dim_tag_next
>  
>  	cd $DIM_PREFIX/$DIM_REPO
>  
> -	intel_remote=$(url_to_remote $drm_intel_ssh)
> +	intel_remote=$(repo_to_remote drm-intel)
>  	git fetch $intel_remote
>  
>  	if [ $(git rev-parse drm-intel-next) == $(git rev-parse "drm-intel-next@{u}") ] ; then
> @@ -1730,7 +1730,7 @@ function dim_pull_request
>  
>  function dim_pull_request_next
>  {
> -	upstream=${1:-$(url_to_remote $drm_upstream_git)/drm-next}
> +	upstream=${1:-$(repo_to_remote drm-upstream)/drm-next}
>  	dim_pull_request drm-intel-next $upstream
>  }
>  
> @@ -1742,7 +1742,7 @@ function dim_pull_request_fixes
>  
>  function dim_pull_request_next_fixes
>  {
> -	upstream=${1:-$(url_to_remote $drm_upstream_git)/drm-next}
> +	upstream=${1:-$(repo_to_remote drm-upstream)/drm-next}
>  	dim_pull_request drm-intel-next-fixes $upstream
>  }
>  
> @@ -1751,7 +1751,7 @@ function dim_list_upstreams
>  {
>  	local dim_drm_upstream_remote
>  
> -	dim_drm_upstream_remote=$(url_to_remote $drm_upstream_git)
> +	dim_drm_upstream_remote=$(repo_to_remote drm-upstream)
>  
>  	echo origin/master
>  	echo $dim_drm_upstream_remote/drm-next
> @@ -1799,7 +1799,7 @@ function dim_update_branches
>  		fi
>  	done
>  	if git_branch_exists drm-intel-next ; then
> -		intel_remote=$(url_to_remote $drm_intel_ssh)
> +		intel_remote=$(repo_to_remote drm-intel)
>  
>  		dim_checkout drm-intel-next
>  		$DRY git reset --hard $intel_remote/drm-intel-next
> @@ -1820,7 +1820,7 @@ function dim_status
>  
>  	cd $DIM_PREFIX/$DIM_REPO
>  
> -	drm_remote=$(url_to_remote $drm_upstream_git)
> +	drm_remote=$(repo_to_remote drm-upstream)
>  
>  	for branch in $dim_branches ; do
>  		repo=$(branch_to_repo $branch)
> -- 
> 2.11.0
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [dim PATCH] dim: cd to dim repo in list-upstreams
  2017-10-05  8:53 ` [dim PATCH] dim: cd to dim repo in list-upstreams Jani Nikula
@ 2017-10-05 17:09   ` Daniel Vetter
  0 siblings, 0 replies; 14+ messages in thread
From: Daniel Vetter @ 2017-10-05 17:09 UTC (permalink / raw)
  To: Jani Nikula; +Cc: intel-gfx

On Thu, Oct 05, 2017 at 11:53:04AM +0300, Jani Nikula wrote:
> Don't assume current directory works.
> 
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>

On all 6 + this patch here:

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

Thanks for doing this de-dusting.
-Daniel

> ---
>  dim | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/dim b/dim
> index d4c0b72abf6e..79e4fbddd6e1 100755
> --- a/dim
> +++ b/dim
> @@ -1751,6 +1751,8 @@ function dim_list_upstreams
>  {
>  	local dim_drm_upstream_remote
>  
> +	cd $DIM_PREFIX/$DIM_REPO
> +
>  	dim_drm_upstream_remote=$(repo_to_remote drm-upstream)
>  
>  	echo origin/master
> -- 
> 2.11.0
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [dim PATCH 2/6] dim: url_to_remote can't normally fail
  2017-10-05 17:05   ` Daniel Vetter
@ 2017-10-06  8:54     ` Jani Nikula
  0 siblings, 0 replies; 14+ messages in thread
From: Jani Nikula @ 2017-10-06  8:54 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: Daniel Vetter, intel-gfx, Rodrigo Vivi

On Thu, 05 Oct 2017, Daniel Vetter <daniel@ffwll.ch> wrote:
> On Tue, Oct 03, 2017 at 04:38:04PM +0300, Jani Nikula wrote:
>> Since commit cad37e1910f9 ("dim: auto-add remotes") url_to_remote can't
>> really fail. Same for repo_to_remote when the repo exists. Redirecting
>> their output when the remote isn't there leads to url_to_remote waiting
>> for user input without prompting, giving an appearance of a hang.
>> 
>> While at it, change the exit to a return. set -e at the top takes care
>> of aborting.
>> 
>> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
>> Cc: Sean Paul <seanpaul@chromium.org>
>> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
>> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>> ---
>>  dim | 24 ++++++++----------------
>>  1 file changed, 8 insertions(+), 16 deletions(-)
>> 
>> diff --git a/dim b/dim
>> index 7832ddca692c..ae8f30b8db83 100755
>> --- a/dim
>> +++ b/dim
>> @@ -282,7 +282,7 @@ function url_to_remote # url [url ...]
>>  		echoerr "Please set it up yourself using:"
>>  		echoerr "    $ git remote add <name> $url"
>>  		echoerr "with a name of your choice."
>> -		exit 1
>> +		return 1
>>  	fi
>>  
>>  	git remote add $remote $url
>> @@ -1749,10 +1749,7 @@ function dim_list_upstreams
>>  {
>>  	local dim_drm_upstream_remote
>>  
>> -	# Handle failures gracefully
>> -	if ! dim_drm_upstream_remote=$(url_to_remote $drm_upstream_git 2>/dev/null); then
>> -		return 0
>> -	fi
>> +	dim_drm_upstream_remote=$(url_to_remote $drm_upstream_git)
>>  
>>  	echo origin/master
>>  	echo $dim_drm_upstream_remote/drm-next
>> @@ -1772,17 +1769,14 @@ function dim_update_branches
>>  
>>  	cd $DIM_PREFIX/$DIM_DRM_INTEL
>>  
>> -	if remote=$(url_to_remote $linux_upstream_git 2>/dev/null); then
>> -		echo -n "Fetching linux (local remote $remote)... "
>> -		git_fetch_helper $remote
>> -		echo "Done."
>> -	fi
>> +	remote=$(url_to_remote $linux_upstream_git)
>> +	echo -n "Fetching linux (local remote $remote)... "
>> +	git_fetch_helper $remote
>> +	echo "Done."
>
> So this practically makes worktrees mandatory since we now need all the
> remotes everywhere. I'm ok with that, worktree is the default (with no
> easy way to intentionally fall back) anyway. Might be good to mention in
> the commit message though.

Added a paragraph about that in the log. Worktrees still aren't strictly
required, but indeed practically mandatory. I still have that one box
with a non-worktree setup even if the git has long since been upgraded
to support worktrees.

Pushed all 7, many thanks for the review.

BR,
Jani.



> -Daniel
>
>>  
>>  	for repo in "${!drm_tip_repos[@]}"; do
>>  		url_list=${drm_tip_repos[$repo]}
>> -		if ! remote=$(url_to_remote $url_list 2>/dev/null); then
>> -			continue
>> -		fi
>> +		remote=$(url_to_remote $url_list)
>>  		echo -n "Fetching $repo (local remote $remote)... "
>>  		git_fetch_helper $remote
>>  		echo "Done."
>> @@ -1826,9 +1820,7 @@ function dim_status
>>  
>>  	for branch in $dim_branches ; do
>>  		repo=$(branch_to_repo $branch)
>> -		if ! remote=$(repo_to_remote $repo) ; then
>> -			continue
>> -		fi
>> +		remote=$(repo_to_remote $repo)
>>  
>>  		patches=$(git log --oneline $remote/$branch ^origin/master ^$drm_remote/drm-next ^$drm_remote/drm-fixes | wc -l)
>>  
>> -- 
>> 2.11.0
>> 

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

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

end of thread, other threads:[~2017-10-06  8:54 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-03 13:38 dim: some repo/remote refactoring Jani Nikula
2017-10-03 13:38 ` [dim PATCH 1/6] dim: require explicit repo in create-branch Jani Nikula
2017-10-03 13:38 ` [dim PATCH 2/6] dim: url_to_remote can't normally fail Jani Nikula
2017-10-03 15:17   ` Jani Nikula
2017-10-05  8:57     ` Jani Nikula
2017-10-05 17:05   ` Daniel Vetter
2017-10-06  8:54     ` Jani Nikula
2017-10-03 13:38 ` [dim PATCH 3/6] dim: look at all tip branches in dim tc Jani Nikula
2017-10-03 13:38 ` [dim PATCH 4/6] dim: s/DIM_DRM_INTEL/DIM_REPO/ Jani Nikula
2017-10-03 13:38 ` [dim PATCH 5/6] dim: figure drm-intel remote out automatically Jani Nikula
2017-10-03 13:38 ` [dim PATCH 6/6] dim: reduce dependency on hard-coded repo URLs Jani Nikula
2017-10-05 17:08   ` Daniel Vetter
2017-10-05  8:53 ` [dim PATCH] dim: cd to dim repo in list-upstreams Jani Nikula
2017-10-05 17:09   ` Daniel Vetter

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.