Changeset 56601 in webkit


Ignore:
Timestamp:
Mar 25, 2010 10:38:47 PM (14 years ago)
Author:
abarth@webkit.org
Message:

2010-03-25 Adam Barth <abarth@webkit.org>

Reviewed by Eric Seidel.

Move modified_changelogs (and friends) from scm to checkout
https://bugs.webkit.org/show_bug.cgi?id=36636

These functions know about ChangeLogs, which is forbidden knowledge in
scm.py.

  • Scripts/webkitpy/common/checkout/api.py:
  • Scripts/webkitpy/common/checkout/changelog.py:
  • Scripts/webkitpy/common/checkout/scm.py:
  • Scripts/webkitpy/tool/mocktool.py:
  • Scripts/webkitpy/tool/steps/abstractstep.py:
  • Scripts/webkitpy/tool/steps/preparechangelogforrevert.py:
  • Scripts/webkitpy/tool/steps/revertrevision.py:
  • Scripts/webkitpy/tool/steps/updatechangelogswithreviewer.py:
  • Scripts/webkitpy/tool/steps/validatereviewer.py:
Location:
trunk/WebKitTools
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKitTools/ChangeLog

    r56600 r56601  
     12010-03-25  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Move modified_changelogs (and friends) from scm to checkout
     6        https://bugs.webkit.org/show_bug.cgi?id=36636
     7
     8        These functions know about ChangeLogs, which is forbidden knowledge in
     9        scm.py.
     10
     11        * Scripts/webkitpy/common/checkout/api.py:
     12        * Scripts/webkitpy/common/checkout/changelog.py:
     13        * Scripts/webkitpy/common/checkout/scm.py:
     14        * Scripts/webkitpy/tool/mocktool.py:
     15        * Scripts/webkitpy/tool/steps/abstractstep.py:
     16        * Scripts/webkitpy/tool/steps/preparechangelogforrevert.py:
     17        * Scripts/webkitpy/tool/steps/revertrevision.py:
     18        * Scripts/webkitpy/tool/steps/updatechangelogswithreviewer.py:
     19        * Scripts/webkitpy/tool/steps/validatereviewer.py:
     20
    1212010-03-25  Adam Barth  <abarth@webkit.org>
    222
  • trunk/WebKitTools/Scripts/webkitpy/common/checkout/api.py

    r56600 r56601  
    2929import subprocess
    3030
     31from webkitpy.common.checkout.changelog import ChangeLog, is_path_to_changelog
    3132from webkitpy.common.checkout.commitinfo import CommitInfo
    32 from webkitpy.common.checkout.changelog import ChangeLog
    3333from webkitpy.common.checkout.scm import CommitMessage
    3434from webkitpy.common.system.executive import Executive, run_command, ScriptError
     
    4646        return CommitInfo.commit_info_for_revision(self._scm, svn_revision)
    4747
     48    def modified_changelogs(self):
     49        return [path for path in self._scm.changed_files() if is_path_to_changelog(path)]
     50
    4851    # FIXME: Requires unit test
    49     # FIXME: commit_message_for_this_commit and modified_changelogs don't
    50     #        really belong here.  We should have a separate module for
    51     #        handling ChangeLogs.
    5252    def commit_message_for_this_commit(self):
    53         changelog_paths = self._scm.modified_changelogs()
     53        changelog_paths = self.modified_changelogs()
    5454        if not len(changelog_paths):
    5555            raise ScriptError(message="Found no modified ChangeLogs, cannot create a commit message.\n"
     
    8181
    8282        run_command(args, input=curl_process.stdout)
     83
     84    def apply_reverse_diff(self, revision):
     85        self._scm.apply_reverse_diff(revision)
     86
     87        # Fix any ChangeLogs if necessary.
     88        changelog_paths = self.modified_changelogs()
     89        if len(changelog_paths):
     90            # FIXME: Move _scm.script_path here once we get rid of all the dependencies.
     91            run_command([self._scm.script_path('resolve-ChangeLogs')] + changelog_paths)
     92
     93        conflicts = self._scm.conflicted_files()
     94        if len(conflicts):
     95            raise ScriptError(message="Failed to apply reverse diff for revision %s because of the following conflicts:\n%s" % (revision, "\n".join(conflicts)))
  • trunk/WebKitTools/Scripts/webkitpy/common/checkout/changelog.py

    r56544 r56601  
    4343    return "http://trac.webkit.org/changeset/%s" % revision_number
    4444
    45 # Used by SCM.modified_changelogs()
     45# Used by Checkout.modified_changelogs()
    4646def is_path_to_changelog(path):
    4747    return os.path.basename(path) == "ChangeLog"
  • trunk/WebKitTools/Scripts/webkitpy/common/checkout/scm.py

    r56600 r56601  
    3333import re
    3434
    35 from webkitpy.common.checkout.changelog import ChangeLog, is_path_to_changelog
    3635from webkitpy.common.system.executive import Executive, run_command, ScriptError
    3736from webkitpy.common.system.user import User
     
    140139        match = re.search(self.commit_success_regexp(), commit_text, re.MULTILINE)
    141140        return match.group('svn_revision')
    142 
    143     # ChangeLog-specific code doesn't really belong in scm.py, but this function is very useful.
    144     def modified_changelogs(self):
    145         return [path for path in self.changed_files() if is_path_to_changelog(path)]
    146141
    147142    @staticmethod
     
    468463        run_command(['git', 'revert', '--no-commit', git_commit], error_handler=Executive.ignore_error)
    469464
    470         # Fix any ChangeLogs if necessary.
    471         changelog_paths = self.modified_changelogs()
    472         if len(changelog_paths):
    473             run_command([self.script_path('resolve-ChangeLogs')] + changelog_paths)
    474 
    475         conflicts = self.conflicted_files()
    476         if len(conflicts):
    477             raise ScriptError(message="Failed to apply reverse diff for revision %s because of the following conflicts:\n%s" % (revision, "\n".join(conflicts)))
    478 
    479465    def revert_files(self, file_paths):
    480466        run_command(['git', 'checkout', 'HEAD'] + file_paths)
  • trunk/WebKitTools/Scripts/webkitpy/tool/mocktool.py

    r56600 r56601  
    359359        return "49824"
    360360
    361     def modified_changelogs(self):
    362         # Ideally we'd return something more interesting here.  The problem is
    363         # that LandDiff will try to actually read the patch from disk!
    364         return []
    365 
    366361
    367362class MockCheckout(object):
     
    379374        })
    380375
     376    def modified_changelogs(self):
     377        # Ideally we'd return something more interesting here.  The problem is
     378        # that LandDiff will try to actually read the patch from disk!
     379        return []
     380
    381381    def commit_message_for_this_commit(self):
    382382        return Mock()
     
    385385        pass
    386386
     387    def apply_reverse_diff(self, revision):
     388        pass
    387389
    388390class MockUser(object):
  • trunk/WebKitTools/Scripts/webkitpy/tool/steps/abstractstep.py

    r56544 r56601  
    5151    _well_known_keys = {
    5252        "diff" : lambda self: self._tool.scm().create_patch(),
    53         "changelogs" : lambda self: self._tool.scm().modified_changelogs(),
     53        "changelogs" : lambda self: self._tool.checkout().modified_changelogs(),
    5454    }
    5555
  • trunk/WebKitTools/Scripts/webkitpy/tool/steps/preparechangelogforrevert.py

    r56510 r56601  
    3737        # First, discard the ChangeLog changes from the rollout.
    3838        os.chdir(self._tool.scm().checkout_root)
    39         changelog_paths = self._tool.scm().modified_changelogs()
     39        changelog_paths = self._tool.checkout().modified_changelogs()
    4040        self._tool.scm().revert_files(changelog_paths)
    4141
  • trunk/WebKitTools/Scripts/webkitpy/tool/steps/revertrevision.py

    r56497 r56601  
    3232class RevertRevision(AbstractStep):
    3333    def run(self, state):
    34         self._tool.scm().apply_reverse_diff(state["revision"])
     34        self._tool.checkout().apply_reverse_diff(state["revision"])
  • trunk/WebKitTools/Scripts/webkitpy/tool/steps/updatechangelogswithreviewer.py

    r56544 r56601  
    6868
    6969        os.chdir(self._tool.scm().checkout_root)
    70         for changelog_path in self._tool.scm().modified_changelogs():
     70        for changelog_path in self._tool.checkout().modified_changelogs():
    7171            ChangeLog(changelog_path).set_reviewer(reviewer)
  • trunk/WebKitTools/Scripts/webkitpy/tool/steps/validatereviewer.py

    r56589 r56601  
    4040        #        directory issue more globally.
    4141        os.chdir(self._tool.scm().checkout_root)
    42         for changelog_path in self._tool.scm().modified_changelogs():
     42        for changelog_path in self._tool.checkout().modified_changelogs():
    4343            changelog_entry = ChangeLog(changelog_path).latest_entry()
    4444            if changelog_entry.reviewer():
Note: See TracChangeset for help on using the changeset viewer.