WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-72703-20111118021229.patch (text/plain), 10.54 KB, created by
Ryosuke Niwa
on 2011-11-18 02:12:31 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Ryosuke Niwa
Created:
2011-11-18 02:12:31 PST
Size:
10.54 KB
patch
obsolete
>Subversion Revision: 100728 >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index bb619ba0597c5bda8c665e451b02091619dae078..30e75109d321950db17eab4ea97dffd2fb40bcc4 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,21 @@ >+2011-11-18 Ryosuke Niwa <rniwa@webkit.org> >+ >+ ChangeLog should be able to parse annotated changelogs >+ https://bugs.webkit.org/show_bug.cgi?id=72703 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Make parse_entries_from_file aware of svn blame annotation such as "100000 ossy@webkit.org ", >+ and extract the revision number for each entry. >+ >+ Also add a support to extract "svn blame" result from svn/git checkout to scm classes. >+ >+ * Scripts/webkitpy/common/checkout/changelog.py: >+ * Scripts/webkitpy/common/checkout/changelog_unittest.py: >+ * Scripts/webkitpy/common/checkout/scm/git.py: >+ * Scripts/webkitpy/common/checkout/scm/scm.py: >+ * Scripts/webkitpy/common/checkout/scm/svn.py: >+ > 2011-11-17 Raphael Kubo da Costa <kubo@profusion.mobi> > > [EFL] Clean up the use of DATA_DIR in the buildsystem >diff --git a/Tools/Scripts/webkitpy/common/checkout/changelog.py b/Tools/Scripts/webkitpy/common/checkout/changelog.py >index 2f6c33b803e728cab3969e0b9e50cbc2b4a96c42..01e127d187c26318ccba76f2ad066873ebaf64af 100644 >--- a/Tools/Scripts/webkitpy/common/checkout/changelog.py >+++ b/Tools/Scripts/webkitpy/common/checkout/changelog.py >@@ -110,9 +110,10 @@ class ChangeLogEntry(object): > # e.g. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@96161 268f45cc-cd09-0410-ab3c-d52691b4dbfc > svn_id_regexp = r'git-svn-id: http://svn.webkit.org/repository/webkit/trunk@(?P<svnid>\d+) ' > >- def __init__(self, contents, committer_list=CommitterList()): >+ def __init__(self, contents, committer_list=CommitterList(), revision=None): > self._contents = contents > self._committer_list = committer_list >+ self._revision = revision > self._parse_entry() > > @staticmethod >@@ -167,6 +168,9 @@ class ChangeLogEntry(object): > > self._touched_files = re.findall(self.touched_files_regexp, self._contents, re.MULTILINE) > >+ def revision(self): >+ return self._revision >+ > def author_name(self): > return self._author_name > >@@ -237,6 +241,15 @@ class ChangeLog(object): > entry_lines.append(line) > return None # We never found a date line! > >+ svn_blame_regexp = re.compile(r'^(\s*(?P<revision>\d+) [^ ]+)\s(?P<line>.*?\n)') >+ >+ @staticmethod >+ def _sepearate_revision_and_line(line): >+ match = ChangeLog.svn_blame_regexp.match(line) >+ if not match: >+ return None, line >+ return int(match.group('revision')), match.group('line') >+ > @staticmethod > def parse_entries_from_file(changelog_file): > """changelog_file must be a file-like object which returns >@@ -244,20 +257,35 @@ class ChangeLog(object): > to pass file objects to this class.""" > date_line_regexp = re.compile(ChangeLogEntry.date_line_regexp) > rolled_over_regexp = re.compile(ChangeLogEntry.rolled_over_regexp) >- entry_lines = [] >+ > # The first line should be a date line. >- first_line = changelog_file.readline() >+ revision, first_line = ChangeLog._sepearate_revision_and_line(changelog_file.readline()) > assert(isinstance(first_line, unicode)) >- if not date_line_regexp.match(first_line): >+ if not date_line_regexp.match(ChangeLog.svn_blame_regexp.sub('', first_line)): > raise StopIteration >- entry_lines.append(first_line) > >+ entry_lines = [first_line] >+ revisions_in_entry = {revision: 1} if revision != None else None > for line in changelog_file: >- if date_line_regexp.match(line) or rolled_over_regexp.match(line): >+ if revisions_in_entry: >+ revision, line = ChangeLog._sepearate_revision_and_line(line) >+ >+ if rolled_over_regexp.match(line): >+ break >+ >+ if date_line_regexp.match(line): >+ most_probable_revision = max(revisions_in_entry, key=revisions_in_entry.__getitem__) if revisions_in_entry else None > # Remove the extra newline at the end >- yield ChangeLogEntry(''.join(entry_lines[:-1])) >+ yield ChangeLogEntry(''.join(entry_lines[:-1]), revision=most_probable_revision) > entry_lines = [] >+ revisions_in_entry = {revision: 0} >+ > entry_lines.append(line) >+ if revisions_in_entry: >+ revisions_in_entry[revision] = revisions_in_entry.get(revision, 0) + 1 >+ >+ most_probable_revision = max(revisions_in_entry, key=revisions_in_entry.__getitem__) if revisions_in_entry else None >+ yield ChangeLogEntry(''.join(entry_lines[:-1]), revision=most_probable_revision) > > def latest_entry(self): > # ChangeLog files are always UTF-8, we read them in as such to support Reviewers with unicode in their names. >diff --git a/Tools/Scripts/webkitpy/common/checkout/changelog_unittest.py b/Tools/Scripts/webkitpy/common/checkout/changelog_unittest.py >index b88370a7db51e90571c1e5489287696962e889cf..932b6c4e6af700fd27ba8d6a0dc3d7f6df256508 100644 >--- a/Tools/Scripts/webkitpy/common/checkout/changelog_unittest.py >+++ b/Tools/Scripts/webkitpy/common/checkout/changelog_unittest.py >@@ -251,6 +251,52 @@ class ChangeLogTest(unittest.TestCase): > self.assertEquals(parsed_entries[7].reviewer_text(), None) > self.assertEquals(parsed_entries[8].reviewer_text(), 'Darin Adler') > >+ def test_parse_log_entries_from_annotated_file(self): >+ changelog_file = StringIO(u'''100000 ossy@webkit.org 2011-11-11 Csaba Osztrogon\u00e1c <ossy@webkit.org> >+100000 ossy@webkit.org >+100000 ossy@webkit.org 100,000 !!! >+100000 ossy@webkit.org >+100000 ossy@webkit.org Reviewed by Zoltan Herczeg. >+100000 ossy@webkit.org >+100000 ossy@webkit.org * ChangeLog: Point out revision 100,000. >+100000 ossy@webkit.org >+93798 ap@apple.com 2011-08-25 Alexey Proskuryakov <ap@apple.com> >+93798 ap@apple.com >+93798 ap@apple.com Fix build when GCC 4.2 is not installed. >+93798 ap@apple.com >+93798 ap@apple.com * gtest/xcode/Config/CompilerVersion.xcconfig: Copied from Source/WebCore/Configurations/CompilerVersion.xcconfig. >+93798 ap@apple.com * gtest/xcode/Config/General.xcconfig: >+93798 ap@apple.com Use the same compiler version as other projects do. >+93798 ap@apple.com >+99491 andreas.kling@nokia.com 2011-11-03 Andreas Kling <kling@webkit.org> >+99491 andreas.kling@nokia.com >+99190 andreas.kling@nokia.com Unreviewed build fix, sigh. >+99190 andreas.kling@nokia.com >+99190 andreas.kling@nokia.com * css/CSSFontFaceRule.h: >+99190 andreas.kling@nokia.com * css/CSSMutableStyleDeclaration.h: >+99190 andreas.kling@nokia.com >+99190 andreas.kling@nokia.com 2011-11-03 Andreas Kling <kling@webkit.org> >+99190 andreas.kling@nokia.com >+99187 andreas.kling@nokia.com Unreviewed build fix, out-of-line StyleSheet::parentStyleSheet() >+99187 andreas.kling@nokia.com again since there's a cycle in the includes between CSSRule/StyleSheet. >+99187 andreas.kling@nokia.com >+99187 andreas.kling@nokia.com * css/StyleSheet.cpp: >+99187 andreas.kling@nokia.com (WebCore::StyleSheet::parentStyleSheet): >+99187 andreas.kling@nokia.com * css/StyleSheet.h: >+99187 andreas.kling@nokia.com >+''') >+ parsed_entries = list(ChangeLog.parse_entries_from_file(changelog_file)) >+ self.assertEquals(parsed_entries[0].revision(), 100000) >+ self.assertEquals(parsed_entries[0].reviewer_text(), "Zoltan Herczeg") >+ self.assertEquals(parsed_entries[0].author_name(), u"Csaba Osztrogon\u00e1c") >+ self.assertEquals(parsed_entries[0].author_email(), "ossy@webkit.org") >+ self.assertEquals(parsed_entries[1].revision(), 93798) >+ self.assertEquals(parsed_entries[1].author_name(), "Alexey Proskuryakov") >+ self.assertEquals(parsed_entries[2].revision(), 99190) >+ self.assertEquals(parsed_entries[2].author_name(), "Andreas Kling") >+ self.assertEquals(parsed_entries[3].revision(), 99187) >+ self.assertEquals(parsed_entries[3].author_name(), "Andreas Kling") >+ > def _assert_parse_reviewer_text_and_list(self, text, expected_reviewer_text, expected_reviewer_text_list=None): > reviewer_text, reviewer_text_list = ChangeLogEntry._parse_reviewer_text(text) > self.assertEquals(reviewer_text, expected_reviewer_text) >diff --git a/Tools/Scripts/webkitpy/common/checkout/scm/git.py b/Tools/Scripts/webkitpy/common/checkout/scm/git.py >index d485574e0981ba293fd5425a883739cb4755dfd6..7c23be0565c319374c3f177b1662e940c02bfeda 100644 >--- a/Tools/Scripts/webkitpy/common/checkout/scm/git.py >+++ b/Tools/Scripts/webkitpy/common/checkout/scm/git.py >@@ -401,6 +401,9 @@ class Git(SCM, SVNRepository): > def last_svn_commit_log(self): > return self.run(['git', 'svn', 'log', '--limit=1']) > >+ def svn_blame(self, path): >+ return self.run(['git', 'svn', 'blame', path]) >+ > # Git-specific methods: > def _branch_ref_exists(self, branch_ref): > return self.run(['git', 'show-ref', '--quiet', '--verify', branch_ref], return_exit_code=True) == 0 >diff --git a/Tools/Scripts/webkitpy/common/checkout/scm/scm.py b/Tools/Scripts/webkitpy/common/checkout/scm/scm.py >index 001b7e41cc336a1d9cc994083a03f5f9ba374764..b00470bbb24b7fa84b2fa6ff7498238ae2e72cb4 100644 >--- a/Tools/Scripts/webkitpy/common/checkout/scm/scm.py >+++ b/Tools/Scripts/webkitpy/common/checkout/scm/scm.py >@@ -218,6 +218,9 @@ class SCM: > def last_svn_commit_log(self): > self._subclass_must_implement() > >+ def svn_blame(self, path): >+ self._subclass_must_implement() >+ > # Subclasses must indicate if they support local commits, > # but the SCM baseclass will only call local_commits methods when this is true. > @staticmethod >diff --git a/Tools/Scripts/webkitpy/common/checkout/scm/svn.py b/Tools/Scripts/webkitpy/common/checkout/scm/svn.py >index 55873c3ede950c8dd9ed75d4e4a9c3f4a73a0218..cd4e1ea602e440d4450124643d2e6c2f758aaa68 100644 >--- a/Tools/Scripts/webkitpy/common/checkout/scm/svn.py >+++ b/Tools/Scripts/webkitpy/common/checkout/scm/svn.py >@@ -350,6 +350,9 @@ class SVN(SCM, SVNRepository): > # http://svnbook.red-bean.com/en/1.0/ch03s03.html > return self.svn_commit_log('BASE') > >+ def svn_blame(self, path): >+ return self._run_svn(['blame', path]) >+ > def propset(self, pname, pvalue, path): > dir, base = os.path.split(path) > return self._run_svn(['pset', pname, pvalue, base], cwd=dir)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
eric
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 72703
: 115770