All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel.vetter@ffwll.ch>
To: DRI Development <dri-devel@lists.freedesktop.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
	Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
	Daniel Vetter <daniel.vetter@intel.com>
Subject: [PATCH 17/18] dim: Adapat create/remove-branch
Date: Fri, 21 Oct 2016 21:36:59 +0200	[thread overview]
Message-ID: <20161021193700.22100-18-daniel.vetter@ffwll.ch> (raw)
In-Reply-To: <20161021193700.22100-1-daniel.vetter@ffwll.ch>

Looking up the remote for deleting the branch is a bit an exercise.

v2: Correctly keep the fake remote name from nightly.conf and the real
(local) remote name apart.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
 dim     | 54 +++++++++++++++++++++++++++++++++++++++++++++---------
 dim.rst |  5 ++++-
 2 files changed, 49 insertions(+), 10 deletions(-)

diff --git a/dim b/dim
index 1ab86d5a4ee9..f42b1eebf48b 100755
--- a/dim
+++ b/dim
@@ -654,7 +654,9 @@ function dim_create_branch
 		echo "usage: $dim $subcommand branch [commit-ish]"
 		exit 1
 	fi
-	branch=$1
+	local branch=$1
+	local nightly_remote="drm-intel"
+
 	if [[ "x$2" = "x" ]]; then
 		start=HEAD
 	else
@@ -663,10 +665,19 @@ function dim_create_branch
 
 	cd $DIM_PREFIX/$DIM_DRM_INTEL
 
+	source $DIM_PREFIX/drm-rerere/nightly.conf
+
+	if ( map_nightly_remote ${branch%%/*} ) &> /dev/null ; then
+		nightly_remote=${branch%%/*}
+		branch=${branch#*/}
+	fi
+
+	local remote=`map_nightly_remote $nightly_remote`
+
 	$DRY git branch $branch $start
-	git push $DRY_RUN $DIM_DRM_INTEL_REMOTE +$branch --set-upstream
+	git push $DRY_RUN $remote +$branch --set-upstream
 	cd $DIM_PREFIX/drm-rerere
-	$DRY echo "nightly_branches=\"\$nightly_branches origin/$branch\"" \
+	$DRY echo "nightly_branches=\"\$nightly_branches $nightly_remote/$branch\"" \
 	     >> nightly.conf
 	$DRY git add nightly.conf
 	$DRY git commit --quiet -m "Adding $branch to -nightly"
@@ -678,23 +689,48 @@ function dim_remove_branch
 		echo "usage: $dim $subcommand branch"
 		exit 1
 	fi
-	branch=$1
+	local branch=$1
 
 	cd $DIM_PREFIX/$DIM_DRM_INTEL
 
-	if ! $DRY git branch -d $branch ; then
-		warn_or_fail "Can't remove $branch in working repo"
+	if [[ `git branch --list $branch`  != "" ]] &&
+	   ! $DRY git branch -d $branch  ; then
+			warn_or_fail "Can't remove $branch in working repo"
 	fi
 
 	if [[ -d $DIM_PREFIX/$branch ]] ; then
 		rm -R $DIM_PREFIX/$branch
+		git worktree prune &> /dev/null || true
 	fi
 
 	cd $DIM_PREFIX/drm-tip
-	git push $DRY_RUN origin --delete $branch
-	$DRY git fetch origin --prune
+
+	source $DIM_PREFIX/drm-rerere/nightly.conf
+
+	local nightly_remote=""
+
+	for tree in $nightly_branches; do
+		local nightly_branch=${tree%:*}
+		local nightly_remote=${nightly_branch%%/*}
+		nightly_branch=${nightly_branch#*/}
+
+		if [[ $nightly_branch == $branch ]] ; then
+			nightly_remote=$nightly_remote
+			break
+		fi
+	done
+
+	if [[ $nightly_remote == "" ]] ; then
+		echoerr "$branch not found in nightly.conf"
+		exit 1
+	fi
+
+	local remote=`map_nightly_remote $nightly_remote`
+
+	git push $DRY_RUN $remote --delete $branch
+	$DRY git fetch $remote --prune
 	cd $DIM_PREFIX/drm-rerere
-	full_branch="origin/$branch"
+	full_branch="$nightly_remote/$branch"
 	$DRY sed -e "/${full_branch//\//\\\/}/d" -i nightly.conf
 	$DRY git add nightly.conf
 	$DRY git commit --quiet -m "Deleted $branch and removed from -nightly"
diff --git a/dim.rst b/dim.rst
index 171c71bfdb6d..886d94f9231c 100644
--- a/dim.rst
+++ b/dim.rst
@@ -283,7 +283,10 @@ 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.
+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*
 ----------------------
-- 
2.9.3

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

  parent reply	other threads:[~2016-10-21 19:36 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-21 19:36 [PATCH 00/18] dim: split out drm-misc/tip.git Daniel Vetter
2016-10-21 19:36 ` [PATCH 01/18] dim: Extract TODO Daniel Vetter
2016-10-21 19:36 ` [PATCH 02/18] dim: Autocheck for up-to-dateness Daniel Vetter
2016-10-21 19:36 ` [PATCH 03/18] dim: echoerr helper for printing to stderr Daniel Vetter
2016-10-21 19:36 ` [PATCH 04/18] dim: autodetect remotes, first part for dim_setup Daniel Vetter
2016-10-21 19:36 ` [PATCH 05/18] dim: support git worktree for aux checkouts Daniel Vetter
2016-10-21 19:36 ` [PATCH 06/18] dim: Nuke nightly-forget Daniel Vetter
2016-10-21 19:36 ` [PATCH 07/18] dim: autodetect branches in rebuild-nightly Daniel Vetter
2016-10-21 19:36 ` [PATCH 08/18] dim: remove integration-tree remotes Daniel Vetter
2016-10-21 19:36 ` [PATCH 09/18] dim: Split out drm-nightly.git Daniel Vetter
2016-10-21 19:36 ` [PATCH 10/18] dim: s/drm-nightly/drm-tip Daniel Vetter
2016-10-21 19:36 ` [PATCH 11/18] dim: use git branch --list Daniel Vetter
2016-10-21 19:36 ` [PATCH 12/18] dim: add revert-rerere Daniel Vetter
2016-10-21 19:36 ` [PATCH 13/18] dim: use get_maintainers.pl in dim fixes Daniel Vetter
2016-10-21 19:36 ` [PATCH 14/18] dim-update-next: Update DRIVER_TIMESTAMP Daniel Vetter
2016-10-21 19:36 ` [PATCH 15/18] dim: support multiple remotes for branches Daniel Vetter
2016-10-21 19:36 ` [PATCH 16/18] dim: remove DIM_DRM_UPSTREAM_REMOTE config var Daniel Vetter
2016-10-21 19:36 ` Daniel Vetter [this message]
2016-10-21 19:37 ` [PATCH 18/18] dim: Make update_linux_next multi-repo compliant Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161021193700.22100-18-daniel.vetter@ffwll.ch \
    --to=daniel.vetter@ffwll.ch \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.