Commit 7ac4e590ac6e8768ba059ef151508e676fbd334d

  • avatar
  • Ademar de Souza Reis Jr <ademar.reis @open…ssa.org>
  • Mon Sep 06 20:33:04 CEST 2010
[cherry-pick] Add --bugs=BUGS option

Useful to check if fixes for a particular bug have been cherry-picked
to this branch or not.
  
151151op.add_option("", "--no-auto-skip", default=False, action="store_true", help="don't add bugs to the skipped list automatically")
152152op.add_option("", "--ignore-skipped", default=False, action="store_true", help="ignore the skipped list")
153153op.add_option("", "--always-no", default=False, action="store_true", help="automatically answer no to all questions")
154op.add_option("", "--bugs", type="string", action="store", help="Check if patches from BUGS (comma separated list) have been included in this branch")
154155
155156options = op.parse_args()[0]
156157
158# (Strip off refs/heads/ and newline)
159releaseBranch = run(["git", "symbolic-ref", "HEAD"])[11:-1]
160
157161masterBugs = []
158for commit in masterBugsForBranch.keys():
159 branches = run(["git", "branch", "--contains=%s" % commit]).split("\n")
160 for branch in branches:
161 if branch.startswith("* "):
162 masterBugs = masterBugsForBranch[commit]
162
163if options.bugs:
164 bugs = options.bugs.split(",")
165else:
166 for commit in masterBugsForBranch.keys():
167 branches = run(["git", "branch", "--contains=%s" % commit]).split("\n")
168 for branch in branches:
169 if branch.startswith("* "):
170 masterBugs = masterBugsForBranch[commit]
171 break
172 if masterBugs:
163173 break
164 if masterBugs:
165 break
166174
167if not masterBugs:
168 die("Error, cannot detect on which branch you're on!")
175 if not masterBugs:
176 die("Error, cannot find a master bug for the branch you're on!")
169177
170# (Strip off refs/heads/ and newline)
171releaseBranch = run(["git", "symbolic-ref", "HEAD"])[11:-1]
178 print "Querying Bugzilla for a list of bugs with patches that need to be back-ported"
179 bugs = bugsThatNeedToBeCherryPicked(masterBugs, releaseBranch, options.ignore_skipped)
172180
173print "Querying Bugzilla for a list of bugs with patches that need to be back-ported"
174bugs = bugsThatNeedToBeCherryPicked(masterBugs, releaseBranch, options.ignore_skipped)
181 print "%s bugs found." % len(bugs)
175182
176183bugzilla = CommentBugzilla(dryrun = False)
177184bugzilla.authenticate()
178
179print "%s bugs found." % len(bugs)
180185
181186commits = []
182187count = 0