44# This module is part of GitPython and is released under
55# the BSD License: http://www.opensource.org/licenses/bsd-license.php
66
7- import os , sys
7+ import os
8+ import sys
89from util import (
9- LazyMixin ,
10- stream_copy
11- )
10+ LazyMixin ,
11+ stream_copy
12+ )
1213from exc import GitCommandError
1314
1415from subprocess import (
15- call ,
16- Popen ,
17- PIPE
18- )
16+ call ,
17+ Popen ,
18+ PIPE
19+ )
1920
2021execute_kwargs = ('istream' , 'with_keep_cwd' , 'with_extended_output' ,
2122 'with_exceptions' , 'as_process' ,
@@ -29,6 +30,7 @@ def dashify(string):
2930
3031
3132class Git (LazyMixin ):
33+
3234 """
3335 The Git class manages communication with the Git binary.
3436
@@ -246,7 +248,7 @@ def _set_cache_(self, attr):
246248 self ._version_info = tuple (int (n ) for n in version_numbers .split ('.' )[:4 ] if n .isdigit ())
247249 else :
248250 super (Git , self )._set_cache_ (attr )
249- #END handle version info
251+ # END handle version info
250252
251253 @property
252254 def working_dir (self ):
@@ -336,25 +338,25 @@ def execute(self, command,
336338
337339 # Allow the user to have the command executed in their working dir.
338340 if with_keep_cwd or self ._working_dir is None :
339- cwd = os .getcwd ()
341+ cwd = os .getcwd ()
340342 else :
341- cwd = self ._working_dir
343+ cwd = self ._working_dir
342344
343345 # Start the process
344346 env = os .environ .copy ()
345347 env ["LC_MESSAGES" ] = "C"
346348 proc = Popen (command ,
347- env = env ,
348- cwd = cwd ,
349- stdin = istream ,
350- stderr = PIPE ,
351- stdout = PIPE ,
352- # Prevent cmd prompt popups on windows by using a shell ... .
353- # See https://github.com/gitpython-developers/GitPython/pull/126
354- shell = sys .platform == 'win32' ,
355- close_fds = (os .name == 'posix' ), # unsupported on linux
356- ** subprocess_kwargs
357- )
349+ env = env ,
350+ cwd = cwd ,
351+ stdin = istream ,
352+ stderr = PIPE ,
353+ stdout = PIPE ,
354+ # Prevent cmd prompt popups on windows by using a shell ... .
355+ # See https://github.com/gitpython-developers/GitPython/pull/126
356+ shell = sys .platform == 'win32' ,
357+ close_fds = (os .name == 'posix' ), # unsupported on linux
358+ ** subprocess_kwargs
359+ )
358360 if as_process :
359361 return self .AutoInterrupt (proc , command )
360362
@@ -508,7 +510,7 @@ def make_call():
508510 call .extend ([dashify (method )])
509511 call .extend (args )
510512 return call
511- #END utility to recreate call after changes
513+ # END utility to recreate call after changes
512514
513515 if sys .platform == 'win32' :
514516 try :
@@ -518,7 +520,7 @@ def make_call():
518520 # did we switch to git.cmd already, or was it changed from default ? permanently fail
519521 if self .GIT_PYTHON_GIT_EXECUTABLE != self .git_exec_name :
520522 raise
521- #END handle overridden variable
523+ # END handle overridden variable
522524 type(self ).GIT_PYTHON_GIT_EXECUTABLE = self .git_exec_name_win
523525 call = [self .GIT_PYTHON_GIT_EXECUTABLE ] + list (args )
524526
@@ -529,14 +531,14 @@ def make_call():
529531 msg = "WARNING: Automatically switched to use git.cmd as git executable, which reduces performance by ~70%."
530532 msg += "Its recommended to put git.exe into the PATH or to set the %s environment variable to the executable's location" % self ._git_exec_env_var
531533 warnings .warn (msg )
532- #END print of warning
533- #END catch first failure
534+ # END print of warning
535+ # END catch first failure
534536 except WindowsError :
535537 raise WindowsError ("The system cannot find or execute the file at %r" % self .GIT_PYTHON_GIT_EXECUTABLE )
536- #END provide better error message
538+ # END provide better error message
537539 else :
538540 return self .execute (make_call (), ** _kwargs )
539- #END handle windows default installation
541+ # END handle windows default installation
540542
541543 def _parse_object_header (self , header_line ):
542544 """
0 commit comments