##// END OF EJS Templates
git executable is now configurable via .ini files
marcink -
r3376:e67b2ef0 beta
parent child Browse files
Show More
@@ -43,6 +43,8 b' pdebug = false'
43 43
44 44 #WAITRESS
45 45 threads = 5
46 #100GB
47 max_request_body_size = 107374182400
46 48 use = egg:waitress#main
47 49
48 50 host = 0.0.0.0
@@ -75,6 +77,9 b' commit_parse_limit = 25'
75 77 dashboard_items = 100
76 78 use_gravatar = true
77 79
80 # path to git executable
81 git_path = git
82
78 83 ## RSS feed options
79 84
80 85 rss_cut_off_limit = 256000
@@ -43,6 +43,8 b' pdebug = false'
43 43
44 44 #WAITRESS
45 45 threads = 5
46 #100GB
47 max_request_body_size = 107374182400
46 48 use = egg:waitress#main
47 49
48 50 host = 127.0.0.1
@@ -75,6 +77,9 b' commit_parse_limit = 50'
75 77 dashboard_items = 100
76 78 use_gravatar = true
77 79
80 # path to git executable
81 git_path = git
82
78 83 ## RSS feed options
79 84
80 85 rss_cut_off_limit = 256000
@@ -43,6 +43,8 b' pdebug = false'
43 43
44 44 #WAITRESS
45 45 threads = 5
46 #100GB
47 max_request_body_size = 107374182400
46 48 use = egg:waitress#main
47 49
48 50 host = 127.0.0.1
@@ -75,6 +77,9 b' commit_parse_limit = 50'
75 77 dashboard_items = 100
76 78 use_gravatar = true
77 79
80 # path to git executable
81 git_path = git
82
78 83 ## RSS feed options
79 84
80 85 rss_cut_off_limit = 256000
@@ -6,6 +6,7 b' import traceback'
6 6
7 7 from webob import Request, Response, exc
8 8
9 import rhodecode
9 10 from rhodecode.lib import subprocessio
10 11
11 12 log = logging.getLogger(__name__)
@@ -82,10 +83,11 b' class GitRepository(object):'
82 83 # if you do add '\n' as part of data, count it.
83 84 server_advert = '# service=%s' % git_command
84 85 packet_len = str(hex(len(server_advert) + 4)[2:].rjust(4, '0')).lower()
86 _git_path = rhodecode.CONFIG.get('git_path', 'git')
85 87 try:
86 88 out = subprocessio.SubprocessIOChunker(
87 r'git %s --stateless-rpc --advertise-refs "%s"' % (
88 git_command[4:], self.content_path),
89 r'%s %s --stateless-rpc --advertise-refs "%s"' % (
90 _git_path, git_command[4:], self.content_path),
89 91 starting_values=[
90 92 packet_len + server_advert + '0000'
91 93 ]
@@ -142,8 +144,9 b' class GitRepository(object):'
142 144 if git_command in [u'git-receive-pack']:
143 145 # updating refs manually after each push.
144 146 # Needed for pre-1.7.0.4 git clients using regular HTTP mode.
145 cmd = (u'git --git-dir "%s" '
146 'update-server-info' % self.content_path)
147 _git_path = rhodecode.CONFIG.get('git_path', 'git')
148 cmd = (u'%s --git-dir "%s" '
149 'update-server-info' % (_git_path, self.content_path))
147 150 log.debug('handling cmd %s' % cmd)
148 151 subprocess.call(cmd, shell=True)
149 152
@@ -744,13 +744,12 b' def check_git_version():'
744 744 Checks what version of git is installed in system, and issues a warning
745 745 if it's too old for RhodeCode to properly work.
746 746 """
747 import subprocess
747 from rhodecode import BACKENDS
748 from rhodecode.lib.vcs.backends.git.repository import GitRepository
748 749 from distutils.version import StrictVersion
749 from rhodecode import BACKENDS
750 750
751 p = subprocess.Popen('git --version', shell=True,
752 stdout=subprocess.PIPE, stderr=subprocess.PIPE)
753 stdout, stderr = p.communicate()
751 stdout, stderr = GitRepository._run_git_command('--version')
752
754 753 ver = (stdout.split(' ')[-1] or '').strip() or '0.0.0'
755 754 if len(ver.split('.')) > 3:
756 755 #StrictVersion needs to be only 3 element type
@@ -2,6 +2,7 b' import re'
2 2 from itertools import chain
3 3 from dulwich import objects
4 4 from subprocess import Popen, PIPE
5 import rhodecode
5 6 from rhodecode.lib.vcs.conf import settings
6 7 from rhodecode.lib.vcs.exceptions import RepositoryError
7 8 from rhodecode.lib.vcs.exceptions import ChangesetError
@@ -362,8 +363,9 b' class GitChangeset(BaseChangeset):'
362 363 frmt = 'zip'
363 364 else:
364 365 frmt = 'tar'
365 cmd = 'git archive --format=%s --prefix=%s/ %s' % (frmt, prefix,
366 self.raw_id)
366 _git_path = rhodecode.CONFIG.get('git_path', 'git')
367 cmd = '%s archive --format=%s --prefix=%s/ %s' % (_git_path,
368 frmt, prefix, self.raw_id)
367 369 if kind == 'tgz':
368 370 cmd += ' | gzip -9'
369 371 elif kind == 'tbz2':
@@ -20,7 +20,8 b' import urllib2'
20 20 from dulwich.repo import Repo, NotGitRepository
21 21 from dulwich.objects import Tag
22 22 from string import Template
23 from subprocess import Popen, PIPE
23
24 import rhodecode
24 25 from rhodecode.lib.vcs.backends.base import BaseRepository
25 26 from rhodecode.lib.vcs.exceptions import BranchDoesNotExistError
26 27 from rhodecode.lib.vcs.exceptions import ChangesetDoesNotExistError
@@ -91,17 +92,14 b' class GitRepository(BaseRepository):'
91 92 """
92 93 return self._get_all_revisions()
93 94
94 def run_git_command(self, cmd):
95 @classmethod
96 def _run_git_command(cls, cmd, **opts):
95 97 """
96 98 Runs given ``cmd`` as git command and returns tuple
97 (returncode, stdout, stderr).
98
99 .. note::
100 This method exists only until log/blame functionality is implemented
101 at Dulwich (see https://bugs.launchpad.net/bugs/645142). Parsing
102 os command's output is road to hell...
99 (stdout, stderr).
103 100
104 101 :param cmd: git command to be executed
102 :param opts: env options to pass into Subprocess command
105 103 """
106 104
107 105 _copts = ['-c', 'core.quotepath=false', ]
@@ -116,17 +114,17 b' class GitRepository(BaseRepository):'
116 114 del gitenv['GIT_DIR']
117 115 gitenv['GIT_CONFIG_NOGLOBAL'] = '1'
118 116
119 cmd = ['git'] + _copts + cmd
117 _git_path = rhodecode.CONFIG.get('git_path', 'git')
118 cmd = [_git_path] + _copts + cmd
120 119 if _str_cmd:
121 120 cmd = ' '.join(cmd)
122 121 try:
123 opts = dict(
122 _opts = dict(
124 123 env=gitenv,
125 124 shell=False,
126 125 )
127 if os.path.isdir(self.path):
128 opts['cwd'] = self.path
129 p = subprocessio.SubprocessIOChunker(cmd, **opts)
126 _opts.update(opts)
127 p = subprocessio.SubprocessIOChunker(cmd, **_opts)
130 128 except (EnvironmentError, OSError), err:
131 129 log.error(traceback.format_exc())
132 130 raise RepositoryError("Couldn't run git command (%s).\n"
@@ -134,6 +132,12 b' class GitRepository(BaseRepository):'
134 132
135 133 return ''.join(p.output), ''.join(p.error)
136 134
135 def run_git_command(self, cmd):
136 opts = {}
137 if os.path.isdir(self.path):
138 opts['cwd'] = self.path
139 return self._run_git_command(cmd, **opts)
140
137 141 @classmethod
138 142 def _check_url(cls, url):
139 143 """
General Comments 0
You need to be logged in to leave comments. Login now