From patchwork Fri Jan 10 13:23:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Richard Earnshaw (lists)" X-Patchwork-Id: 1221082 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-517097-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha1 header.s=default header.b=cYj1Ouwq; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47vNws23mHz9sR1 for ; Sat, 11 Jan 2020 00:23:55 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=wWQ5j/ftFaeDoakB18wOCsRwtp1kJ/a+Sr260DKEjr+LJSXRIe cttFj9L3dcboWaIJpOxCA/AYWh2Og1PwcQGTt0710XgMUwFqDKEj0A0KdtGUp3+8 fV5N7VoULWTqW8bmWGcT/3idLuuxZpxpOtPBy7lvy+0OxHcXWn81rInPo= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=VOcRrgDBpfwZI/RHy8BzCE8V3U0=; b=cYj1OuwqL7rQ8d7rRS8/ Sh7xN0ak6TX65yicSPabkMOiYyL55altsPztsoQBiVMRHSyS2cFf8oefxQ6+Rvb5 PqCh612Rd13ydrjCKDCNzmu35NjiYRH55WOrZGvRwEHZNnJ8h3Uwk2sy3hvss3w/ lJEWk/Umwdx0Epor+YNXDUU= 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-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@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:23:42 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 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. 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/"