| OLD | NEW |
| 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 def __init__(self, cwd=None, filesystem=None, executive=None, platform=None)
: |
| 15 | |
| 16 def __init__(self, cwd=None, filesystem=None, executive=None): | |
| 17 self.checkout_root = '/mock-checkout' | 15 self.checkout_root = '/mock-checkout' |
| 18 self.cwd = cwd or self.checkout_root | 16 self.cwd = cwd or self.checkout_root |
| 19 self.added_paths = set() | 17 self.added_paths = set() |
| 20 self._filesystem = filesystem or MockFileSystem() | 18 self._filesystem = filesystem or MockFileSystem() |
| 21 self._executive = executive or MockExecutive() | 19 self._executive = executive or MockExecutive() |
| 22 self._local_commits = [] | 20 self._local_commits = [] |
| 23 | 21 |
| 24 def add(self, destination_path, return_exit_code=False): | 22 def add(self, destination_path, return_exit_code=False): |
| 25 self.add_list([destination_path], return_exit_code) | 23 self.add_list([destination_path], return_exit_code) |
| 26 | 24 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 | 97 |
| 100 def move(self, origin, destination): | 98 def move(self, origin, destination): |
| 101 if self._filesystem: | 99 if self._filesystem: |
| 102 self._filesystem.move(self.absolute_path(origin), self.absolute_path
(destination)) | 100 self._filesystem.move(self.absolute_path(origin), self.absolute_path
(destination)) |
| 103 | 101 |
| 104 def changed_files(self, diff_filter='ADM'): | 102 def changed_files(self, diff_filter='ADM'): |
| 105 return [] | 103 return [] |
| 106 | 104 |
| 107 def unstaged_changes(self): | 105 def unstaged_changes(self): |
| 108 return {} | 106 return {} |
| OLD | NEW |