From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 79834 invoked by alias); 10 Jan 2020 13:23:47 -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 79820 invoked by uid 89); 10 Jan 2020 13:23:47 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-18.3 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=enhancements, customization, relating 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; Fri, 10 Jan 2020 13:23:45 +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 3EC671FB; Fri, 10 Jan 2020 05:23:44 -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 DDAB13F534; Fri, 10 Jan 2020 05:23:43 -0800 (PST) To: "gcc-patches@gcc.gnu.org" From: "Richard Earnshaw (lists)" Subject: Some local customization enhancements when using git Message-ID: <54834f12-32b1-492f-fb9e-b2c74df23167@arm.com> Date: Fri, 10 Jan 2020 13:29:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------E239C06EF46B14400BE12A27" X-SW-Source: 2020-01/txt/msg00542.txt.bz2 This is a multi-part message in MIME format. --------------E239C06EF46B14400BE12A27 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1024 This patch is intended to help with folks setting up a git work environment for use with GCC following the transition to git. It currently does a couple of things. 1) Add an alias 'svn-rev' to git so that you can look up a legacy commit by its svn revision number. This enables you to type git svn-rev 1234 and git will show the commit log entry relating to SVN r1234. 2) Sets up tracking information for the user's private name area in the git repo. It tries to figure out some sensible answers to the data it needs, but allows the user to override the values. It then creates the fetch and push entries that are needed for tracking the extra refs. This implements one part of the recommendations that I've proposed in svnwrite.html for dealing with private branches. It should be possible to run the script more than once and for it to DTRT. If you change your answers the configuration should be correctly updated. 2020-01-10 Richard Earnshaw * gcc-git-customization: New file. --------------E239C06EF46B14400BE12A27 Content-Type: text/x-patch; name="gcc-git-conf.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="gcc-git-conf.patch" Content-length: 1974 diff --git a/contrib/gcc-git-customization b/contrib/gcc-git-customization new file mode 100755 index 00000000000..7f1a13bdf79 --- /dev/null +++ b/contrib/gcc-git-customization @@ -0,0 +1,54 @@ +#!/bin/sh + +# Script to add some local git customizations suitable for working +# with the GCC git repository + +ask () { + question=$1 + default=$2 + var=$3 + echo -n $question "["$default"]? " + read answer + if [ "x$answer" = "x" ] + then + eval $var=$default + else + eval $var=$answer + fi +} + +# Add a git command to find the git commit equivalent to legacy SVN revision NNN +git config alias.svn-rev '!f() { rev=$1; shift; git log --all --grep="From-SVN: r$rev\\b" "${@}"; } ; f' + +upstream=`git config --get "gcc-config.upstream"` +if [ "x$upstream" = "x" ] +then + upstream="origin" +fi +ask "Local name for upstream repository" "origin" upstream +git config "gcc-config.upstream" "$upstream" + +remote_id=`git config --get "gcc-config.user"` +if [ "x$remote_id" = "x" ] +then + # See if the url specifies the remote user name. + url=`git config --get "remote.$upstream.url"` + if [ "x$url" = "x" ] + then + # This is a pure guess, but for many people it might be OK. + remote_id=`whoami` + else + remote_id=`echo $url | sed -r "s|^.*ssh://(.+)@gcc.gnu.org.*$|\1|"` + if [ x$remote_id = x$url ] + then + remote_id=`whoami` + fi + fi +fi +ask "Account name on gcc.gnu.org" $remote_id remote_id +git config "gcc-config.user" "$remote_id" + +echo "Setting up tracking for private namespace $remote_id in remotes/$upstream/me" +git config --replace-all "remote.${upstream}.fetch" "+refs/users/${remote_id}/heads/*:refs/remotes/${upstream}/me/*" ":refs/remotes/${upstream}/me/" +git config --replace-all "remote.${upstream}.fetch" "+refs/users/${remote_id}/tags/*:refs/tags/me/*" ":refs/tags/me/" +git config --replace-all "remote.${upstream}.push" "+refs/heads/me/*:refs/users/${remote_id}/heads/*" "^\+refs/heads/me/" --------------E239C06EF46B14400BE12A27--