Commit 37832c0f522b18071306647dc03f2c3499fc9079
- Diff rendering mode:
- inline
- side by side
cherry-pick-into-release-branch.py
(33 / 33)
|   | |||
| 8 | 8 | import urllib | |
| 9 | 9 | import re | |
| 10 | 10 | ||
| 11 | masterBugForBranch = { | ||
| 12 | "d362c2e1c4559bf5ab4b4efaf3b8b09613f7c3fd": 39313, | ||
| 13 | "54ecd4d4473ddea4fe630726cab29ff06278ca2e": 44677 | ||
| 11 | masterBugsForBranch = { | ||
| 12 | "d362c2e1c4559bf5ab4b4efaf3b8b09613f7c3fd": [39313], | ||
| 13 | "54ecd4d4473ddea4fe630726cab29ff06278ca2e": [39121, 44677] | ||
| 14 | 14 | } | |
| 15 | 15 | ||
| 16 | 16 | # export PYTHONPATH="/path/to/your/webkit//WebKitTools/Scripts/" | |
| … | … | ||
| 111 | 111 | branch = branch.translate(string.maketrans("._/", "---")) # XXX | |
| 112 | 112 | return branch; | |
| 113 | 113 | ||
| 114 | def bugsThatNeedToBeCherryPicked(masterBug, releaseBranch, ignoreSkipped=False): | ||
| 114 | def bugsThatNeedToBeCherryPicked(masterBugs, releaseBranch, ignoreSkipped=False): | ||
| 115 | 115 | skippedBugs = run(["git", "config", "--get-all", "skippedbugs.%s" % normalizeBranchName(releaseBranch)]) | |
| 116 | bugs = [] | ||
| 116 | 117 | ||
| 117 | print "Querying master bug %s" % masterBug | ||
| 118 | f = urllib.urlopen("https://bugs.webkit.org/showdependencytree.cgi?id=%s&hide_resolved=0" % masterBug) | ||
| 119 | data = f.readlines() | ||
| 120 | for line in data: | ||
| 121 | if "view as bug list" in line: | ||
| 122 | line = line.strip() | ||
| 123 | match = re.search('href="(.*?)"', line) | ||
| 124 | buglist = "https://bugs.webkit.org/%s&bug_status=RESOLVED&bug_status=VERIFIED&resolution=FIXED&ctype=csv" % match.group(1) | ||
| 125 | f = urllib.urlopen(buglist) | ||
| 126 | bugs = [] | ||
| 127 | data = f.readlines() | ||
| 128 | data = data[1:] | ||
| 129 | for bug in data: | ||
| 130 | id = bug.split(",")[0] | ||
| 131 | if id in skippedBugs and not ignoreSkipped: | ||
| 132 | print "Warning: skipping bug %s" % id | ||
| 133 | continue | ||
| 134 | bugs.append(id) | ||
| 118 | for masterBug in masterBugs: | ||
| 119 | print "Querying master bug %s" % masterBug | ||
| 120 | f = urllib.urlopen("https://bugs.webkit.org/showdependencytree.cgi?id=%s&hide_resolved=0" % masterBug) | ||
| 121 | data = f.readlines() | ||
| 122 | for line in data: | ||
| 123 | if "view as bug list" in line: | ||
| 124 | line = line.strip() | ||
| 125 | match = re.search('href="(.*?)"', line) | ||
| 126 | buglist = "https://bugs.webkit.org/%s&bug_status=RESOLVED&bug_status=VERIFIED&resolution=FIXED&ctype=csv" % match.group(1) | ||
| 127 | f = urllib.urlopen(buglist) | ||
| 128 | data = f.readlines() | ||
| 129 | data = data[1:] | ||
| 130 | for bug in data: | ||
| 131 | id = bug.split(",")[0] | ||
| 132 | if id in skippedBugs and not ignoreSkipped: | ||
| 133 | print "Warning: skipping bug %s" % id | ||
| 134 | continue | ||
| 135 | bugs.append(id) | ||
| 135 | 136 | ||
| 136 | return bugs | ||
| 137 | return list(set(bugs)) | ||
| 137 | 138 | ||
| 138 | sys.exit(1) | ||
| 139 | |||
| 140 | 139 | def addBugToSkipList(bug, branch): | |
| 141 | 140 | branch = normalizeBranchName(branch) | |
| 142 | 141 | run(["git", "config", "--add", "skippedbugs.%s" % branch, bug]) | |
| … | … | ||
| 146 | 146 | ||
| 147 | 147 | options = op.parse_args()[0] | |
| 148 | 148 | ||
| 149 | masterBug = 0 | ||
| 150 | for commit in masterBugForBranch.keys(): | ||
| 149 | masterBugs = [] | ||
| 150 | for commit in masterBugsForBranch.keys(): | ||
| 151 | 151 | branches = run(["git", "branch", "--contains=%s" % commit]).split("\n") | |
| 152 | 152 | for branch in branches: | |
| 153 | 153 | if branch.startswith("* "): | |
| 154 | masterBug = masterBugForBranch[commit] | ||
| 154 | masterBugs = masterBugsForBranch[commit] | ||
| 155 | 155 | break | |
| 156 | if masterBug > 0: | ||
| 156 | if masterBugs: | ||
| 157 | 157 | break | |
| 158 | 158 | ||
| 159 | if masterBug == 0: | ||
| 159 | if not masterBugs: | ||
| 160 | 160 | die("Error, cannot detect on which branch you're on!") | |
| 161 | 161 | ||
| 162 | 162 | # (Strip off refs/heads/ and newline) | |
| 163 | 163 | releaseBranch = run(["git", "symbolic-ref", "HEAD"])[11:-1] | |
| 164 | 164 | ||
| 165 | 165 | print "Querying Bugzilla for a list of bugs with patches that need to be back-ported" | |
| 166 | bugs = bugsThatNeedToBeCherryPicked(masterBug, releaseBranch, options.ignore_skipped) | ||
| 166 | bugs = bugsThatNeedToBeCherryPicked(masterBugs, releaseBranch, options.ignore_skipped) | ||
| 167 | 167 | ||
| 168 | 168 | bugzilla = CommentBugzilla(dryrun = False) | |
| 169 | 169 | bugzilla.authenticate() | |
| … | … | ||
| 240 | 240 | bugzilla.post_comment_to_bug(dict["id"], comment) | |
| 241 | 241 | ||
| 242 | 242 | if allCherryPicked: | |
| 243 | if masterBug in dict["blocked"]: | ||
| 243 | blockedBugs = set(dict["blocked"]).intersection(set(masterBugs)) | ||
| 244 | if blockedBugs: | ||
| 244 | 245 | response = User.prompt("Bug has all patches landed and cherry-picked it seems. Do you want to remove it from the blockers? (y/n) ") | |
| 245 | 246 | if response == "y": | |
| 246 | 247 | blockers = dict["blocked"] | |
| 247 | blockers.remove(masterBug) | ||
| 248 | [blockers.remove(bug) for bug in blockedBugs] | ||
| 248 | 249 | bugzilla.update_blocked_bugs(dict["id"], blockers) | |
| 249 | 250 | elif foundCommentsForAllCherryPicks: | |
| 250 | 251 | print "Bug has all patches landed and I found cherry-pick comments for each cherry-pick. However the bug isn't directly blocking the master bug, so let's skip it." |

