Commit 37832c0f522b18071306647dc03f2c3499fc9079

  • avatar
  • Ademar de Souza Reis Jr <ademar.reis @open…ssa.org>
  • Sat Aug 28 01:20:20 CEST 2010
[cherry-pick] Add support for multiple masterBugs

Use a list for masterBugs so that we can have multiple bugs for tracking (as
is the case with qtwebkit-2.1, which has a master for critical bugs
and other for candidates.)

There's no need to have the master bugs depending on each other anymore and
we now correctly remove the block after the patch is cherry-picked.
  
88import urllib
99import re
1010
11masterBugForBranch = {
12 "d362c2e1c4559bf5ab4b4efaf3b8b09613f7c3fd": 39313,
13 "54ecd4d4473ddea4fe630726cab29ff06278ca2e": 44677
11masterBugsForBranch = {
12 "d362c2e1c4559bf5ab4b4efaf3b8b09613f7c3fd": [39313],
13 "54ecd4d4473ddea4fe630726cab29ff06278ca2e": [39121, 44677]
1414}
1515
1616# export PYTHONPATH="/path/to/your/webkit//WebKitTools/Scripts/"
111111 branch = branch.translate(string.maketrans("._/", "---")) # XXX
112112 return branch;
113113
114def bugsThatNeedToBeCherryPicked(masterBug, releaseBranch, ignoreSkipped=False):
114def bugsThatNeedToBeCherryPicked(masterBugs, releaseBranch, ignoreSkipped=False):
115115 skippedBugs = run(["git", "config", "--get-all", "skippedbugs.%s" % normalizeBranchName(releaseBranch)])
116 bugs = []
116117
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)
135136
136 return bugs
137 return list(set(bugs))
137138
138 sys.exit(1)
139
140139def addBugToSkipList(bug, branch):
141140 branch = normalizeBranchName(branch)
142141 run(["git", "config", "--add", "skippedbugs.%s" % branch, bug])
146146
147147options = op.parse_args()[0]
148148
149masterBug = 0
150for commit in masterBugForBranch.keys():
149masterBugs = []
150for commit in masterBugsForBranch.keys():
151151 branches = run(["git", "branch", "--contains=%s" % commit]).split("\n")
152152 for branch in branches:
153153 if branch.startswith("* "):
154 masterBug = masterBugForBranch[commit]
154 masterBugs = masterBugsForBranch[commit]
155155 break
156 if masterBug > 0:
156 if masterBugs:
157157 break
158158
159if masterBug == 0:
159if not masterBugs:
160160 die("Error, cannot detect on which branch you're on!")
161161
162162# (Strip off refs/heads/ and newline)
163163releaseBranch = run(["git", "symbolic-ref", "HEAD"])[11:-1]
164164
165165print "Querying Bugzilla for a list of bugs with patches that need to be back-ported"
166bugs = bugsThatNeedToBeCherryPicked(masterBug, releaseBranch, options.ignore_skipped)
166bugs = bugsThatNeedToBeCherryPicked(masterBugs, releaseBranch, options.ignore_skipped)
167167
168168bugzilla = CommentBugzilla(dryrun = False)
169169bugzilla.authenticate()
240240 bugzilla.post_comment_to_bug(dict["id"], comment)
241241
242242 if allCherryPicked:
243 if masterBug in dict["blocked"]:
243 blockedBugs = set(dict["blocked"]).intersection(set(masterBugs))
244 if blockedBugs:
244245 response = User.prompt("Bug has all patches landed and cherry-picked it seems. Do you want to remove it from the blockers? (y/n) ")
245246 if response == "y":
246247 blockers = dict["blocked"]
247 blockers.remove(masterBug)
248 [blockers.remove(bug) for bug in blockedBugs]
248249 bugzilla.update_blocked_bugs(dict["id"], blockers)
249250 elif foundCommentsForAllCherryPicks:
250251 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."