11
11
from pip ._vendor .six .moves .urllib import parse as urllib_parse
12
12
from pip ._vendor .six .moves .urllib import request as urllib_request
13
13
14
- from pip ._internal .exceptions import BadCommand , InstallationError
14
+ from pip ._internal .exceptions import BadCommand , SubProcessError
15
15
from pip ._internal .utils .misc import display_path , hide_url
16
16
from pip ._internal .utils .subprocess import make_command
17
17
from pip ._internal .utils .temp_dir import TempDirectory
@@ -78,7 +78,7 @@ def is_immutable_rev_checkout(self, url, dest):
78
78
79
79
def get_git_version (self ):
80
80
VERSION_PFX = 'git version '
81
- version = self .run_command (['version' ], show_stdout = False )
81
+ version = self .run_command (['version' ])
82
82
if version .startswith (VERSION_PFX ):
83
83
version = version [len (VERSION_PFX ):].split ()[0 ]
84
84
else :
@@ -101,7 +101,7 @@ def get_current_branch(cls, location):
101
101
# and to suppress the message to stderr.
102
102
args = ['symbolic-ref' , '-q' , 'HEAD' ]
103
103
output = cls .run_command (
104
- args , extra_ok_returncodes = (1 , ), show_stdout = False , cwd = location ,
104
+ args , extra_ok_returncodes = (1 , ), cwd = location ,
105
105
)
106
106
ref = output .strip ()
107
107
@@ -120,7 +120,7 @@ def export(self, location, url):
120
120
self .unpack (temp_dir .path , url = url )
121
121
self .run_command (
122
122
['checkout-index' , '-a' , '-f' , '--prefix' , location ],
123
- show_stdout = False , cwd = temp_dir .path
123
+ cwd = temp_dir .path
124
124
)
125
125
126
126
@classmethod
@@ -135,7 +135,7 @@ def get_revision_sha(cls, dest, rev):
135
135
"""
136
136
# Pass rev to pre-filter the list.
137
137
output = cls .run_command (['show-ref' , rev ], cwd = dest ,
138
- show_stdout = False , on_returncode = 'ignore' )
138
+ on_returncode = 'ignore' )
139
139
refs = {}
140
140
for line in output .strip ().splitlines ():
141
141
try :
@@ -286,7 +286,7 @@ def get_remote_url(cls, location):
286
286
# exits with return code 1 if there are no matching lines.
287
287
stdout = cls .run_command (
288
288
['config' , '--get-regexp' , r'remote\..*\.url' ],
289
- extra_ok_returncodes = (1 , ), show_stdout = False , cwd = location ,
289
+ extra_ok_returncodes = (1 , ), cwd = location ,
290
290
)
291
291
remotes = stdout .splitlines ()
292
292
try :
@@ -306,7 +306,7 @@ def get_revision(cls, location, rev=None):
306
306
if rev is None :
307
307
rev = 'HEAD'
308
308
current_rev = cls .run_command (
309
- ['rev-parse' , rev ], show_stdout = False , cwd = location ,
309
+ ['rev-parse' , rev ], cwd = location ,
310
310
)
311
311
return current_rev .strip ()
312
312
@@ -319,7 +319,7 @@ def get_subdirectory(cls, location):
319
319
# find the repo root
320
320
git_dir = cls .run_command (
321
321
['rev-parse' , '--git-dir' ],
322
- show_stdout = False , cwd = location ).strip ()
322
+ cwd = location ).strip ()
323
323
if not os .path .isabs (git_dir ):
324
324
git_dir = os .path .join (location , git_dir )
325
325
repo_root = os .path .abspath (os .path .join (git_dir , '..' ))
@@ -378,15 +378,14 @@ def get_repository_root(cls, location):
378
378
r = cls .run_command (
379
379
['rev-parse' , '--show-toplevel' ],
380
380
cwd = location ,
381
- show_stdout = False ,
382
381
on_returncode = 'raise' ,
383
382
log_failed_cmd = False ,
384
383
)
385
384
except BadCommand :
386
385
logger .debug ("could not determine if %s is under git control "
387
386
"because git is not available" , location )
388
387
return None
389
- except InstallationError :
388
+ except SubProcessError :
390
389
return None
391
390
return os .path .normpath (r .rstrip ('\r \n ' ))
392
391
0 commit comments