| OLD | NEW |
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 import posixpath | 5 import posixpath |
| 6 | 6 |
| 7 from file_system import FileSystem, FileNotFoundError | 7 from file_system import FileSystem, FileNotFoundError |
| 8 from future import Future | 8 from future import Future |
| 9 from test_file_system import _List, _StatTracker, TestFileSystem | 9 from test_file_system import _List, _StatTracker, TestFileSystem |
| 10 from path_util import IsDirectory | 10 from path_util import IsDirectory |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 self._stat_tracker.GetVersion(posixpath.join(path, child_path))) | 84 self._stat_tracker.GetVersion(posixpath.join(path, child_path))) |
| 85 | 85 |
| 86 return stat | 86 return stat |
| 87 | 87 |
| 88 def GetCommitID(self): | 88 def GetCommitID(self): |
| 89 return Future(value=self._stat_tracker.GetVersion('')) | 89 return Future(value=self._stat_tracker.GetVersion('')) |
| 90 | 90 |
| 91 def GetPreviousCommitID(self): | 91 def GetPreviousCommitID(self): |
| 92 return Future(value=self._stat_tracker.GetVersion('') - 1) | 92 return Future(value=self._stat_tracker.GetVersion('') - 1) |
| 93 | 93 |
| 94 def GetIdentity(self): | 94 def GetStableIdentity(self): |
| 95 return self._file_system.GetIdentity() | 95 return self._file_system.GetStableIdentity() |
| 96 | 96 |
| 97 def __str__(self): | 97 def __str__(self): |
| 98 return repr(self) | 98 return repr(self) |
| 99 | 99 |
| 100 def __repr__(self): | 100 def __repr__(self): |
| 101 return 'MockFileSystem(read_count=%s, stat_count=%s, updates=%s)' % ( | 101 return 'MockFileSystem(read_count=%s, stat_count=%s, updates=%s)' % ( |
| 102 self._read_count, self._stat_count, len(self._updates)) | 102 self._read_count, self._stat_count, len(self._updates)) |
| 103 | 103 |
| 104 # | 104 # |
| 105 # Testing methods. | 105 # Testing methods. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 129 self._read_resolve_count = 0 | 129 self._read_resolve_count = 0 |
| 130 self._stat_count = 0 | 130 self._stat_count = 0 |
| 131 | 131 |
| 132 def Update(self, update): | 132 def Update(self, update): |
| 133 self._updates.append(TestFileSystem(update)) | 133 self._updates.append(TestFileSystem(update)) |
| 134 for path in _List(update).iterkeys(): | 134 for path in _List(update).iterkeys(): |
| 135 # Any files (not directories) which changed are now at the version | 135 # Any files (not directories) which changed are now at the version |
| 136 # derived from |_updates|. | 136 # derived from |_updates|. |
| 137 if not IsDirectory(path): | 137 if not IsDirectory(path): |
| 138 self._stat_tracker.SetVersion(path, len(self._updates)) | 138 self._stat_tracker.SetVersion(path, len(self._updates)) |
| OLD | NEW |