diff options
Diffstat (limited to 'git_config.py')
| -rw-r--r-- | git_config.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/git_config.py b/git_config.py index 56cc6a24..9524df9b 100644 --- a/git_config.py +++ b/git_config.py | |||
| @@ -14,8 +14,9 @@ | |||
| 14 | # limitations under the License. | 14 | # limitations under the License. |
| 15 | 15 | ||
| 16 | from __future__ import print_function | 16 | from __future__ import print_function |
| 17 | import cPickle | 17 | |
| 18 | import os | 18 | import os |
| 19 | import pickle | ||
| 19 | import re | 20 | import re |
| 20 | import subprocess | 21 | import subprocess |
| 21 | import sys | 22 | import sys |
| @@ -262,7 +263,7 @@ class GitConfig(object): | |||
| 262 | Trace(': unpickle %s', self.file) | 263 | Trace(': unpickle %s', self.file) |
| 263 | fd = open(self._pickle, 'rb') | 264 | fd = open(self._pickle, 'rb') |
| 264 | try: | 265 | try: |
| 265 | return cPickle.load(fd) | 266 | return pickle.load(fd) |
| 266 | finally: | 267 | finally: |
| 267 | fd.close() | 268 | fd.close() |
| 268 | except EOFError: | 269 | except EOFError: |
| @@ -271,7 +272,7 @@ class GitConfig(object): | |||
| 271 | except IOError: | 272 | except IOError: |
| 272 | os.remove(self._pickle) | 273 | os.remove(self._pickle) |
| 273 | return None | 274 | return None |
| 274 | except cPickle.PickleError: | 275 | except pickle.PickleError: |
| 275 | os.remove(self._pickle) | 276 | os.remove(self._pickle) |
| 276 | return None | 277 | return None |
| 277 | 278 | ||
| @@ -279,13 +280,13 @@ class GitConfig(object): | |||
| 279 | try: | 280 | try: |
| 280 | fd = open(self._pickle, 'wb') | 281 | fd = open(self._pickle, 'wb') |
| 281 | try: | 282 | try: |
| 282 | cPickle.dump(cache, fd, cPickle.HIGHEST_PROTOCOL) | 283 | pickle.dump(cache, fd, pickle.HIGHEST_PROTOCOL) |
| 283 | finally: | 284 | finally: |
| 284 | fd.close() | 285 | fd.close() |
| 285 | except IOError: | 286 | except IOError: |
| 286 | if os.path.exists(self._pickle): | 287 | if os.path.exists(self._pickle): |
| 287 | os.remove(self._pickle) | 288 | os.remove(self._pickle) |
| 288 | except cPickle.PickleError: | 289 | except pickle.PickleError: |
| 289 | if os.path.exists(self._pickle): | 290 | if os.path.exists(self._pickle): |
| 290 | os.remove(self._pickle) | 291 | os.remove(self._pickle) |
| 291 | 292 | ||
| @@ -537,8 +538,8 @@ class Remote(object): | |||
| 537 | self.url = self._Get('url') | 538 | self.url = self._Get('url') |
| 538 | self.review = self._Get('review') | 539 | self.review = self._Get('review') |
| 539 | self.projectname = self._Get('projectname') | 540 | self.projectname = self._Get('projectname') |
| 540 | self.fetch = map(RefSpec.FromString, | 541 | self.fetch = list(map(RefSpec.FromString, |
| 541 | self._Get('fetch', all_keys=True)) | 542 | self._Get('fetch', all_keys=True))) |
| 542 | self._review_url = None | 543 | self._review_url = None |
| 543 | 544 | ||
| 544 | def _InsteadOf(self): | 545 | def _InsteadOf(self): |
| @@ -657,7 +658,7 @@ class Remote(object): | |||
| 657 | self._Set('url', self.url) | 658 | self._Set('url', self.url) |
| 658 | self._Set('review', self.review) | 659 | self._Set('review', self.review) |
| 659 | self._Set('projectname', self.projectname) | 660 | self._Set('projectname', self.projectname) |
| 660 | self._Set('fetch', map(str, self.fetch)) | 661 | self._Set('fetch', list(map(str, self.fetch))) |
| 661 | 662 | ||
| 662 | def _Set(self, key, value): | 663 | def _Set(self, key, value): |
| 663 | key = 'remote.%s.%s' % (self.name, key) | 664 | key = 'remote.%s.%s' % (self.name, key) |
