Changeset 56632 in webkit
- Timestamp:
- Mar 26, 2010 10:32:31 AM (14 years ago)
- Location:
- trunk/WebKitTools
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKitTools/ChangeLog
r56618 r56632 1 2010-03-26 Adam Barth <abarth@webkit.org> 2 3 Reviewed by Eric Seidel. 4 5 Remove some evil statics from CommitInfo 6 https://bugs.webkit.org/show_bug.cgi?id=36637 7 8 These methods should really be on checkout. You can tell because they 9 know about ChangeLogs and take an SCM as an argument. :) 10 11 * Scripts/webkitpy/common/checkout/api.py: 12 * Scripts/webkitpy/common/checkout/changelog.py: 13 * Scripts/webkitpy/common/checkout/commitinfo.py: 14 * Scripts/webkitpy/tool/commands/queries.py: 15 1 16 2010-03-23 Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> 2 17 -
trunk/WebKitTools/Scripts/webkitpy/common/checkout/api.py
r56601 r56632 27 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 28 29 import os 29 30 import subprocess 30 31 31 from webkitpy.common.checkout.changelog import ChangeLog , is_path_to_changelog32 from webkitpy.common.checkout.changelog import ChangeLog 32 33 from webkitpy.common.checkout.commitinfo import CommitInfo 33 34 from webkitpy.common.checkout.scm import CommitMessage … … 43 44 self._scm = scm 44 45 45 def commit_info_for_revision(self, svn_revision): 46 return CommitInfo.commit_info_for_revision(self._scm, svn_revision) 46 def _is_path_to_changelog(self, path): 47 return os.path.basename(path) == "ChangeLog" 48 49 def _latest_entry_for_changelog_at_revision(self, changelog_path, revision): 50 changelog_contents = self._scm.contents_at_revision(changelog_path, revision) 51 return ChangeLog.parse_latest_entry_from_file(StringIO.StringIO(changelog_contents)) 52 53 def changelog_entries_for_revision(self, revision): 54 changed_files = self._scm.changed_files_for_revision(revision) 55 return [self._latest_entry_for_changelog_at_revision(path, revision) for path in changed_files if self._is_path_to_changelog(path)] 56 57 def commit_info_for_revision(self, revision): 58 committer_email = self._scm.committer_email_for_revision(revision) 59 changelog_entries = self.changelog_entries_for_revision(revision) 60 # Assume for now that the first entry has everything we need: 61 changelog_entry = changelog_entries[0] 62 changelog_data = { 63 "bug_id": parse_bug_id(changelog_entry.contents()), 64 "author_name": changelog_entry.author_name(), 65 "author_email": changelog_entry.author_email(), 66 "author": changelog_entry.author(), 67 "reviewer_text": changelog_entry.reviewer_text(), 68 "reviewer": changelog_entry.reviewer(), 69 } 70 # We could pass the changelog_entry instead of a dictionary here, but that makes 71 # mocking slightly more involved, and would make aggregating data from multiple 72 # entries more difficult to wire in if we need to do that in the future. 73 return CommitInfo(revision, committer_email, changelog_data) 47 74 48 75 def modified_changelogs(self): 49 return [path for path in self._scm.changed_files() if is_path_to_changelog(path)]76 return [path for path in self._scm.changed_files() if self._is_path_to_changelog(path)] 50 77 51 78 # FIXME: Requires unit test -
trunk/WebKitTools/Scripts/webkitpy/common/checkout/changelog.py
r56601 r56632 42 42 # Maybe eventually a webkit_config.py? 43 43 return "http://trac.webkit.org/changeset/%s" % revision_number 44 45 # Used by Checkout.modified_changelogs()46 def is_path_to_changelog(path):47 return os.path.basename(path) == "ChangeLog"48 44 49 45 -
trunk/WebKitTools/Scripts/webkitpy/common/checkout/commitinfo.py
r56510 r56632 31 31 import StringIO 32 32 33 from webkitpy.common.checkout.changelog import ChangeLog, is_path_to_changelog34 33 from webkitpy.common.config.committers import CommitterList 35 34 from webkitpy.common.net.bugzilla import parse_bug_id … … 37 36 38 37 class CommitInfo(object): 39 @classmethod40 def _latest_entry_for_changelog_at_revision(cls, scm, changelog_path, revision):41 changelog_contents = scm.contents_at_revision(changelog_path, revision)42 return ChangeLog.parse_latest_entry_from_file(StringIO.StringIO(changelog_contents))43 44 @classmethod45 def _changelog_entries_for_revision(cls, scm, revision):46 changed_files = scm.changed_files_for_revision(revision)47 return [cls._latest_entry_for_changelog_at_revision(scm, path, revision) for path in changed_files if is_path_to_changelog(path)]48 49 @classmethod50 def commit_info_for_revision(cls, scm, revision):51 committer_email = scm.committer_email_for_revision(revision)52 changelog_entries = cls._changelog_entries_for_revision(scm, revision)53 # Assume for now that the first entry has everything we need:54 changelog_entry = changelog_entries[0]55 changelog_data = {56 "bug_id": parse_bug_id(changelog_entry.contents()),57 "author_name": changelog_entry.author_name(),58 "author_email": changelog_entry.author_email(),59 "author": changelog_entry.author(),60 "reviewer_text": changelog_entry.reviewer_text(),61 "reviewer": changelog_entry.reviewer(),62 }63 # We could pass the changelog_entry instead of a dictionary here, but that makes64 # mocking slightly more involved, and would make aggregating data from multiple65 # entries more difficult to wire in if we need to do that in the future.66 return cls(revision, committer_email, changelog_data)67 68 38 def __init__(self, revision, committer_email, changelog_data, committer_list=CommitterList()): 69 39 self._revision = revision -
trunk/WebKitTools/Scripts/webkitpy/tool/commands/queries.py
r56602 r56632 147 147 self._print_builder_line(builder.name(), name_width, "FAIL (blame-list: %s%s)" % (suspect_revisions, first_failure_message)) 148 148 for revision in suspect_revisions: 149 commit_info = CommitInfo.commit_info_for_revision(self.tool.scm(),revision)149 commit_info = self.tool.checkout().commit_info_for_revision(revision) 150 150 self._print_blame_information_for_commit(commit_info) 151 151
Note: See TracChangeset
for help on using the changeset viewer.