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

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

Issue 2744143002: Remove unused methods in Git and related classes. (Closed)
Patch Set: Rebase Created 3 years, 9 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 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 from webkitpy.common.system.filesystem_mock import MockFileSystem 5 from webkitpy.common.system.filesystem_mock import MockFileSystem
6 from webkitpy.common.system.executive_mock import MockExecutive 6 from webkitpy.common.system.executive_mock import MockExecutive
7 7
8 8
9 class MockGit(object): 9 class MockGit(object):
10 10
11 # Arguments are listed below, even if they're unused, in order to match 11 # Arguments are listed below, even if they're unused, in order to match
12 # the Git class. pylint: disable=unused-argument 12 # the Git class. pylint: disable=unused-argument
13 13
14 executable_name = 'mock-git' 14 executable_name = 'mock-git'
15 15
16 def __init__(self, cwd=None, filesystem=None, executive=None): 16 def __init__(self, cwd=None, filesystem=None, executive=None):
17 self.checkout_root = '/mock-checkout' 17 self.checkout_root = '/mock-checkout'
18 self.cwd = cwd or self.checkout_root 18 self.cwd = cwd or self.checkout_root
19 self.added_paths = set() 19 self.added_paths = set()
20 self._filesystem = filesystem or MockFileSystem() 20 self._filesystem = filesystem or MockFileSystem()
21 self._executive = executive or MockExecutive() 21 self._executive = executive or MockExecutive()
22 self._local_commits = [] 22 self._local_commits = []
23 23
24 def add_all(self, pathspec=None):
25 if not pathspec:
26 pathspec = self.checkout_root
27 for path in self._filesystem.glob(pathspec):
28 self.add_list(self._filesystem.files_under(path))
29
30 def add(self, destination_path, return_exit_code=False): 24 def add(self, destination_path, return_exit_code=False):
31 self.add_list([destination_path], return_exit_code) 25 self.add_list([destination_path], return_exit_code)
32 26
33 def add_list(self, destination_paths, return_exit_code=False): 27 def add_list(self, destination_paths, return_exit_code=False):
34 self.added_paths.update(set(destination_paths)) 28 self.added_paths.update(set(destination_paths))
35 if return_exit_code: 29 if return_exit_code:
36 return 0 30 return 0
37 31
38 def has_working_directory_changes(self, pathspec=None): 32 def has_working_directory_changes(self, pathspec=None):
39 return False 33 return False
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 99
106 def move(self, origin, destination): 100 def move(self, origin, destination):
107 if self._filesystem: 101 if self._filesystem:
108 self._filesystem.move(self.absolute_path(origin), self.absolute_path (destination)) 102 self._filesystem.move(self.absolute_path(origin), self.absolute_path (destination))
109 103
110 def changed_files(self, diff_filter='ADM'): 104 def changed_files(self, diff_filter='ADM'):
111 return [] 105 return []
112 106
113 def unstaged_changes(self): 107 def unstaged_changes(self):
114 return {} 108 return {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698