1*4c3eb207Smrg#!/usr/bin/env python3 2*4c3eb207Smrg 3*4c3eb207Smrg# Copyright (C) 2020 Free Software Foundation, Inc. 4*4c3eb207Smrg# 5*4c3eb207Smrg# This file is part of GCC. 6*4c3eb207Smrg# 7*4c3eb207Smrg# GCC is free software; you can redistribute it and/or modify 8*4c3eb207Smrg# it under the terms of the GNU General Public License as published by 9*4c3eb207Smrg# the Free Software Foundation; either version 3, or (at your option) 10*4c3eb207Smrg# any later version. 11*4c3eb207Smrg# 12*4c3eb207Smrg# GCC is distributed in the hope that it will be useful, 13*4c3eb207Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 14*4c3eb207Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15*4c3eb207Smrg# GNU General Public License for more details. 16*4c3eb207Smrg# 17*4c3eb207Smrg# You should have received a copy of the GNU General Public License 18*4c3eb207Smrg# along with GCC; see the file COPYING. If not, write to 19*4c3eb207Smrg# the Free Software Foundation, 51 Franklin Street, Fifth Floor, 20*4c3eb207Smrg# Boston, MA 02110-1301, USA. 21*4c3eb207Smrg 22*4c3eb207Smrgimport argparse 23*4c3eb207Smrgimport os 24*4c3eb207Smrgimport subprocess 25*4c3eb207Smrg 26*4c3eb207Smrgscript_folder = os.path.dirname(os.path.abspath(__file__)) 27*4c3eb207Smrgfixup_script = os.path.join(script_folder, 'git-fix-changelog.py') 28*4c3eb207Smrg 29*4c3eb207Smrgif __name__ == '__main__': 30*4c3eb207Smrg parser = argparse.ArgumentParser(description='Backport a git revision.') 31*4c3eb207Smrg parser.add_argument('revision', help='Revision') 32*4c3eb207Smrg args = parser.parse_args() 33*4c3eb207Smrg 34*4c3eb207Smrg subprocess.run('git cherry-pick -x %s' % args.revision, shell=True) 35*4c3eb207Smrg subprocess.run(fixup_script, shell=True) 36