Mercurial > kallithea
comparison rhodecode/lib/utils.py @ 3397:64c194492aad beta
--version command should be safe, and bare no modifications
- improved subprocess calls error detection
- fixed I/O read on closed file errors
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Mon, 25 Feb 2013 17:16:45 +0100 |
parents | e67b2ef07a8e |
children | 0ad025ee005e |
comparison
equal
deleted
inserted
replaced
3396:3faf7a7eebb3 | 3397:64c194492aad |
---|---|
746 """ | 746 """ |
747 from rhodecode import BACKENDS | 747 from rhodecode import BACKENDS |
748 from rhodecode.lib.vcs.backends.git.repository import GitRepository | 748 from rhodecode.lib.vcs.backends.git.repository import GitRepository |
749 from distutils.version import StrictVersion | 749 from distutils.version import StrictVersion |
750 | 750 |
751 stdout, stderr = GitRepository._run_git_command('--version') | 751 stdout, stderr = GitRepository._run_git_command('--version', _bare=True, |
752 _safe=True) | |
752 | 753 |
753 ver = (stdout.split(' ')[-1] or '').strip() or '0.0.0' | 754 ver = (stdout.split(' ')[-1] or '').strip() or '0.0.0' |
754 if len(ver.split('.')) > 3: | 755 if len(ver.split('.')) > 3: |
755 #StrictVersion needs to be only 3 element type | 756 #StrictVersion needs to be only 3 element type |
756 ver = '.'.join(ver.split('.')[:3]) | 757 ver = '.'.join(ver.split('.')[:3]) |