1#!/usr/bin/env bash 2# 3# Licensed to the Apache Software Foundation (ASF) under one 4# or more contributor license agreements. See the NOTICE file 5# distributed with this work for additional information 6# regarding copyright ownership. The ASF licenses this file 7# to you under the Apache License, Version 2.0 (the 8# "License"); you may not use this file except in compliance 9# with the License. You may obtain a copy of the License at 10# 11# http://www.apache.org/licenses/LICENSE-2.0 12# 13# Unless required by applicable law or agreed to in writing, 14# software distributed under the License is distributed on an 15# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16# KIND, either express or implied. See the License for the 17# specific language governing permissions and limitations 18# under the License. 19# 20 21# 22# fixchanges will take a file as input and look for text matching 23# the pattern [THRIFT-nnnn] (the number of digits is not important) 24# which is not a markdown link, and change it to be a markdown link. 25# The tool writes to stdout so you can redirect it to a temporary 26# file and then compare against the original file before replacing 27# it. 28# 29# This tool was developed after the 0.12.0 release to assist with 30# generation of CHANGES.md content. 31# 32 33while IFS='' read -r line || [[ -n "$line" ]]; do 34 if [[ "$line" =~ ^(.*)\[(THRIFT-[[:digit:]]+)\][^\(](.*)$ ]]; then 35 echo "${BASH_REMATCH[1]}[${BASH_REMATCH[2]}](https://issues.apache.org/jira/browse/${BASH_REMATCH[2]}) ${BASH_REMATCH[3]}" 36 else 37 echo "$line" 38 fi 39done < "$1" 40