aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2020-05-29 11:29:25 +0200
committerMartin Liska <mliska@suse.cz>2020-05-29 11:29:25 +0200
commit24663f1f6d709daf8913484914ed01af9f7a480a (patch)
treecf28908083f2297acdefc90a520ec07d79b53408
parent233ecb5e2c5a769429279afbbf7d275cb3940cde (diff)
downloadgcc-24663f1f6d709daf8913484914ed01af9f7a480a.zip
gcc-24663f1f6d709daf8913484914ed01af9f7a480a.tar.gz
gcc-24663f1f6d709daf8913484914ed01af9f7a480a.tar.bz2
Fix various limitations of git-backport.py.
I've just tested the script and I'm going to install the patch to all active branches. contrib/ChangeLog: * git-backport.py: The script did 'git co HEAD~' when there was no modified ChangeLog file in a successful git cherry pick. Run cherry-pick --continue without editor.
-rwxr-xr-xcontrib/git-backport.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/contrib/git-backport.py b/contrib/git-backport.py
index 6a115c3..3a9413d 100755
--- a/contrib/git-backport.py
+++ b/contrib/git-backport.py
@@ -30,9 +30,13 @@ if __name__ == '__main__':
r = subprocess.run('git cherry-pick -x %s' % args.revision, shell=True)
if r.returncode == 0:
- cmd = 'git show --name-only --pretty="" -- "*ChangeLog" |' \
- 'xargs git checkout HEAD~'
- subprocess.check_output(cmd, shell=True)
+ 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
@@ -55,6 +59,7 @@ if __name__ == '__main__':
# try to continue
if len(conflicts) == len(changelogs):
- subprocess.check_output('git cherry-pick --continue', shell=True)
+ cmd = 'git -c core.editor=true cherry-pick --continue'
+ subprocess.check_output(cmd, shell=True)
else:
print('Please resolve all remaining file conflicts.')