OLD | NEW |
1 # coding=utf8 | 1 # coding=utf8 |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 import ConfigParser | 10 import ConfigParser |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 class SvnConfig(object): | 248 class SvnConfig(object): |
249 """Parses a svn configuration file.""" | 249 """Parses a svn configuration file.""" |
250 def __init__(self, svn_config_dir=None): | 250 def __init__(self, svn_config_dir=None): |
251 super(SvnConfig, self).__init__() | 251 super(SvnConfig, self).__init__() |
252 self.svn_config_dir = svn_config_dir | 252 self.svn_config_dir = svn_config_dir |
253 self.default = not bool(self.svn_config_dir) | 253 self.default = not bool(self.svn_config_dir) |
254 if not self.svn_config_dir: | 254 if not self.svn_config_dir: |
255 if sys.platform == 'win32': | 255 if sys.platform == 'win32': |
256 self.svn_config_dir = os.path.join(os.environ['APPDATA'], 'Subversion') | 256 self.svn_config_dir = os.path.join(os.environ['APPDATA'], 'Subversion') |
257 else: | 257 else: |
258 self.svn_config_dir = os.path.join(os.environ['HOME'], '.subversion') | 258 self.svn_config_dir = os.path.expanduser( |
| 259 os.path.join('~', '.subversion')) |
259 svn_config_file = os.path.join(self.svn_config_dir, 'config') | 260 svn_config_file = os.path.join(self.svn_config_dir, 'config') |
260 parser = ConfigParser.SafeConfigParser() | 261 parser = ConfigParser.SafeConfigParser() |
261 if os.path.isfile(svn_config_file): | 262 if os.path.isfile(svn_config_file): |
262 parser.read(svn_config_file) | 263 parser.read(svn_config_file) |
263 else: | 264 else: |
264 parser.add_section('auto-props') | 265 parser.add_section('auto-props') |
265 self.auto_props = dict(parser.items('auto-props')) | 266 self.auto_props = dict(parser.items('auto-props')) |
266 | 267 |
267 | 268 |
268 class SvnMixIn(object): | 269 class SvnMixIn(object): |
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
829 def revisions(self, rev1, rev2): | 830 def revisions(self, rev1, rev2): |
830 return self.checkout.revisions(rev1, rev2) | 831 return self.checkout.revisions(rev1, rev2) |
831 | 832 |
832 @property | 833 @property |
833 def project_name(self): | 834 def project_name(self): |
834 return self.checkout.project_name | 835 return self.checkout.project_name |
835 | 836 |
836 @property | 837 @property |
837 def project_path(self): | 838 def project_path(self): |
838 return self.checkout.project_path | 839 return self.checkout.project_path |
OLD | NEW |