Changeset 48794 in webkit


Ignore:
Timestamp:
Sep 26, 2009 4:14:21 PM (15 years ago)
Author:
ddkilzer@apple.com
Message:
<http://webkit.org/b/29764> mark-bug-fixed: add -oopen switch

Reviewed by Eric Seidel.

The -oopen switch uses the open(1) command on Mac OS X to

open the bug URL in the default web browser. If there are
similar mechanisms on other platforms, they may be added later.

  • Scripts/mark-bug-fixed:
(MarkBugFixed.init): Added -oopen switch to list of parse

options.
(MarkBugFixed._determine_bug_id_and_svn_revision): Moved logging
code into main() and extracted prompting code into
_prompt_user_for_correctness().
(MarkBugFixed._open_bug_in_web_browser): Added.
(MarkBugFixed._prompt_user_for_correctness): Added.
(MarkBugFixed.main): Added logging code from
_determine_bug_id_and_svn_revision(). Added code to call
_open_bug_in_web_browser() if the switch is set. Added code to
call _prompt_user_for_correctness() when needed.

  • Scripts/modules/bugzilla.py: (Bugzilla.short_bug_url_for_bug_id): Added.
Location:
trunk/WebKitTools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKitTools/ChangeLog

    r48793 r48794  
     12009-09-26  David Kilzer  <ddkilzer@apple.com>
     2
     3        <http://webkit.org/b/29764> mark-bug-fixed: add -o|--open switch
     4
     5        Reviewed by Eric Seidel.
     6
     7        The -o|--open switch uses the open(1) command on Mac OS X to
     8        open the bug URL in the default web browser.  If there are
     9        similar mechanisms on other platforms, they may be added later.
     10
     11        * Scripts/mark-bug-fixed:
     12        (MarkBugFixed.__init__): Added -o|--open switch to list of parse
     13        options.
     14        (MarkBugFixed._determine_bug_id_and_svn_revision): Moved logging
     15        code into main() and extracted prompting code into
     16        _prompt_user_for_correctness().
     17        (MarkBugFixed._open_bug_in_web_browser): Added.
     18        (MarkBugFixed._prompt_user_for_correctness): Added.
     19        (MarkBugFixed.main): Added logging code from
     20        _determine_bug_id_and_svn_revision().  Added code to call
     21        _open_bug_in_web_browser() if the switch is set.  Added code to
     22        call _prompt_user_for_correctness() when needed.
     23        * Scripts/modules/bugzilla.py:
     24        (Bugzilla.short_bug_url_for_bug_id): Added.
     25
    1262009-09-26  David Kilzer  <ddkilzer@apple.com>
    227
  • trunk/WebKitTools/Scripts/mark-bug-fixed

    r48772 r48794  
    3535from modules.comments import bug_comment_from_svn_revision
    3636from modules.logging import error, log
    37 from modules.scm import detect_scm_system
     37from modules.scm import SCM, detect_scm_system
    3838
    3939
     
    4545        self.option_parser.add_option("-b", "--bug-id", action="store", type="string", dest="bug_id", help="Specify bug id if no URL is provided in the commit log.")
    4646        self.option_parser.add_option("-m", "--comment", action="store", type="string", dest="comment", help="Text to include in bug comment.")
     47        self.option_parser.add_option("-o", "--open", action="store_true", default=False, dest="open_bug", help="Open bug in default web browser (Mac only).")
    4748        self.option_parser.add_option("-u", "--update-only", action="store_true", default=False, dest="update_only", help="Add comment to the bug, but do not close it.")
    4849
     
    7980                  % (" or ".join(not_found), "r%s" % svn_revision if svn_revision else "last commit"))
    8081
    81         log("Bug: <http://webkit.org/b/%s> %s" % (bug_id, self.bugs.fetch_title_from_bug(bug_id)))
    82         log("Revision: %s" % svn_revision)
     82        return (bug_id, svn_revision)
     83
     84    def _open_bug_in_web_browser(self, bug_id):
     85        if sys.platform == "darwin":
     86            SCM.run_command(["open", self.bugs.short_bug_url_for_bug_id(bug_id)])
     87            return
     88        log("WARNING: -o|--open is only supported on Mac OS X.")
     89
     90    def _prompt_user_for_correctness(self, bug_id, svn_revision):
    8391        answer = raw_input("Is this correct (y/N)? ")
    8492        if not re.match("^\s*y(es)?", answer, re.IGNORECASE):
    8593            exit(1)
    86 
    87         return (bug_id, svn_revision)
    8894
    8995    def main(self):
     
    102108                error("Invalid svn revision: '%s'" % svn_revision)
    103109
     110        needs_prompt = False
    104111        if not bug_id or not svn_revision:
     112            needs_prompt = True
    105113            (bug_id, svn_revision) = self._determine_bug_id_and_svn_revision(bug_id, svn_revision)
     114
     115        log("Bug: <%s> %s" % (self.bugs.short_bug_url_for_bug_id(bug_id), self.bugs.fetch_title_from_bug(bug_id)))
     116        log("Revision: %s" % svn_revision)
     117
     118        if options.open_bug:
     119            self._open_bug_in_web_browser(bug_id)
     120
     121        if needs_prompt:
     122            self._prompt_user_for_correctness(bug_id, svn_revision)
    106123
    107124        bug_comment = bug_comment_from_svn_revision(svn_revision)
  • trunk/WebKitTools/Scripts/modules/bugzilla.py

    r48700 r48794  
    152152        content_type = "&ctype=xml" if xml else ""
    153153        return "%sshow_bug.cgi?id=%s%s" % (self.bug_server_url, bug_id, content_type)
    154    
     154
     155    def short_bug_url_for_bug_id(self, bug_id):
     156        return "http://webkit.org/b/%s" % bug_id
     157
    155158    def attachment_url_for_id(self, attachment_id, action="view"):
    156159        action_param = ""
Note: See TracChangeset for help on using the changeset viewer.