Changeset 56835 in webkit


Ignore:
Timestamp:
Mar 31, 2010 3:45:57 AM (14 years ago)
Author:
eric@webkit.org
Message:

2010-03-31 Eric Seidel <eric@webkit.org>

Reviewed by Adam Barth.

path to committers.py in commit-queue rejection message is wrong
https://bugs.webkit.org/show_bug.cgi?id=36865

This fix would have only been 3 lines long if we had

  1. Had access to an SCM object or tool to give us the checkout root
  2. Been able to depend on Python 2.6 Instead I've added a bunch of hack code, but at least now we should never have to update this string again as the location of committers.py is fully dynamically discovered. :p
  • Scripts/webkitpy/common/net/bugzilla.py:
  • Scripts/webkitpy/common/net/bugzilla_unittest.py:
Location:
trunk/WebKitTools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKitTools/ChangeLog

    r56828 r56835  
     12010-03-31  Eric Seidel  <eric@webkit.org>
     2
     3        Reviewed by Adam Barth.
     4
     5        path to committers.py in commit-queue rejection message is wrong
     6        https://bugs.webkit.org/show_bug.cgi?id=36865
     7
     8        This fix would have only been 3 lines long if we had
     9        1. Had access to an SCM object or tool to give us the checkout root
     10        2. Been able to depend on Python 2.6
     11        Instead I've added a bunch of hack code, but at least now
     12        we should never have to update this string again as the location
     13        of committers.py is fully dynamically discovered. :p
     14
     15        * Scripts/webkitpy/common/net/bugzilla.py:
     16        * Scripts/webkitpy/common/net/bugzilla_unittest.py:
     17
    1182010-03-31  Shinichiro Hamaji  <hamaji@chromium.org>
    219
  • trunk/WebKitTools/Scripts/webkitpy/common/net/bugzilla.py

    r56544 r56835  
    3131# WebKit's Python module for interacting with Bugzilla
    3232
     33import os.path
    3334import re
    3435import subprocess
     
    3839# Import WebKit-specific modules.
    3940from webkitpy.common.system.deprecated_logging import error, log
    40 from webkitpy.common.config.committers import CommitterList
     41from webkitpy.common.config import committers
    4142from webkitpy.common.net.credentials import Credentials
    4243from webkitpy.common.system.user import User
     
    278279        return "http://trac.webkit.org/browser/trunk/%s" % local_path
    279280
     281    def _checkout_root(self):
     282        # FIXME: This is a hack, we would have this from scm.checkout_root
     283        # if we had any way to get to an scm object here.
     284        components = __file__.split(os.sep)
     285        tools_index = components.index("WebKitTools")
     286        return os.sep.join(components[:tools_index])
     287
     288    def _relpath(self, path, start):
     289        # FIXME: When we're allowed to use python 2.6 we can use the real os.path.relpath
     290        path_components = os.path.realpath(path).split(os.sep)
     291        start_components = os.path.realpath(start).split(os.sep)
     292        if path_components[len(start_components) - 1].lower() != start_components[-1].lower():
     293            raise "This os.path.relpath hack can't handle path=%s start=%s" % (path, start)
     294        return os.sep.join(path_components[len(start_components):])
     295
     296    def _committers_py_path(self):
     297        # extension can sometimes be .pyc, we always want .py
     298        (path, extension) = os.path.splitext(committers.__file__)
     299        path = self._relpath(path, self._checkout_root())
     300        return ".".join([path, "py"])
     301
    280302    def _flag_permission_rejection_message(self, setter_email, flag_name):
    281         # This could be computed from CommitterList.__file__
    282         committer_list = "WebKitTools/Scripts/webkitpy/committers.py"
    283303        # Should come from some webkit_config.py
    284304        contribution_guidlines = "http://webkit.org/coding/contributing.html"
     
    287307        # This could be queried from the tool.
    288308        queue_name = "commit-queue"
     309        committers_list = self._committers_py_path()
    289310        message = "%s does not have %s permissions according to %s." % (
    290311                        setter_email,
    291312                        flag_name,
    292                         self._view_source_url(committer_list))
     313                        self._view_source_url(committers_list))
    293314        message += "\n\n- If you do not have %s rights please read %s for instructions on how to use bugzilla flags." % (
    294315                        flag_name, contribution_guidlines)
    295316        message += "\n\n- If you have %s rights please correct the error in %s by adding yourself to the file (no review needed).  " % (
    296                         flag_name, committer_list)
     317                        flag_name, committers_list)
    297318        message += "Due to bug 30084 the %s will require a restart after your change.  " % queue_name
    298319        message += "Please contact %s to request a %s restart.  " % (
     
    347368class Bugzilla(object):
    348369
    349     def __init__(self, dryrun=False, committers=CommitterList()):
     370    def __init__(self, dryrun=False, committers=committers.CommitterList()):
    350371        self.dryrun = dryrun
    351372        self.authenticated = False
  • trunk/WebKitTools/Scripts/webkitpy/common/net/bugzilla_unittest.py

    r56519 r56835  
    6262    def test_flag_permission_rejection_message(self):
    6363        validator = CommitterValidator(bugzilla=None)
    64         expected_messsage="""foo@foo.com does not have review permissions according to http://trac.webkit.org/browser/trunk/WebKitTools/Scripts/webkitpy/committers.py.
     64        self.assertEqual(validator._committers_py_path(), "WebKitTools/Scripts/webkitpy/common/config/committers.py")
     65        expected_messsage="""foo@foo.com does not have review permissions according to http://trac.webkit.org/browser/trunk/WebKitTools/Scripts/webkitpy/common/config/committers.py.
    6566
    6667- If you do not have review rights please read http://webkit.org/coding/contributing.html for instructions on how to use bugzilla flags.
    6768
    68 - If you have review rights please correct the error in WebKitTools/Scripts/webkitpy/committers.py by adding yourself to the file (no review needed).  Due to bug 30084 the commit-queue will require a restart after your change.  Please contact eseidel@chromium.org to request a commit-queue restart.  After restart the commit-queue will correctly respect your review rights."""
     69- If you have review rights please correct the error in WebKitTools/Scripts/webkitpy/common/config/committers.py by adding yourself to the file (no review needed).  Due to bug 30084 the commit-queue will require a restart after your change.  Please contact eseidel@chromium.org to request a commit-queue restart.  After restart the commit-queue will correctly respect your review rights."""
    6970        self.assertEqual(validator._flag_permission_rejection_message("foo@foo.com", "review"), expected_messsage)
    7071
Note: See TracChangeset for help on using the changeset viewer.