public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Martin Liska <marxin@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-6545] Simplify git-backport.py script. Date: Thu, 13 Jan 2022 10:52:02 +0000 (GMT) [thread overview] Message-ID: <20220113105202.2F55A393D022@sourceware.org> (raw) https://gcc.gnu.org/g:db0d23722e8b8daa54203f537729f578f3809c15 commit r12-6545-gdb0d23722e8b8daa54203f537729f578f3809c15 Author: Martin Liska <mliska@suse.cz> Date: Thu Jan 13 11:45:46 2022 +0100 Simplify git-backport.py script. It's very unlikely that somebody is going to backport a revision that is > 14 months old to a release branch. contrib/ChangeLog: * git-backport.py: Simplify the script as pre-auto-ChangeLog era is 14 months old. Diff: --- contrib/git-backport.py | 39 ++------------------------------------- 1 file changed, 2 insertions(+), 37 deletions(-) diff --git a/contrib/git-backport.py b/contrib/git-backport.py index 2b8e4686719..bc2907a14ed 100755 --- a/contrib/git-backport.py +++ b/contrib/git-backport.py @@ -23,43 +23,8 @@ import argparse import subprocess if __name__ == '__main__': - parser = argparse.ArgumentParser(description='Backport a git revision and ' - 'stash all ChangeLog files.') + parser = argparse.ArgumentParser(description='Backport a git revision.') parser.add_argument('revision', help='Revision') args = parser.parse_args() - r = subprocess.run('git cherry-pick -x %s' % args.revision, shell=True) - if r.returncode == 0: - cmd = 'git show --name-only --pretty="" -- "*ChangeLog"' - changelogs = subprocess.check_output(cmd, shell=True, encoding='utf8') - changelogs = changelogs.strip() - if changelogs: - for changelog in changelogs.split('\n'): - subprocess.check_output('git checkout HEAD~ %s' % changelog, - shell=True) - subprocess.check_output('git commit --amend --no-edit', shell=True) - else: - # 1) remove all ChangeLog files from conflicts - out = subprocess.check_output('git diff --name-only --diff-filter=U', - shell=True, - encoding='utf8') - conflicts = out.strip().split('\n') - changelogs = [c for c in conflicts if c.endswith('ChangeLog')] - if changelogs: - cmd = 'git checkout --theirs %s' % ' '.join(changelogs) - subprocess.check_output(cmd, shell=True) - # 2) remove all ChangeLog files from index - cmd = 'git diff --name-only --diff-filter=M HEAD' - out = subprocess.check_output(cmd, shell=True, encoding='utf8') - out = out.strip().split('\n') - modified = [c for c in out if c.endswith('ChangeLog')] - for m in modified: - subprocess.check_output('git reset %s' % m, shell=True) - subprocess.check_output('git checkout %s' % m, shell=True) - - # try to continue - if len(conflicts) == len(changelogs): - cmd = 'git -c core.editor=true cherry-pick --continue' - subprocess.check_output(cmd, shell=True) - else: - print('Please resolve all remaining file conflicts.') + subprocess.run('git cherry-pick -x %s' % args.revision, shell=True)
reply other threads:[~2022-01-13 10:52 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220113105202.2F55A393D022@sourceware.org \ --to=marxin@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).