From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3590 invoked by alias); 21 Jan 2020 13:29:43 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 3574 invoked by uid 89); 21 Jan 2020 13:29:42 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-18.8 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.1 spammy=Doing, H*MI:sk:fc048ac, H*i:sk:fc048ac, H*f:sk:fc048ac X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.110.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 21 Jan 2020 13:29:32 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 25AF830E; Tue, 21 Jan 2020 05:29:31 -0800 (PST) Received: from e120077-lin.cambridge.arm.com (e120077-lin.cambridge.arm.com [10.2.78.81]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A9FEE3F52E; Tue, 21 Jan 2020 05:29:30 -0800 (PST) Subject: [patch] contrib: script to create a new vendor branch From: "Richard Earnshaw (lists)" To: Hans-Peter Nilsson Cc: gcc-patches@gcc.gnu.org References: <202001210147.00L1lvmL021141@ignucius.se.axis.com> Message-ID: <59281770-ec14-177e-b509-a53c86a4b7b7@arm.com> Date: Tue, 21 Jan 2020 14:09:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------76FE2B97583F073F98D0422D" X-SW-Source: 2020-01/txt/msg01327.txt.bz2 This is a multi-part message in MIME format. --------------76FE2B97583F073F98D0422D Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-length: 613 This script is intended to create a new vendor branch. Doing so is not completely obvious if you are not familiar with the upstream structure, so this takes the pain out of getting it right. It doesn't check out the branch locally, but does set everything up so that, if you have push enabled for your vendor branches, then git push vendors/ will work as expected. Run the script as contrib/git-add-vendor-branch.sh / the space must have previously been set up in the way git-fetch-vendor.sh expects. * git-add-vendor-bransh.sh: New file. --------------76FE2B97583F073F98D0422D Content-Type: text/x-patch; name="vend-br.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="vend-br.patch" Content-length: 1282 diff --git a/contrib/git-add-vendor-branch.sh b/contrib/git-add-vendor-branch.sh new file mode 100755 index 00000000000..04d39ed6b63 --- /dev/null +++ b/contrib/git-add-vendor-branch.sh @@ -0,0 +1,43 @@ +#! /bin/sh -xve + +# Create a new upstream vendor branch. + +# Usage: +# contrib/git-add-vendor-branch.sh / + +usage () +{ + echo "Usage:" + echo " $0 / " + echo + echo " must have already been set up using contrib/git-fetch-vendor.sh" + exit 1 +} + +if [ $# != 2 ] +then + usage +fi + +vendor=$(echo "$1" | sed -r "s:([^/]*)/.*$:\1:") +branch=$(echo "$1" | sed -r "s:[^/]*/(.*)$:\1:") +start=$2 + +if [ -z "$vendor" -o -z "$branch" ] +then + usage +fi + +# Check that we know about the vendor +url=$(git config --get "remote.vendors/${vendor}.url"||true) +if [ -z "$url" ] +then + echo "Cannot locate remote data for vendor ${vendor}. Have you set it up?" + exit 1 +fi + +git branch --no-track ${vendor}/${branch} ${start} +git push vendors/${vendor} ${vendor}/${branch}:refs/vendors/${vendor}/heads/${branch} +git fetch -q vendors/${vendor} +git branch --set-upstream-to=remotes/vendors/${vendor}/${branch} ${vendor}/$branch +echo "Now ready to check out ${vendor}/${branch}" --------------76FE2B97583F073F98D0422D--