| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # coding: utf-8 | 2 # coding: utf-8 |
| 3 # | 3 # |
| 4 # Copyright 2007 Google Inc. | 4 # Copyright 2007 Google Inc. |
| 5 # | 5 # |
| 6 # Licensed under the Apache License, Version 2.0 (the "License"); | 6 # Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 # you may not use this file except in compliance with the License. | 7 # you may not use this file except in compliance with the License. |
| 8 # You may obtain a copy of the License at | 8 # You may obtain a copy of the License at |
| 9 # | 9 # |
| 10 # http://www.apache.org/licenses/LICENSE-2.0 | 10 # http://www.apache.org/licenses/LICENSE-2.0 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 CVS | 29 CVS |
| 30 | 30 |
| 31 It is important for Git/Mercurial users to specify a tree/node/branch to diff | 31 It is important for Git/Mercurial users to specify a tree/node/branch to diff |
| 32 against by using the '--rev' option. | 32 against by using the '--rev' option. |
| 33 """ | 33 """ |
| 34 # This code is derived from appcfg.py in the App Engine SDK (open source), | 34 # This code is derived from appcfg.py in the App Engine SDK (open source), |
| 35 # and from ASPN recipe #146306. | 35 # and from ASPN recipe #146306. |
| 36 | 36 |
| 37 from __future__ import print_function | 37 from __future__ import print_function |
| 38 | 38 |
| 39 import ConfigParser | |
| 40 import cookielib | 39 import cookielib |
| 41 import errno | 40 import errno |
| 42 import fnmatch | 41 import fnmatch |
| 43 import getpass | 42 import getpass |
| 44 import logging | 43 import logging |
| 45 import marshal | 44 import marshal |
| 46 import mimetypes | 45 import mimetypes |
| 47 import optparse | 46 import optparse |
| 48 import os | 47 import os |
| 49 import re | 48 import re |
| 50 import socket | 49 import socket |
| 51 import subprocess | 50 import subprocess |
| 52 import sys | 51 import sys |
| 53 import urllib | 52 import urllib |
| 54 import urllib2 | 53 import urllib2 |
| 55 import urlparse | 54 import urlparse |
| 56 | 55 |
| 57 from multiprocessing.pool import ThreadPool | 56 from multiprocessing.pool import ThreadPool |
| 58 | 57 |
| 58 # The configparser module was renamed in Python 3. |
| 59 try: |
| 60 import configparser |
| 61 except ImportError: |
| 62 import ConfigParser as configparser |
| 63 |
| 59 # The md5 module was deprecated in Python 2.5. | 64 # The md5 module was deprecated in Python 2.5. |
| 60 try: | 65 try: |
| 61 from hashlib import md5 | 66 from hashlib import md5 |
| 62 except ImportError: | 67 except ImportError: |
| 63 from md5 import md5 | 68 from md5 import md5 |
| 64 | 69 |
| 65 try: | 70 try: |
| 66 import readline | 71 import readline |
| 67 except ImportError: | 72 except ImportError: |
| 68 pass | 73 pass |
| (...skipping 2165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2234 In following cases, returns empty dictionary: | 2239 In following cases, returns empty dictionary: |
| 2235 - config file doesn't exist, or | 2240 - config file doesn't exist, or |
| 2236 - 'enable-auto-props' is not set to 'true-like-value' in [miscellany]. | 2241 - 'enable-auto-props' is not set to 'true-like-value' in [miscellany]. |
| 2237 """ | 2242 """ |
| 2238 if os.name == 'nt': | 2243 if os.name == 'nt': |
| 2239 subversion_config = os.environ.get("APPDATA") + "\\Subversion\\config" | 2244 subversion_config = os.environ.get("APPDATA") + "\\Subversion\\config" |
| 2240 else: | 2245 else: |
| 2241 subversion_config = os.path.expanduser("~/.subversion/config") | 2246 subversion_config = os.path.expanduser("~/.subversion/config") |
| 2242 if not os.path.exists(subversion_config): | 2247 if not os.path.exists(subversion_config): |
| 2243 return {} | 2248 return {} |
| 2244 config = ConfigParser.ConfigParser() | 2249 config = configparser.ConfigParser() |
| 2245 config.read(subversion_config) | 2250 config.read(subversion_config) |
| 2246 if (config.has_section("miscellany") and | 2251 if (config.has_section("miscellany") and |
| 2247 config.has_option("miscellany", "enable-auto-props") and | 2252 config.has_option("miscellany", "enable-auto-props") and |
| 2248 config.getboolean("miscellany", "enable-auto-props") and | 2253 config.getboolean("miscellany", "enable-auto-props") and |
| 2249 config.has_section("auto-props")): | 2254 config.has_section("auto-props")): |
| 2250 props = {} | 2255 props = {} |
| 2251 for file_pattern in config.options("auto-props"): | 2256 for file_pattern in config.options("auto-props"): |
| 2252 props[file_pattern] = ParseSubversionPropertyValues( | 2257 props[file_pattern] = ParseSubversionPropertyValues( |
| 2253 config.get("auto-props", file_pattern)) | 2258 config.get("auto-props", file_pattern)) |
| 2254 return props | 2259 return props |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2546 print | 2551 print |
| 2547 StatusUpdate("Interrupted.") | 2552 StatusUpdate("Interrupted.") |
| 2548 sys.exit(1) | 2553 sys.exit(1) |
| 2549 except auth.AuthenticationError as e: | 2554 except auth.AuthenticationError as e: |
| 2550 print(e, file=sys.stderr) | 2555 print(e, file=sys.stderr) |
| 2551 sys.exit(1) | 2556 sys.exit(1) |
| 2552 | 2557 |
| 2553 | 2558 |
| 2554 if __name__ == "__main__": | 2559 if __name__ == "__main__": |
| 2555 main() | 2560 main() |
| OLD | NEW |