From fdce0b6e4ccfef74638cb5486746075145b5da1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20Haitz=20Legarreta=20Gorro=C3=B1o?= Date: Thu, 26 Jun 2025 20:36:04 -0400 Subject: [PATCH] ENH: Clean up `gerrit` code review system leftovers Clean up `gerrit` code review system leftovers: `gerrit` was substituted by `GitHub` early 2018, e.g. https://github.com/InsightSoftwareConsortium/ITKSphinxExamples/pull/45 Enough time has elapsed so that all developers have updated their local configuration. --- Utilities/GitSetup/config.sample | 6 --- Utilities/GitSetup/git-gerrit-push | 73 ---------------------------- Utilities/GitSetup/setup-git-aliases | 3 -- Utilities/SetupForDevelopment.sh | 13 ----- 4 files changed, 95 deletions(-) delete mode 100755 Utilities/GitSetup/git-gerrit-push diff --git a/Utilities/GitSetup/config.sample b/Utilities/GitSetup/config.sample index f9295de82..b925eb2e7 100644 --- a/Utilities/GitSetup/config.sample +++ b/Utilities/GitSetup/config.sample @@ -14,9 +14,3 @@ [stage] #url = git://public.kitware.com/stage/Project.git #pushurl = git@public.kitware.com:stage/Project.git - -[gerrit] - #project = Project - site = https://review.source.kitware.com - # pushurl placeholder "$username" is literal - pushurl = $username@review.source.kitware.com:Project diff --git a/Utilities/GitSetup/git-gerrit-push b/Utilities/GitSetup/git-gerrit-push deleted file mode 100755 index 7f0dd006a..000000000 --- a/Utilities/GitSetup/git-gerrit-push +++ /dev/null @@ -1,73 +0,0 @@ -#!/usr/bin/env bash -#============================================================================= -# Copyright 2010-2012 Kitware, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#============================================================================= - -USAGE="[] [--no-topic] [--dry-run] [--]" -OPTIONS_SPEC= -SUBDIRECTORY_OK=Yes -. "$(git --exec-path)/git-sh-setup" - -#----------------------------------------------------------------------------- - -remote='' -refspecs='' -no_topic='' -dry_run='' - -# Parse the command line options. -while test $# != 0; do - case "$1" in - --no-topic) no_topic=1 ;; - --dry-run) dry_run=--dry-run ;; - --) shift; break ;; - -*) usage ;; - *) test -z "$remote" || usage ; remote="$1" ;; - esac - shift -done -test $# = 0 || usage - -# Default remote. -test -n "$remote" || remote="gerrit" - -if test -z "$no_topic"; then - # Identify and validate the topic branch name. - topic="$(git symbolic-ref HEAD | sed -e 's|^refs/heads/||')" - if test "$topic" = "master"; then - die 'Please name your topic: - git checkout -b descriptive-name' - fi - refspecs="HEAD:refs/for/master/$topic" -fi - -# Exit early if we have nothing to push. -if test -z "$refspecs"; then - echo "Nothing to push!" - exit 0 -fi - -# Fetch the current upstream master branch head. -# This helps the computation of a minimal pack to push. -echo "Fetching $remote master" -fetch_out=$(git fetch "$remote" master 2>&1) || die "$fetch_out" - -# Push. Save output and exit code. -echo "Pushing to $remote" -push_stdout=$(git push --porcelain $dry_run "$remote" $refspecs); push_exit=$? -echo "$push_stdout" - -# Reproduce the push exit code. -exit $push_exit diff --git a/Utilities/GitSetup/setup-git-aliases b/Utilities/GitSetup/setup-git-aliases index 9eeb51953..8dbc13204 100755 --- a/Utilities/GitSetup/setup-git-aliases +++ b/Utilities/GitSetup/setup-git-aliases @@ -8,9 +8,6 @@ git config alias.pr-clean '!git checkout master ; git for-each-ref refs/heads/pr # Alias to push the current topic branch to GitHub git config alias.review-push "!bash Utilities/GitSetup/git-review-push" -git config alias.gerrit-push \ - "!bash -c 'echo \\\"git gerrit-push\\\" is deprecated. Please use \\\"git review-push\\\" instead.'" - # Useful alias to see what commits are on the current branch with respect to # upstream/master git config alias.prepush 'log --graph --stat upstream/master..' diff --git a/Utilities/SetupForDevelopment.sh b/Utilities/SetupForDevelopment.sh index ae12271f2..7fe15363e 100755 --- a/Utilities/SetupForDevelopment.sh +++ b/Utilities/SetupForDevelopment.sh @@ -36,19 +36,6 @@ git config branch.master.rebase true git config rebase.stat true git config branch.master.rebase true -# Disable old Gerrit hooks -hook=$(git config --get hooks.GerritId) && -if "$hook"; then - echo ' -ITK has migrated from Gerrit to GitHub for code reviews. - -Disabling the GerritId hook that adds a "Change-Id" footer to commit -messages for interaction with Gerrit. Also, removing the "gerrit" remote.' && - git config hooks.GerritId false - git config --get remote.gerrit.url > /dev/null && \ - git remote remove gerrit -fi - # Record the version of this setup so Hooks/pre-commit can check it. SetupForDevelopment_VERSION=1 git config hooks.SetupForDevelopment ${SetupForDevelopment_VERSION}