From patchwork Fri Oct 21 19:36:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 9389973 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5FF9E60780 for ; Fri, 21 Oct 2016 19:38:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4B5D42A268 for ; Fri, 21 Oct 2016 19:38:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3E5912A276; Fri, 21 Oct 2016 19:38:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DF3122A268 for ; Fri, 21 Oct 2016 19:38:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4DA116EDE9; Fri, 21 Oct 2016 19:37:40 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm0-x242.google.com (mail-wm0-x242.google.com [IPv6:2a00:1450:400c:c09::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1323C6EDCE for ; Fri, 21 Oct 2016 19:37:34 +0000 (UTC) Received: by mail-wm0-x242.google.com with SMTP id o81so206247wma.2 for ; Fri, 21 Oct 2016 12:37:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=dNspibG751cvxv7kipJf/20TVmRr+tDObwJAjT4ttgY=; b=Mpof5oM7GejnvWfzPcrew2RxNmO0ceHk2DtwAmSFaiOH4h+wVINlsPi5BojTfILrCC IlIMYFMndJUxZOkwpAkRrfdNr5SEhQSeQPTraHVtmdQjdq9IWvwJEPO/vq3MUHlZcRge CKLBY40ysHxFBOglK5pjE1OeNgu6Jm92zZQ1Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=dNspibG751cvxv7kipJf/20TVmRr+tDObwJAjT4ttgY=; b=CS4iMgZWhVugZQ1hljifHk8Ck8GEYwVZM4/ZrY5m3kJLVpV9qbtCYzmgAAzCF1JNm9 E0vBbOqulbUVrJOycKao2PGZ8DTbpxnTAZ1ZvFDuQFicX5EaemBROJMILvkwTw8chVSL 3/V2bxJ6TX+pgoGn9u9XjxXHYCiqiXpJTnTeHSOfUPuCWbKrivbwE6NVvjEl2smM1Yr8 Ec1DiuDkhK8O400dVxehDLNDYBmMVlgEDbL/vkcuiVpv0RbTJu4+4mWjuxdKkmT2b1kj gWnmeAPwu32fiyzGU1BizTHyHzf96dYgE3pXXBTPPr7apXFpjdfue5RLOYhQUKORjcoo f+7A== X-Gm-Message-State: ABUngvcRZw2XT9ro1X+Gu/JM7IlPlS5FvzBdUTo69PI9y2DWOfjbxt0FkSHAdF718LXqhA== X-Received: by 10.194.148.7 with SMTP id to7mr2078618wjb.31.1477078652634; Fri, 21 Oct 2016 12:37:32 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:56b5:0:ac27:b86c:7764:9429]) by smtp.gmail.com with ESMTPSA id q134sm5756630wme.3.2016.10.21.12.37.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Oct 2016 12:37:32 -0700 (PDT) From: Daniel Vetter To: DRI Development Date: Fri, 21 Oct 2016 21:36:59 +0200 Message-Id: <20161021193700.22100-18-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20161021193700.22100-1-daniel.vetter@ffwll.ch> References: <20161021193700.22100-1-daniel.vetter@ffwll.ch> Cc: Daniel Vetter , Intel Graphics Development , Daniel Vetter Subject: [Intel-gfx] [PATCH 17/18] dim: Adapat create/remove-branch X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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* ----------------------