OLD | NEW |
1 # coding=utf8 | 1 # coding=utf8 |
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 """Manages a project checkout. | 5 """Manages a project checkout. |
6 | 6 |
7 Includes support for svn, git-svn and git. | 7 Includes support for svn, git-svn and git. |
8 """ | 8 """ |
9 | 9 |
10 from __future__ import with_statement | 10 from __future__ import with_statement |
(...skipping 24 matching lines...) Expand all Loading... |
35 for line in settings_file.readlines(): | 35 for line in settings_file.readlines(): |
36 if not line or line.startswith('#'): | 36 if not line or line.startswith('#'): |
37 continue | 37 continue |
38 if not ':' in line: | 38 if not ':' in line: |
39 # Invalid file. | 39 # Invalid file. |
40 return None | 40 return None |
41 k, v = line.split(':', 1) | 41 k, v = line.split(':', 1) |
42 settings[k.strip()] = v.strip() | 42 settings[k.strip()] = v.strip() |
43 finally: | 43 finally: |
44 settings_file.close() | 44 settings_file.close() |
45 except OSError: | 45 except IOError: |
46 return None | 46 return None |
47 return settings.get(key, None) | 47 return settings.get(key, None) |
48 | 48 |
49 | 49 |
50 class PatchApplicationFailed(Exception): | 50 class PatchApplicationFailed(Exception): |
51 """Patch failed to be applied.""" | 51 """Patch failed to be applied.""" |
52 def __init__(self, filename, status): | 52 def __init__(self, filename, status): |
53 super(PatchApplicationFailed, self).__init__(filename, status) | 53 super(PatchApplicationFailed, self).__init__(filename, status) |
54 self.filename = filename | 54 self.filename = filename |
55 self.status = status | 55 self.status = status |
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
707 user, message)) | 707 user, message)) |
708 return 'FAKE' | 708 return 'FAKE' |
709 | 709 |
710 @property | 710 @property |
711 def project_name(self): | 711 def project_name(self): |
712 return self.checkout.project_name | 712 return self.checkout.project_name |
713 | 713 |
714 @property | 714 @property |
715 def project_path(self): | 715 def project_path(self): |
716 return self.checkout.project_path | 716 return self.checkout.project_path |
OLD | NEW |