Last active
September 9, 2016 20:18
-
-
Save chapados/9b003debd04b718b0c02 to your computer and use it in GitHub Desktop.
List commits that are candidates for cherry-picking (in master but not release/candidate)
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 python | |
import argparse | |
import os | |
import re | |
import subprocess | |
import sys | |
def parse_args(args): | |
class DefaultHelpParser(argparse.ArgumentParser): | |
def error(self, message): | |
sys.stderr.write('error: %s\n' % message) | |
self.print_help() | |
sys.exit(2) | |
parser = DefaultHelpParser(description="List commits in master not in release/candidate") | |
parser.add_argument('-x', '--exclude-file', action='store', | |
help="Path to file listing commits to exclude from list. One commit per line starting with sha1") | |
parser.add_argument('--exclude-url', action='store', | |
help="URL to list of commits to exclude from list. One commit per line starting with sha1") | |
parser.add_argument('master_branch', | |
action='store', | |
default='master', | |
help="git branch containing source commits") | |
parser.add_argument('release_branch', | |
action='store', | |
default='release/candidate', | |
help="git branch where commits will be cherry-picked") | |
options = parser.parse_args(args) | |
return options | |
def git_compare_branches(master_branch, release_branch): | |
ref_spec = "%s...%s" % (options.master_branch, options.release_branch) | |
cmd = [ | |
'git', 'log', | |
'--cherry-pick', | |
'--oneline', | |
'--no-merges', | |
'--left-only', | |
ref_spec | |
] | |
output = subprocess.check_output(cmd) | |
return output.strip().split("\n") | |
def filter_commits(commits, exclude_list=[]): | |
excluded_commits = [ c[0:7] for c in exclude_list ] | |
remaining_commits = [] | |
for commit_info in commits: | |
sha1 = commit_info[0:7] | |
msg = commit_info[8:] | |
if sha1 not in excluded_commits: | |
remaining_commits.append(commit_info) | |
return remaining_commits | |
def fetch_excludes(excludes_url): | |
import urllib2 | |
response = urllib2.urlopen(excludes_url) | |
html = response.read() | |
return html | |
def parse_excludes(excludes_content): | |
exclude_list = [] | |
if not excludes_content: | |
return exclude_list | |
for raw_line in excludes_content.split("\n"): | |
line = raw_line.strip() | |
if re.search('^\#', line) or len(line) == 0: | |
continue | |
exclude_list.append(line) | |
return exclude_list | |
def main(options): | |
commits = git_compare_branches(options.master_branch, options.release_branch) | |
#print(commits) | |
exclude_list = [] | |
if options.exclude_file and os.path.exists(options.excludes_file): | |
with open(options.excludes_file, 'r') as f: | |
contents = f.read() | |
xlist = parse_excludes(contents) | |
exclude_list.extend(xlist) | |
if options.exclude_url: | |
contents = fetch_excludes(options.exclude_url) | |
if (contents): | |
xlist = parse_excludes(contents) | |
exclude_list.extend(xlist) | |
remaining = filter_commits(commits, exclude_list) | |
for c in remaining: | |
print(c) | |
return 0 | |
if __name__ == '__main__': | |
options = parse_args(sys.argv[1:]) | |
#print(options) | |
r = main(options) | |
sys.exit(r) |
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
1b4be08 OD-13940 Android - Unregister bcast receiver once | |
a163cc9 Update OverDrive Dev provisioning profile | |
2bd4b62 BI-52 Report DAS Json (#1813) | |
7d6d58b OD-14807 Handle too short UUID in BLE ad | |
60f4837 OD-14941 install pyyaml with pip2 (#1814) | |
# e4e2bd9 Updating localized *-strings.json from Smartling download. | |
fda985d od-14911 lib/das-client/*.py - use #!/usr/bin/env python | |
8b813fe od-14911 lib/basestation/*.py - use #!/usr/bin/env python | |
f9c0e7a od-14911 lib/anki-util/*.py use #!/usr/bin/env python | |
9bac21a od-14911 tools/smartling/*.py - Use #!/usr/bin/env python | |
0c42c55 od-14911 tools/sdk/*.py - use #!/usr/bin/env python | |
4807a5c od-14911 validateGameData.py - use /usr/bin/env python | |
2f38411 OD-14911 tools/ankibuild/*.py use /usr/bin/env python | |
96c6482 OD-14908 Skip install of unchanged Android APK | |
8e8306b OD-14907 Android - Clean assets before starting build | |
209287c OD-14906 Don't touch unchanged generated Unity files | |
31cf15a Move autopilot car away from truck on takeover (#1802) | |
e1bef52 OD-14872 Remove old `sound-*.zip` during build | |
abf145a OD-14881 Fixed Rect2D crash when backing out of matchsetup to tournament chapter select too fast. (#1800) | |
97fa712 OD-14891 Instantiate mScanCallback on OS > Lollipop | |
224276d Remove #define HAS_BELKER_SHELL and options. No functional changes. | |
0ab2449 OD-13609 adding ignore for any .git files/dirs | |
8acbc55 OD-14875 Remove double logging (#1794) | |
# 6b91d5d Stop pre-loading/caching unused prefabs during Loading | |
c9d4b0f Do not emit redundant state change callbacks. | |
821701d Small firmare code cleanup. No functional changes. | |
dc08b5b OD-14539 SCAN_MODE_BALANCED to coexist with WiFi | |
87dffdc OD-13353 adding localized strings path | |
b1f8c0f OD-13609 adding json lint to top level build scripts | |
d9c2377 Build 285b autocommit by build server ... codesize: 55660 (-52), data: 4736 (-10), RO: 904 (0), RW: 1276 (-8), ZI: 3832 (0) | |
6fcb4c8 Firmware cleanup of supercode detection. | |
12d34ad Create config param for common accel/decel (#1744) | |
d4eeeab Suppress dynamic damage multiplier output (#1758) | |
1bc7a59 Bump assert values (#1756) | |
c665f4d OD-14646 expand worldmap for specialized track pieces (#1731) | |
b4619ee [Weapons] MineItem was leaving behind a DeployedMineWorldItem object if the user changed weapons while a mine was deployed (#1745) | |
bfae4b2 Build 2859 autocommit by build server ... codesize: 55712 (-40), data: 4746 (-4), RO: 904 (0), RW: 1284 (0), ZI: 3832 (0) | |
9ab667b Robotics cleanup: Remove separate supercode sequence detected message. | |
8efb15b OD-14641 Cycle planner modes in practice (#1729) | |
46505bf Build 2857 autocommit by build server ... codesize: 55752 (-4), data: 4750 (-14), RO: 904 (0), RW: 1284 (0), ZI: 3832 (0) | |
dcb5078 mmxCycleHzSinceTransitionBar -> mmSinceLastTransitionBar | |
86484d6 Add VreAnalyzerLocalizationError for OD-13075. | |
25303c1 OD-14262 Smoke Test Script (#1705) | |
15b9226 OD-14648 Break sitting duck in practice when raging (#1710) | |
ef6cb65 Update overlays json from overdrive-vo csv 5419db6 | |
9ecb63f Build 2853 autocommit by build server ... codesize: 55756 (0), data: 4764 (0), RO: 904 (0), RW: 1284 (0), ZI: 3832 (0) | |
5f711b0 OD-14262 smoke test (#1685) | |
598c5b1 Vehicle firmware uses IS_UNKNOWN_OFFSET_FROM_ROAD_CENTER macro. | |
1728d71 Car message cleanup for Offset From Road Center. | |
64e9f10 Update overlays json from overdrive-vo csv b170095 | |
bb8efde Copy targeter offset into TargeterContext subclasses (#1693) | |
1aa0b33 OD-14482 build up initial World map structure (#1638) | |
c0e4e6f OD-14558 Intersection Discovery Crash in Dev | |
6540e14 Code cleanup, physical units more explicit. No functional changes. | |
83d0acc Bump version to 2.1.0 | |
0d3f245 Upgrade vehicle firmware to 0x266a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To change the exclude list, edit this file: https://www.dropbox.com/s/pj8chq1rw8qbqdb/rc.exclude.txt