[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

abarth at webkit.org abarth at webkit.org
Wed Dec 22 14:44:29 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 1a46e0f7b6301f843fd485ab3c029dd6155ad01d
Author: abarth at webkit.org <abarth at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Oct 19 01:38:00 2010 +0000

    2010-10-18  Adam Barth  <abarth at webkit.org>
    
            Reviewed by Eric Seidel.
    
            scm.py should be able tell us what revisions made changes to a given file
            https://bugs.webkit.org/show_bug.cgi?id=47863
    
            Look again, your SCM.py can now log files.
    
            * Scripts/webkitpy/common/checkout/scm.py:
            * Scripts/webkitpy/common/checkout/scm_unittest.py:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70014 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 9170b90..2166ff8 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,15 @@
+2010-10-18  Adam Barth  <abarth at webkit.org>
+
+        Reviewed by Eric Seidel.
+
+        scm.py should be able tell us what revisions made changes to a given file
+        https://bugs.webkit.org/show_bug.cgi?id=47863
+
+        Look again, your SCM.py can now log files.
+
+        * Scripts/webkitpy/common/checkout/scm.py:
+        * Scripts/webkitpy/common/checkout/scm_unittest.py:
+
 2010-10-18  Dirk Pranke  <dpranke at chromium.org>
 
         Reviewed by Eric Siedel.
diff --git a/WebKitTools/Scripts/webkitpy/common/checkout/scm.py b/WebKitTools/Scripts/webkitpy/common/checkout/scm.py
index 793d96d..6c2c189 100644
--- a/WebKitTools/Scripts/webkitpy/common/checkout/scm.py
+++ b/WebKitTools/Scripts/webkitpy/common/checkout/scm.py
@@ -245,7 +245,10 @@ class SCM:
     def changed_files(self, git_commit=None):
         self._subclass_must_implement()
 
-    def changed_files_for_revision(self):
+    def changed_files_for_revision(self, revision):
+        self._subclass_must_implement()
+
+    def revisions_changing_file(self, path, limit=5):
         self._subclass_must_implement()
 
     def added_files(self):
@@ -427,6 +430,16 @@ class SVN(SCM):
         status_command = ["svn", "diff", "--summarize", "-c", revision]
         return self.run_status_and_extract_filenames(status_command, self._status_regexp("ACDMR"))
 
+    def revisions_changing_file(self, path, limit=5):
+        revisions = []
+        log_command = ['svn', 'log', '--quiet', '--limit=%s' % limit, path]
+        for line in self.run(log_command, cwd=self.checkout_root).splitlines():
+            match = re.search('^r(?P<revision>\d+) ', line)
+            if not match:
+                continue
+            revisions.append(int(match.group('revision')))
+        return revisions
+
     def conflicted_files(self):
         return self.run_status_and_extract_filenames(self.status_command(), self._status_regexp("C"))
 
@@ -653,6 +666,10 @@ class Git(SCM):
         commit_id = self.git_commit_from_svn_revision(revision)
         return self._changes_files_for_commit(commit_id)
 
+    def revisions_changing_file(self, path, limit=5):
+        commit_ids = self.run(["git", "log", "--pretty=format:%H", "-%s" % limit, path]).splitlines()
+        return map(self.svn_revision_from_git_commit, commit_ids)
+
     def conflicted_files(self):
         # We do not need to pass decode_output for this diff command
         # as we're passing --name-status which does not output any data.
@@ -688,6 +705,9 @@ class Git(SCM):
             raise ScriptError(message='Failed to find git commit for revision %s, your checkout likely needs an update.' % revision)
         return git_commit
 
+    def svn_revision_from_git_commit(self, commit_id):
+        return int(self.run(['git', 'svn', 'find-rev', commit_id]).rstrip())
+
     def contents_at_revision(self, path, revision):
         """Returns a byte array (str()) containing the contents
         of path @ revision in the repository."""
diff --git a/WebKitTools/Scripts/webkitpy/common/checkout/scm_unittest.py b/WebKitTools/Scripts/webkitpy/common/checkout/scm_unittest.py
index 87d5539..ed8f009 100644
--- a/WebKitTools/Scripts/webkitpy/common/checkout/scm_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/common/checkout/scm_unittest.py
@@ -352,6 +352,10 @@ class SCMTest(unittest.TestCase):
         self.assertRaises(ScriptError, self.scm.contents_at_revision, "test_file2", 2)
         self.assertRaises(ScriptError, self.scm.contents_at_revision, "does_not_exist", 2)
 
+    def _shared_test_revisions_changing_file(self):
+        self.assertEqual(self.scm.revisions_changing_file("test_file"), [5, 4, 3, 2])
+        self.assertRaises(ScriptError, self.scm.revisions_changing_file, "non_existent_file")
+
     def _shared_test_committer_email_for_revision(self):
         self.assertEqual(self.scm.committer_email_for_revision(3), getpass.getuser())  # Committer "email" will be the current user
 
@@ -696,6 +700,9 @@ Q1dTBx0AAAB42itg4GlgYJjGwMDDyODMxMDw34GBgQEAJPQDJA==
     def test_contents_at_revision(self):
         self._shared_test_contents_at_revision()
 
+    def test_revisions_changing_file(self):
+        self._shared_test_revisions_changing_file()
+
     def test_committer_email_for_revision(self):
         self._shared_test_committer_email_for_revision()
 
@@ -1199,6 +1206,9 @@ class GitSVNTest(SCMTest):
     def test_contents_at_revision(self):
         self._shared_test_contents_at_revision()
 
+    def test_revisions_changing_file(self):
+        self._shared_test_revisions_changing_file()
+
     def test_added_files(self):
         self._shared_test_added_files()
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list