Content-Length: 2414 | pFad | http://github.com/gitpython-developers/GitPython/pull/658.patch

thub.com From 0b6cde8de6d40715cf445cf1a5d77cd9befbf4d0 Mon Sep 17 00:00:00 2001 From: Erik Johnson Date: Thu, 10 Aug 2017 16:09:35 -0500 Subject: [PATCH] Fix GitError being raised in initial `import git` This catches any raise of one of the custom exceptions defined in `git.exc` during the imports in the dunder init, and raises an `ImportError` in those cases. --- git/__init__.py | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/git/__init__.py b/git/__init__.py index 8c31e3094..75247dbf8 100644 --- a/git/__init__.py +++ b/git/__init__.py @@ -35,23 +35,26 @@ def _init_externals(): #{ Imports -from git.config import GitConfigParser # @NoMove @IgnorePep8 -from git.objects import * # @NoMove @IgnorePep8 -from git.refs import * # @NoMove @IgnorePep8 -from git.diff import * # @NoMove @IgnorePep8 -from git.exc import * # @NoMove @IgnorePep8 -from git.db import * # @NoMove @IgnorePep8 -from git.cmd import Git # @NoMove @IgnorePep8 -from git.repo import Repo # @NoMove @IgnorePep8 -from git.remote import * # @NoMove @IgnorePep8 -from git.index import * # @NoMove @IgnorePep8 -from git.util import ( # @NoMove @IgnorePep8 - LockFile, - BlockingLockFile, - Stats, - Actor, - rmtree, -) +from git.exc import * # @NoMove @IgnorePep8 +try: + from git.config import GitConfigParser # @NoMove @IgnorePep8 + from git.objects import * # @NoMove @IgnorePep8 + from git.refs import * # @NoMove @IgnorePep8 + from git.diff import * # @NoMove @IgnorePep8 + from git.db import * # @NoMove @IgnorePep8 + from git.cmd import Git # @NoMove @IgnorePep8 + from git.repo import Repo # @NoMove @IgnorePep8 + from git.remote import * # @NoMove @IgnorePep8 + from git.index import * # @NoMove @IgnorePep8 + from git.util import ( # @NoMove @IgnorePep8 + LockFile, + BlockingLockFile, + Stats, + Actor, + rmtree, + ) +except GitError as exc: + raise ImportError('%s: %s' % (exc.__class__.__name__, exc)) #} END imports








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/gitpython-developers/GitPython/pull/658.patch

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy