зеркало из https://github.com/microsoft/git.git
remote-hg: fix for older versions of python
As Amit Bakshi reported, older versions of python (< 2.7) don't have subprocess.check_output, so let's use subprocess.Popen directly as suggested. Suggested-by: Amit Bakshi <ambakshi@gmail.com> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
418673c4bc
Коммит
1e310551e7
|
@ -56,6 +56,12 @@ def hgmode(mode):
|
||||||
m = { '0100755': 'x', '0120000': 'l' }
|
m = { '0100755': 'x', '0120000': 'l' }
|
||||||
return m.get(mode, '')
|
return m.get(mode, '')
|
||||||
|
|
||||||
|
def get_config(config):
|
||||||
|
cmd = ['git', 'config', '--get', config]
|
||||||
|
process = subprocess.Popen(cmd, stdout=subprocess.PIPE)
|
||||||
|
output, _ = process.communicate()
|
||||||
|
return output
|
||||||
|
|
||||||
class Marks:
|
class Marks:
|
||||||
|
|
||||||
def __init__(self, path):
|
def __init__(self, path):
|
||||||
|
@ -727,12 +733,10 @@ def main(args):
|
||||||
hg_git_compat = False
|
hg_git_compat = False
|
||||||
track_branches = True
|
track_branches = True
|
||||||
try:
|
try:
|
||||||
cmd = ['git', 'config', '--get', 'remote-hg.hg-git-compat']
|
if get_config('remote-hg.hg-git-compat') == 'true\n':
|
||||||
if subprocess.check_output(cmd) == 'true\n':
|
|
||||||
hg_git_compat = True
|
hg_git_compat = True
|
||||||
track_branches = False
|
track_branches = False
|
||||||
cmd = ['git', 'config', '--get', 'remote-hg.track-branches']
|
if get_config('remote-hg.track-branches') == 'false\n':
|
||||||
if subprocess.check_output(cmd) == 'false\n':
|
|
||||||
track_branches = False
|
track_branches = False
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
pass
|
pass
|
||||||
|
|
Загрузка…
Ссылка в новой задаче