Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/scm_mock.py

Issue 2397573002: Don't track SCM changes in rebaseline commands. (Closed)
Patch Set: Update message and docstring for has_working_directory_changes Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright (C) 2011 Google Inc. All rights reserved. 1 # Copyright (C) 2011 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 13 matching lines...) Expand all
24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 28
29 from webkitpy.common.system.filesystem_mock import MockFileSystem 29 from webkitpy.common.system.filesystem_mock import MockFileSystem
30 from webkitpy.common.system.executive_mock import MockExecutive 30 from webkitpy.common.system.executive_mock import MockExecutive
31 31
32 32
33 class MockSCM(object): 33 class MockSCM(object):
34
35 # Arguments are generally unused in methods that return canned values below.
36 # pylint: disable=unused-argument
37
34 executable_name = "MockSCM" 38 executable_name = "MockSCM"
35 39
36 def __init__(self, filesystem=None, executive=None): 40 def __init__(self, filesystem=None, executive=None):
37 self.checkout_root = "/mock-checkout" 41 self.checkout_root = "/mock-checkout"
38 self.added_paths = set() 42 self.added_paths = set()
39 self._filesystem = filesystem or MockFileSystem() 43 self._filesystem = filesystem or MockFileSystem()
40 self._executive = executive or MockExecutive() 44 self._executive = executive or MockExecutive()
41 self._local_commits = [] 45 self._local_commits = []
42 46
47 def add_all(self, pathspec=None):
48 if not pathspec:
49 pathspec = self.checkout_root
50 for path in self._filesystem.glob(pathspec):
51 self.add_list(self._filesystem.files_under(path))
52
43 def add(self, destination_path, return_exit_code=False): 53 def add(self, destination_path, return_exit_code=False):
44 self.add_list([destination_path], return_exit_code) 54 self.add_list([destination_path], return_exit_code)
45 55
46 def add_list(self, destination_paths, return_exit_code=False): 56 def add_list(self, destination_paths, return_exit_code=False):
47 self.added_paths.update(set(destination_paths)) 57 self.added_paths.update(set(destination_paths))
48 if return_exit_code: 58 if return_exit_code:
49 return 0 59 return 0
50 60
51 def has_working_directory_changes(self): 61 def has_working_directory_changes(self, pathspec=None):
52 return False 62 return False
53 63
54 def ensure_cleanly_tracking_remote_master(self): 64 def ensure_cleanly_tracking_remote_master(self):
55 pass 65 pass
56 66
57 def current_branch(self): 67 def current_branch(self):
58 return "mock-branch-name" 68 return "mock-branch-name"
59 69
60 def current_branch_or_ref(self): 70 def current_branch_or_ref(self):
61 return "mock-branch-name" 71 return "mock-branch-name"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 for path in paths: 123 for path in paths:
114 if self._filesystem.exists(path): 124 if self._filesystem.exists(path):
115 self._filesystem.remove(path) 125 self._filesystem.remove(path)
116 126
117 def move(self, origin, destination): 127 def move(self, origin, destination):
118 if self._filesystem: 128 if self._filesystem:
119 self._filesystem.move(self.absolute_path(origin), self.absolute_path (destination)) 129 self._filesystem.move(self.absolute_path(origin), self.absolute_path (destination))
120 130
121 def changed_files(self): 131 def changed_files(self):
122 return [] 132 return []
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698