diff --git a/rhodecode/config/environment.py b/rhodecode/config/environment.py --- a/rhodecode/config/environment.py +++ b/rhodecode/config/environment.py @@ -18,7 +18,7 @@ from rhodecode.config.routing import mak from rhodecode.lib import helpers from rhodecode.lib.auth import set_available_permissions from rhodecode.lib.utils import repo2db_mapper, make_ui, set_rhodecode_config,\ - load_rcextensions + load_rcextensions, check_git_version from rhodecode.lib.utils2 import engine_from_config, str2bool from rhodecode.model import init_model from rhodecode.model.scm import ScmModel @@ -86,6 +86,9 @@ def load_environment(global_conf, app_co if not int(os.environ.get('RC_WHOOSH_TEST_DISABLE', 0)): create_test_index(TESTS_TMP_PATH, config, True) + #check git version + check_git_version() + # MULTIPLE DB configs # Setup the SQLAlchemy database engine sa_engine_db1 = engine_from_config(config, 'sqlalchemy.db1.') diff --git a/rhodecode/controllers/admin/settings.py b/rhodecode/controllers/admin/settings.py --- a/rhodecode/controllers/admin/settings.py +++ b/rhodecode/controllers/admin/settings.py @@ -41,7 +41,7 @@ from rhodecode.lib.auth import LoginRequ from rhodecode.lib.base import BaseController, render from rhodecode.lib.celerylib import tasks, run_task from rhodecode.lib.utils import repo2db_mapper, invalidate_cache, \ - set_rhodecode_config, repo_name_slug + set_rhodecode_config, repo_name_slug, check_git_version from rhodecode.model.db import RhodeCodeUi, Repository, RepoGroup, \ RhodeCodeSetting, PullRequest, PullRequestReviewers from rhodecode.model.forms import UserForm, ApplicationSettingsForm, \ @@ -68,7 +68,8 @@ class SettingsController(BaseController) c.admin_user = session.get('admin_user') c.admin_username = session.get('admin_username') c.modules = sorted([(p.project_name, p.version) - for p in pkg_resources.working_set], + for p in pkg_resources.working_set] + + [('git', check_git_version())], key=lambda k: k[0].lower()) c.py_version = platform.python_version() c.platform = platform.platform() diff --git a/rhodecode/lib/utils.py b/rhodecode/lib/utils.py --- a/rhodecode/lib/utils.py +++ b/rhodecode/lib/utils.py @@ -672,3 +672,38 @@ class BasePasterCommand(Command): self.path_to_ini_file = os.path.realpath(conf) conf = paste.deploy.appconfig('config:' + self.path_to_ini_file) pylonsconfig.init_app(conf.global_conf, conf.local_conf) + + +def check_git_version(): + """ + Checks what version of git is installed in system, and issues a warning + if it's to old for RhodeCode to properly work. + """ + import subprocess + from distutils.version import StrictVersion + from rhodecode import BACKENDS + + p = subprocess.Popen('git --version', shell=True, + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout, stderr = p.communicate() + ver = (stdout.split(' ')[-1] or '').strip() or '0.0.0' + try: + _ver = StrictVersion(ver) + except: + _ver = StrictVersion('0.0.0') + stderr = traceback.format_exc() + + req_ver = '1.7.4' + to_old_git = False + if _ver <= StrictVersion(req_ver): + to_old_git = True + + if 'git' in BACKENDS: + log.debug('GIT version detected: %s' % stdout) + if stderr: + log.warning('Unable to detect git version org error was:%r' % stderr) + elif to_old_git: + log.warning('RhodeCode detected git version %s, which is to old ' + 'for the system to function properly make sure ' + 'it is at least in version %s' % (ver, req_ver)) + return _ver \ No newline at end of file