Title: [194415] trunk/Tools
Revision
194415
Author
[email protected]
Date
2015-12-24 02:42:53 -0800 (Thu, 24 Dec 2015)

Log Message

Python SCM should be able to retrieve untracked files - Generic changes
https://bugs.webkit.org/show_bug.cgi?id=152536

Reviewed by Brent Fulgham.

This patch introduces SCM.untracked_files to retrieve a list of untracked files.
No support is yet added to GIT and SVN specific implementations.

* Scripts/webkitpy/common/checkout/scm/scm.py:
(SCM.untracked_files):
* Scripts/webkitpy/common/checkout/scm/scm_unittest.py:
(SCMTest._shared_test_untracked_files):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (194414 => 194415)


--- trunk/Tools/ChangeLog	2015-12-24 07:40:29 UTC (rev 194414)
+++ trunk/Tools/ChangeLog	2015-12-24 10:42:53 UTC (rev 194415)
@@ -1,3 +1,18 @@
+2015-12-24  Youenn Fablet  <[email protected]>
+
+        Python SCM should be able to retrieve untracked files - Generic changes
+        https://bugs.webkit.org/show_bug.cgi?id=152536
+
+        Reviewed by Brent Fulgham.
+
+        This patch introduces SCM.untracked_files to retrieve a list of untracked files.
+        No support is yet added to GIT and SVN specific implementations.
+
+        * Scripts/webkitpy/common/checkout/scm/scm.py:
+        (SCM.untracked_files):
+        * Scripts/webkitpy/common/checkout/scm/scm_unittest.py:
+        (SCMTest._shared_test_untracked_files):
+
 2015-12-23  Dewei Zhu  <[email protected]>
 
         SVN checkout used by RunBenchmark should be non-interactive

Modified: trunk/Tools/Scripts/webkitpy/common/checkout/scm/scm.py (194414 => 194415)


--- trunk/Tools/Scripts/webkitpy/common/checkout/scm/scm.py	2015-12-24 07:40:29 UTC (rev 194414)
+++ trunk/Tools/Scripts/webkitpy/common/checkout/scm/scm.py	2015-12-24 10:42:53 UTC (rev 194415)
@@ -204,6 +204,9 @@
     def has_working_directory_changes(self):
         self._subclass_must_implement()
 
+    def untracked_files(self, include_ignored_files=False):
+        self._subclass_must_implement()
+
     def discard_working_directory_changes(self):
         self._subclass_must_implement()
 

Modified: trunk/Tools/Scripts/webkitpy/common/checkout/scm/scm_unittest.py (194414 => 194415)


--- trunk/Tools/Scripts/webkitpy/common/checkout/scm/scm_unittest.py	2015-12-24 07:40:29 UTC (rev 194414)
+++ trunk/Tools/Scripts/webkitpy/common/checkout/scm/scm_unittest.py	2015-12-24 10:42:53 UTC (rev 194415)
@@ -309,6 +309,29 @@
         self.assertItemsEqual(self.scm.changed_files(), ["test_dir/test_file3", "test_file"])
         os.chdir(old_cwd)
 
+    def _shared_test_untracked_files(self, scm):
+        write_into_file_at_path("test_file_new", "new content")
+        self.assertItemsEqual(scm.untracked_files(), ["test_file_new"])
+
+        os.mkdir("test_dir_new")
+        write_into_file_at_path(os.path.join("test_dir_new", "test_file_new"), "new stuff")
+        self.assertItemsEqual(scm.untracked_files(), ["test_dir_new", "test_file_new"])
+
+        old_cwd = os.getcwd()
+        os.chdir("test_dir_new")
+        # Validate that untracked_files do not change with our cwd.
+        self.assertItemsEqual(scm.untracked_files(), ["test_dir_new", "test_file_new"])
+
+        os.chdir(old_cwd)
+
+        write_into_file_at_path("test_file_new.pyc", "new ignored file")
+        self.assertItemsEqual(scm.untracked_files(), ["test_dir_new", "test_file_new"])
+        self.assertItemsEqual(scm.untracked_files(include_ignored_files=True), ["test_file_new.pyc", "test_dir_new", "test_file_new"])
+
+        shutil.rmtree("test_dir_new")
+        os.remove("test_file_new")
+        os.remove("test_file_new.pyc")
+
     def _shared_test_added_files(self):
         write_into_file_at_path("test_file", "changed content")
         self.assertItemsEqual(self.scm.added_files(), [])
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to