

import eventlet
from eventlet.green import subprocess

# Due to an eventlet issue subprocess is not being correctly patched
# on git module so it has to be done manually

git = eventlet.import_patched('git', ('subprocess', subprocess))
Repo = git.Repo

# git.refs is lazy loaded when there's a new commit, this needs to be
# patched as well.
eventlet.import_patched('git.refs')



from eventlet.green import subprocess
import eventlet.patcher as patcher

# Due to an eventlet issue subprocess is not being correctly patched
# on git.refs
patcher.inject('git.refs', None, ('subprocess', subprocess), )

# this has to be loaded after the inject.

import git  # noqa: E402

Repo = git.Repo

Make gitpython and eventlet work with eventlet 0.25.1
Make gitpython and eventlet work with eventlet 0.25.1

Version 0.25 is having a bad interaction with python git.
that is due to the way that eventlet unloads some modules now.
Changed to use the inject method that supports what we need intead
of the imported_patched that was having the problem

Change-Id: I79894d4f711c64f536593fffcb6959df97c38838
Closes-bug: #1845181

  
  
- import eventlet
  from eventlet.green import subprocess
+ import eventlet.patcher as patcher
  
  # Due to an eventlet issue subprocess is not being correctly patched
- # on git module so it has to be done manually
+ # on git.refs
+ patcher.inject('git.refs', None, ('subprocess', subprocess), )
  
- git = eventlet.import_patched('git', ('subprocess', subprocess))
+ # this has to be loaded after the inject.
+ 
+ import git  # noqa: E402
+ 
  Repo = git.Repo
  
- # git.refs is lazy loaded when there's a new commit, this needs to be
- # patched as well.
- eventlet.import_patched('git.refs')
- 
Make gitpython and eventlet work with eventlet 0.25.1
## Code Before:


import eventlet
from eventlet.green import subprocess

# Due to an eventlet issue subprocess is not being correctly patched
# on git module so it has to be done manually

git = eventlet.import_patched('git', ('subprocess', subprocess))
Repo = git.Repo

# git.refs is lazy loaded when there's a new commit, this needs to be
# patched as well.
eventlet.import_patched('git.refs')

## Instruction:
Make gitpython and eventlet work with eventlet 0.25.1
## Code After:


from eventlet.green import subprocess
import eventlet.patcher as patcher

# Due to an eventlet issue subprocess is not being correctly patched
# on git.refs
patcher.inject('git.refs', None, ('subprocess', subprocess), )

# this has to be loaded after the inject.

import git  # noqa: E402

Repo = git.Repo
