##// END OF EJS Templates
git: exit early if Git is found but too old (Issue #342)...
Mads Kiilerich -
r7773:df275f70 default
parent child Browse files
Show More
@@ -29,6 +29,7 b' import datetime'
29 import logging
29 import logging
30 import os
30 import os
31 import re
31 import re
32 import sys
32 import traceback
33 import traceback
33 from distutils.version import StrictVersion
34 from distutils.version import StrictVersion
34
35
@@ -581,7 +582,7 b" git_req_ver = StrictVersion('1.7.4')"
581
582
582 def check_git_version():
583 def check_git_version():
583 """
584 """
584 Checks what version of git is installed in system, and issues a warning
585 Checks what version of git is installed on the system, and raise a system exit
585 if it's too old for Kallithea to work properly.
586 if it's too old for Kallithea to work properly.
586 """
587 """
587 from kallithea import BACKENDS
588 from kallithea import BACKENDS
@@ -591,6 +592,10 b' def check_git_version():'
591 if 'git' not in BACKENDS:
592 if 'git' not in BACKENDS:
592 return None
593 return None
593
594
595 if not settings.GIT_EXECUTABLE_PATH:
596 log.warning('No git executable configured - check "git_path" in the ini file.')
597 return None
598
594 stdout, stderr = GitRepository._run_git_command(['--version'], _bare=True,
599 stdout, stderr = GitRepository._run_git_command(['--version'], _bare=True,
595 _safe=True)
600 _safe=True)
596
601
@@ -603,10 +608,14 b' def check_git_version():'
603 log.debug('Git executable: "%s", version %s (parsed from: "%s")',
608 log.debug('Git executable: "%s", version %s (parsed from: "%s")',
604 settings.GIT_EXECUTABLE_PATH, ver, stdout.strip())
609 settings.GIT_EXECUTABLE_PATH, ver, stdout.strip())
605 if ver < git_req_ver:
610 if ver < git_req_ver:
606 log.warning('Kallithea detected %s version %s, which is too old '
611 log.error('Kallithea detected %s version %s, which is too old '
607 'for the system to function properly. '
612 'for the system to function properly. '
608 'Please upgrade to version %s or later.',
613 'Please upgrade to version %s or later. '
609 settings.GIT_EXECUTABLE_PATH, ver, git_req_ver)
614 'If you strictly need Mercurial repositories, you can '
615 'clear the "git_path" setting in the ini file.',
616 settings.GIT_EXECUTABLE_PATH, ver, git_req_ver)
617 log.error("Terminating ...")
618 sys.exit(1)
610 else:
619 else:
611 ver = StrictVersion('0.0.0')
620 ver = StrictVersion('0.0.0')
612 log.warning('Error finding version number in "%s --version" stdout: %r',
621 log.warning('Error finding version number in "%s --version" stdout: %r',
General Comments 0
You need to be logged in to leave comments. Login now