Chromium Code Reviews| 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 | |
| 11 import fnmatch | 10 import fnmatch |
| 12 import logging | 11 import logging |
| 13 import os | 12 import os |
| 14 import re | 13 import re |
| 15 import shutil | 14 import shutil |
| 16 import subprocess | 15 import subprocess |
| 17 import sys | 16 import sys |
| 18 import tempfile | 17 import tempfile |
| 19 | 18 |
| 19 # The configparser module was renamed in Python 3. | |
|
nodir
2016/06/16 18:55:58
this comment should be inside except clause
vapier
2016/06/16 19:13:47
"configparser" is the py3 name which is in the try
| |
| 20 try: | |
| 21 import configparser | |
| 22 except ImportError: | |
| 23 import ConfigParser as configparser | |
| 24 | |
| 20 import patch | 25 import patch |
| 21 import scm | 26 import scm |
| 22 import subprocess2 | 27 import subprocess2 |
| 23 | 28 |
| 24 | 29 |
| 25 if sys.platform in ('cygwin', 'win32'): | 30 if sys.platform in ('cygwin', 'win32'): |
| 26 # Disable timeouts on Windows since we can't have shells with timeouts. | 31 # Disable timeouts on Windows since we can't have shells with timeouts. |
| 27 GLOBAL_TIMEOUT = None | 32 GLOBAL_TIMEOUT = None |
| 28 FETCH_TIMEOUT = None | 33 FETCH_TIMEOUT = None |
| 29 else: | 34 else: |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 251 super(SvnConfig, self).__init__() | 256 super(SvnConfig, self).__init__() |
| 252 self.svn_config_dir = svn_config_dir | 257 self.svn_config_dir = svn_config_dir |
| 253 self.default = not bool(self.svn_config_dir) | 258 self.default = not bool(self.svn_config_dir) |
| 254 if not self.svn_config_dir: | 259 if not self.svn_config_dir: |
| 255 if sys.platform == 'win32': | 260 if sys.platform == 'win32': |
| 256 self.svn_config_dir = os.path.join(os.environ['APPDATA'], 'Subversion') | 261 self.svn_config_dir = os.path.join(os.environ['APPDATA'], 'Subversion') |
| 257 else: | 262 else: |
| 258 self.svn_config_dir = os.path.expanduser( | 263 self.svn_config_dir = os.path.expanduser( |
| 259 os.path.join('~', '.subversion')) | 264 os.path.join('~', '.subversion')) |
| 260 svn_config_file = os.path.join(self.svn_config_dir, 'config') | 265 svn_config_file = os.path.join(self.svn_config_dir, 'config') |
| 261 parser = ConfigParser.SafeConfigParser() | 266 parser = configparser.SafeConfigParser() |
| 262 if os.path.isfile(svn_config_file): | 267 if os.path.isfile(svn_config_file): |
| 263 parser.read(svn_config_file) | 268 parser.read(svn_config_file) |
| 264 else: | 269 else: |
| 265 parser.add_section('auto-props') | 270 parser.add_section('auto-props') |
| 266 self.auto_props = dict(parser.items('auto-props')) | 271 self.auto_props = dict(parser.items('auto-props')) |
| 267 | 272 |
| 268 | 273 |
| 269 class SvnMixIn(object): | 274 class SvnMixIn(object): |
| 270 """MixIn class to add svn commands common to both svn and git-svn clients.""" | 275 """MixIn class to add svn commands common to both svn and git-svn clients.""" |
| 271 # These members need to be set by the subclass. | 276 # These members need to be set by the subclass. |
| (...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 830 def revisions(self, rev1, rev2): | 835 def revisions(self, rev1, rev2): |
| 831 return self.checkout.revisions(rev1, rev2) | 836 return self.checkout.revisions(rev1, rev2) |
| 832 | 837 |
| 833 @property | 838 @property |
| 834 def project_name(self): | 839 def project_name(self): |
| 835 return self.checkout.project_name | 840 return self.checkout.project_name |
| 836 | 841 |
| 837 @property | 842 @property |
| 838 def project_path(self): | 843 def project_path(self): |
| 839 return self.checkout.project_path | 844 return self.checkout.project_path |
| OLD | NEW |