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

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

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

Powered by Google App Engine
This is Rietveld 408576698