##// END OF EJS Templates
Add git version detection to warn users that Git used in system is to old. ref #588...
marcink -
r2890:84414d73 beta
parent child Browse files
Show More
@@ -18,7 +18,7 from rhodecode.config.routing import mak
18 from rhodecode.lib import helpers
18 from rhodecode.lib import helpers
19 from rhodecode.lib.auth import set_available_permissions
19 from rhodecode.lib.auth import set_available_permissions
20 from rhodecode.lib.utils import repo2db_mapper, make_ui, set_rhodecode_config,\
20 from rhodecode.lib.utils import repo2db_mapper, make_ui, set_rhodecode_config,\
21 load_rcextensions
21 load_rcextensions, check_git_version
22 from rhodecode.lib.utils2 import engine_from_config, str2bool
22 from rhodecode.lib.utils2 import engine_from_config, str2bool
23 from rhodecode.model import init_model
23 from rhodecode.model import init_model
24 from rhodecode.model.scm import ScmModel
24 from rhodecode.model.scm import ScmModel
@@ -86,6 +86,9 def load_environment(global_conf, app_co
86 if not int(os.environ.get('RC_WHOOSH_TEST_DISABLE', 0)):
86 if not int(os.environ.get('RC_WHOOSH_TEST_DISABLE', 0)):
87 create_test_index(TESTS_TMP_PATH, config, True)
87 create_test_index(TESTS_TMP_PATH, config, True)
88
88
89 #check git version
90 check_git_version()
91
89 # MULTIPLE DB configs
92 # MULTIPLE DB configs
90 # Setup the SQLAlchemy database engine
93 # Setup the SQLAlchemy database engine
91 sa_engine_db1 = engine_from_config(config, 'sqlalchemy.db1.')
94 sa_engine_db1 = engine_from_config(config, 'sqlalchemy.db1.')
@@ -41,7 +41,7 from rhodecode.lib.auth import LoginRequ
41 from rhodecode.lib.base import BaseController, render
41 from rhodecode.lib.base import BaseController, render
42 from rhodecode.lib.celerylib import tasks, run_task
42 from rhodecode.lib.celerylib import tasks, run_task
43 from rhodecode.lib.utils import repo2db_mapper, invalidate_cache, \
43 from rhodecode.lib.utils import repo2db_mapper, invalidate_cache, \
44 set_rhodecode_config, repo_name_slug
44 set_rhodecode_config, repo_name_slug, check_git_version
45 from rhodecode.model.db import RhodeCodeUi, Repository, RepoGroup, \
45 from rhodecode.model.db import RhodeCodeUi, Repository, RepoGroup, \
46 RhodeCodeSetting, PullRequest, PullRequestReviewers
46 RhodeCodeSetting, PullRequest, PullRequestReviewers
47 from rhodecode.model.forms import UserForm, ApplicationSettingsForm, \
47 from rhodecode.model.forms import UserForm, ApplicationSettingsForm, \
@@ -68,7 +68,8 class SettingsController(BaseController)
68 c.admin_user = session.get('admin_user')
68 c.admin_user = session.get('admin_user')
69 c.admin_username = session.get('admin_username')
69 c.admin_username = session.get('admin_username')
70 c.modules = sorted([(p.project_name, p.version)
70 c.modules = sorted([(p.project_name, p.version)
71 for p in pkg_resources.working_set],
71 for p in pkg_resources.working_set]
72 + [('git', check_git_version())],
72 key=lambda k: k[0].lower())
73 key=lambda k: k[0].lower())
73 c.py_version = platform.python_version()
74 c.py_version = platform.python_version()
74 c.platform = platform.platform()
75 c.platform = platform.platform()
@@ -672,3 +672,38 class BasePasterCommand(Command):
672 self.path_to_ini_file = os.path.realpath(conf)
672 self.path_to_ini_file = os.path.realpath(conf)
673 conf = paste.deploy.appconfig('config:' + self.path_to_ini_file)
673 conf = paste.deploy.appconfig('config:' + self.path_to_ini_file)
674 pylonsconfig.init_app(conf.global_conf, conf.local_conf)
674 pylonsconfig.init_app(conf.global_conf, conf.local_conf)
675
676
677 def check_git_version():
678 """
679 Checks what version of git is installed in system, and issues a warning
680 if it's to old for RhodeCode to properly work.
681 """
682 import subprocess
683 from distutils.version import StrictVersion
684 from rhodecode import BACKENDS
685
686 p = subprocess.Popen('git --version', shell=True,
687 stdout=subprocess.PIPE, stderr=subprocess.PIPE)
688 stdout, stderr = p.communicate()
689 ver = (stdout.split(' ')[-1] or '').strip() or '0.0.0'
690 try:
691 _ver = StrictVersion(ver)
692 except:
693 _ver = StrictVersion('0.0.0')
694 stderr = traceback.format_exc()
695
696 req_ver = '1.7.4'
697 to_old_git = False
698 if _ver <= StrictVersion(req_ver):
699 to_old_git = True
700
701 if 'git' in BACKENDS:
702 log.debug('GIT version detected: %s' % stdout)
703 if stderr:
704 log.warning('Unable to detect git version org error was:%r' % stderr)
705 elif to_old_git:
706 log.warning('RhodeCode detected git version %s, which is to old '
707 'for the system to function properly make sure '
708 'it is at least in version %s' % (ver, req_ver))
709 return _ver No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now