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

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

Issue 2671583002: Revert of Simplify the initialization of Git objects in Host. (Closed)
Patch Set: Created 3 years, 10 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, filesystem=None, executive=None):
17 self.checkout_root = '/mock-checkout' 17 self.checkout_root = '/mock-checkout'
18 self.cwd = cwd or self.checkout_root
19 self.added_paths = set() 18 self.added_paths = set()
20 self._filesystem = filesystem or MockFileSystem() 19 self._filesystem = filesystem or MockFileSystem()
21 self._executive = executive or MockExecutive() 20 self._executive = executive or MockExecutive()
22 self._local_commits = [] 21 self._local_commits = []
23 22
24 def add_all(self, pathspec=None): 23 def add_all(self, pathspec=None):
25 if not pathspec: 24 if not pathspec:
26 pathspec = self.checkout_root 25 pathspec = self.checkout_root
27 for path in self._filesystem.glob(pathspec): 26 for path in self._filesystem.glob(pathspec):
28 self.add_list(self._filesystem.files_under(path)) 27 self.add_list(self._filesystem.files_under(path))
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 104
106 def move(self, origin, destination): 105 def move(self, origin, destination):
107 if self._filesystem: 106 if self._filesystem:
108 self._filesystem.move(self.absolute_path(origin), self.absolute_path (destination)) 107 self._filesystem.move(self.absolute_path(origin), self.absolute_path (destination))
109 108
110 def changed_files(self): 109 def changed_files(self):
111 return [] 110 return []
112 111
113 def unstaged_changes(self): 112 def unstaged_changes(self):
114 return {} 113 return {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698