1327952Sdim#!/usr/bin/env python3
2239310Sdim
3239310Sdim# Copyright (C) 2020 Free Software Foundation, Inc.
4239310Sdim#
5239310Sdim# This file is part of GCC.
6239310Sdim#
7239310Sdim# GCC is free software; you can redistribute it and/or modify
8239310Sdim# it under the terms of the GNU General Public License as published by
9239310Sdim# the Free Software Foundation; either version 3, or (at your option)
10239310Sdim# any later version.
11239310Sdim#
12239310Sdim# GCC is distributed in the hope that it will be useful,
13239310Sdim# but WITHOUT ANY WARRANTY; without even the implied warranty of
14239310Sdim# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15239310Sdim# GNU General Public License for more details.
16239310Sdim#
17239310Sdim# You should have received a copy of the GNU General Public License
18239310Sdim# along with GCC; see the file COPYING.  If not, write to
19239310Sdim# the Free Software Foundation, 51 Franklin Street, Fifth Floor,
20239310Sdim# Boston, MA 02110-1301, USA.
21239310Sdim
22239310Sdimimport argparse
23327952Sdimimport os
24276479Sdimimport subprocess
25276479Sdim
26276479Sdimscript_folder = os.path.dirname(os.path.abspath(__file__))
27239310Sdimfixup_script = os.path.join(script_folder, 'git-fix-changelog.py')
28327952Sdim
29327952Sdimif __name__ == '__main__':
30327952Sdim    parser = argparse.ArgumentParser(description='Backport a git revision.')
31276479Sdim    parser.add_argument('revision', help='Revision')
32327952Sdim    args = parser.parse_args()
33276479Sdim
34327952Sdim    subprocess.run('git cherry-pick -x %s' % args.revision, shell=True)
35276479Sdim    subprocess.run(fixup_script, shell=True)
36327952Sdim