Changeset 182119 in webkit


Ignore:
Timestamp:
Mar 29, 2015 11:47:04 AM (9 years ago)
Author:
youenn.fablet@crf.canon.fr
Message:

[buildbot] clean-build script should remove untracked files and revert local changes too
https://bugs.webkit.org/show_bug.cgi?id=142400

Reviewed by Ryosuke Niwa.

This patch cleans the WebKit folder by deleting SCM untracked files and reverting changes for tracked files.

  • BuildSlaveSupport/clean-build:

(main): Adding call to Tools/Scripts/clean-webkit.

  • Scripts/clean-webkit: Added.

(main): Removes untracked and changed files.

  • Scripts/webkitpy/common/checkout/scm/git.py:

(Git.untracked_files): Retrieves GIT untracked files.

  • Scripts/webkitpy/common/checkout/scm/scm.py:

(SCM.untracked_files): Retrieves SVN untracked files.
(SCM):
(SCM.discard_untracked_files): Deletes untracked files/folders.

  • Scripts/webkitpy/common/checkout/scm/scm_unittest.py:

(SCMTest._shared_test_untracked_files): Unit testing for untracked files.
(test_untracked_files):
(GitSVNTest.test_untracked_files):

  • Scripts/webkitpy/common/checkout/scm/svn.py:

(SVN.untracked_files):

Location:
trunk/Tools
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/BuildSlaveSupport/clean-build

    r158393 r182119  
    5151    shutil.rmtree(webkit_build_directory)
    5252
     53    subprocess.Popen(['python', os.path.join(os.path.dirname(__file__), "..", "Scripts", "clean-webkit"])
     54
    5355if __name__ == '__main__':
    5456    sys.exit(main())
  • trunk/Tools/ChangeLog

    r182103 r182119  
     12015-03-29  Youenn Fablet  <youenn.fablet@crf.canon.fr>
     2
     3        [buildbot] clean-build script should remove untracked files and revert local changes too
     4        https://bugs.webkit.org/show_bug.cgi?id=142400
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        This patch cleans the WebKit folder by deleting SCM untracked files and reverting changes for tracked files.
     9
     10        * BuildSlaveSupport/clean-build:
     11        (main): Adding call to Tools/Scripts/clean-webkit.
     12        * Scripts/clean-webkit: Added.
     13        (main): Removes untracked and changed files.
     14        * Scripts/webkitpy/common/checkout/scm/git.py:
     15        (Git.untracked_files): Retrieves GIT untracked files.
     16        * Scripts/webkitpy/common/checkout/scm/scm.py:
     17        (SCM.untracked_files): Retrieves SVN untracked files.
     18        (SCM):
     19        (SCM.discard_untracked_files): Deletes untracked files/folders.
     20        * Scripts/webkitpy/common/checkout/scm/scm_unittest.py:
     21        (SCMTest._shared_test_untracked_files): Unit testing for untracked files.
     22        (test_untracked_files):
     23        (GitSVNTest.test_untracked_files):
     24        * Scripts/webkitpy/common/checkout/scm/svn.py:
     25        (SVN.untracked_files):
     26
    1272015-03-27  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
    228
  • trunk/Tools/Scripts/webkitpy/common/checkout/scm/git.py

    r175991 r182119  
    215215        return self.run_status_and_extract_filenames(status_command, updated_in_index_regexp)
    216216
     217    def untracked_files(self):
     218        status_command = [self.executable_name, 'status', '--short', '--ignored']
     219        status_command.extend(self._patch_directories)
     220        # Remove the last / for folders to match SVN behavior.
     221        return [value if not value.endswith('/') else value[:-1] for value in self.run_status_and_extract_filenames(status_command, "^[?!][?!] (?P<filename>.+)$")]
     222
    217223    def changed_files(self, git_commit=None):
    218224        # FIXME: --diff-filter could be used to avoid the "extract_filenames" step.
  • trunk/Tools/Scripts/webkitpy/common/checkout/scm/scm.py

    r159796 r182119  
    205205        self._subclass_must_implement()
    206206
     207    def untracked_files(self):
     208        self._subclass_must_implement()
     209
     210    def discard_untracked_files(self):
     211        for filename in self.untracked_files():
     212            if self._filesystem.isdir(filename):
     213                self._filesystem.rmtree(filename)
     214            else:
     215                self._filesystem.remove(filename)
     216
    207217    def discard_working_directory_changes(self):
    208218        self._subclass_must_implement()
  • trunk/Tools/Scripts/webkitpy/common/checkout/scm/scm_unittest.py

    r174136 r182119  
    310310        os.chdir(old_cwd)
    311311
     312    def _shared_test_untracked_files(self, scm):
     313        write_into_file_at_path("test_file_new", "new content")
     314        self.assertItemsEqual(scm.untracked_files(), ["test_file_new"])
     315
     316        os.mkdir("test_dir_new")
     317        write_into_file_at_path("test_dir_new/test_file_new", "new stuff")
     318        self.assertItemsEqual(scm.untracked_files(), ["test_dir_new", "test_file_new"])
     319
     320        # Validate that untracked_files do not change with .gitignore/svn:ignore.
     321        # FIXME: Add svn:ignore property setting
     322        write_into_file_at_path(".gitignore", "test_file_new\ntest_dir_new\n")
     323        self.assertItemsEqual(scm.untracked_files(), [".gitignore", "test_dir_new", "test_file_new"])
     324
     325        old_cwd = os.getcwd()
     326        os.chdir("test_dir_new")
     327        # Validate that untracked_files do not change with our cwd.
     328        self.assertItemsEqual(scm.untracked_files(), [".gitignore", "test_dir_new", "test_file_new"])
     329
     330        os.chdir(old_cwd)
     331        shutil.rmtree("test_dir_new")
     332        os.remove(".gitignore")
     333        os.remove("test_file_new")
     334
    312335    def _shared_test_added_files(self):
    313336        write_into_file_at_path("test_file", "changed content")
     
    807830        self._shared_test_changed_files()
    808831
     832    def test_untracked_files(self):
     833        self._shared_test_untracked_files(self.scm)
     834
    809835    def test_changed_files_for_revision(self):
    810836        self._shared_test_changed_files_for_revision()
     
    14601486        self._shared_test_changed_files()
    14611487
     1488    def test_untracked_files(self):
     1489        self._shared_test_untracked_files(self.scm)
     1490
    14621491    def test_changed_files_for_revision(self):
    14631492        self._shared_test_changed_files_for_revision()
  • trunk/Tools/Scripts/webkitpy/common/checkout/scm/svn.py

    r167957 r182119  
    145145        return self._run_svn(["diff"], cwd=self.checkout_root, decode_output=False) != ""
    146146
     147    def untracked_files(self):
     148        status_command = [self.executable_name, "status", "--no-ignore"]
     149        status_command.extend(self._patch_directories)
     150        return self.run_status_and_extract_filenames(status_command, self._status_regexp("I?"))
     151
    147152    def discard_working_directory_changes(self):
    148153        # Make sure there are no locks lying around from a previously aborted svn invocation.
Note: See TracChangeset for help on using the changeset viewer.