Created
September 18, 2023 16:54
-
-
Save pascalchevrel/4d983e3ad9d4f52acccf3d141fe8a838 to your computer and use it in GitHub Desktop.
List backports on branch X that were not cherrypicked in branch X+1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# usage: backports.py 117 | |
import os | |
import sys | |
version = sys.argv[1] | |
# Create a list of commits not merged directly in the version +1 branch | |
myCmd = "git log --no-merges release/v" + version + " ^release/v" + str((int(version) + 1)) + " | grep cherry | awk '{print " " $5}' | awk '{print substr($1, 1, length($1)-1)}'" | |
# Clean up and put in a list | |
commits = os.popen(myCmd).read().split("\n") | |
commits = list(filter(None, commits)) | |
for item in commits: | |
# Get the originating cherrypicked branch | |
val = os.popen('git branch --contains ' + item).read(); | |
# If there is no originating branch, we need to check manually the backport | |
if not val: | |
output = os.popen('git show --oneline --no-patch ' + item).read() | |
print(output, end='') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment