##// END OF EJS Templates
Fixed issue with mixed locking notification and bad username
marcink -
r2750:30cafecb beta
parent child Browse files
Show More
@@ -1,377 +1,378 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """
2 """
3 rhodecode.lib.hooks
3 rhodecode.lib.hooks
4 ~~~~~~~~~~~~~~~~~~~
4 ~~~~~~~~~~~~~~~~~~~
5
5
6 Hooks runned by rhodecode
6 Hooks runned by rhodecode
7
7
8 :created_on: Aug 6, 2010
8 :created_on: Aug 6, 2010
9 :author: marcink
9 :author: marcink
10 :copyright: (C) 2010-2012 Marcin Kuzminski <marcin@python-works.com>
10 :copyright: (C) 2010-2012 Marcin Kuzminski <marcin@python-works.com>
11 :license: GPLv3, see COPYING for more details.
11 :license: GPLv3, see COPYING for more details.
12 """
12 """
13 # This program is free software: you can redistribute it and/or modify
13 # This program is free software: you can redistribute it and/or modify
14 # it under the terms of the GNU General Public License as published by
14 # it under the terms of the GNU General Public License as published by
15 # the Free Software Foundation, either version 3 of the License, or
15 # the Free Software Foundation, either version 3 of the License, or
16 # (at your option) any later version.
16 # (at your option) any later version.
17 #
17 #
18 # This program is distributed in the hope that it will be useful,
18 # This program is distributed in the hope that it will be useful,
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 # GNU General Public License for more details.
21 # GNU General Public License for more details.
22 #
22 #
23 # You should have received a copy of the GNU General Public License
23 # You should have received a copy of the GNU General Public License
24 # along with this program. If not, see <http://www.gnu.org/licenses/>.
24 # along with this program. If not, see <http://www.gnu.org/licenses/>.
25 import os
25 import os
26 import sys
26 import sys
27 import binascii
27 import binascii
28 from inspect import isfunction
28 from inspect import isfunction
29
29
30 from mercurial.scmutil import revrange
30 from mercurial.scmutil import revrange
31 from mercurial.node import nullrev
31 from mercurial.node import nullrev
32
32
33 from rhodecode.lib import helpers as h
33 from rhodecode.lib import helpers as h
34 from rhodecode.lib.utils import action_logger
34 from rhodecode.lib.utils import action_logger
35 from rhodecode.lib.vcs.backends.base import EmptyChangeset
35 from rhodecode.lib.vcs.backends.base import EmptyChangeset
36 from rhodecode.lib.compat import json
36 from rhodecode.lib.compat import json
37 from rhodecode.model.db import Repository, User
37 from rhodecode.model.db import Repository, User
38 from rhodecode.lib.utils2 import safe_str
38 from rhodecode.lib.utils2 import safe_str
39 from rhodecode.lib.exceptions import HTTPLockedRC
39 from rhodecode.lib.exceptions import HTTPLockedRC
40
40
41
41
42 def _get_scm_size(alias, root_path):
42 def _get_scm_size(alias, root_path):
43
43
44 if not alias.startswith('.'):
44 if not alias.startswith('.'):
45 alias += '.'
45 alias += '.'
46
46
47 size_scm, size_root = 0, 0
47 size_scm, size_root = 0, 0
48 for path, dirs, files in os.walk(root_path):
48 for path, dirs, files in os.walk(root_path):
49 if path.find(alias) != -1:
49 if path.find(alias) != -1:
50 for f in files:
50 for f in files:
51 try:
51 try:
52 size_scm += os.path.getsize(os.path.join(path, f))
52 size_scm += os.path.getsize(os.path.join(path, f))
53 except OSError:
53 except OSError:
54 pass
54 pass
55 else:
55 else:
56 for f in files:
56 for f in files:
57 try:
57 try:
58 size_root += os.path.getsize(os.path.join(path, f))
58 size_root += os.path.getsize(os.path.join(path, f))
59 except OSError:
59 except OSError:
60 pass
60 pass
61
61
62 size_scm_f = h.format_byte_size(size_scm)
62 size_scm_f = h.format_byte_size(size_scm)
63 size_root_f = h.format_byte_size(size_root)
63 size_root_f = h.format_byte_size(size_root)
64 size_total_f = h.format_byte_size(size_root + size_scm)
64 size_total_f = h.format_byte_size(size_root + size_scm)
65
65
66 return size_scm_f, size_root_f, size_total_f
66 return size_scm_f, size_root_f, size_total_f
67
67
68
68
69 def repo_size(ui, repo, hooktype=None, **kwargs):
69 def repo_size(ui, repo, hooktype=None, **kwargs):
70 """
70 """
71 Presents size of repository after push
71 Presents size of repository after push
72
72
73 :param ui:
73 :param ui:
74 :param repo:
74 :param repo:
75 :param hooktype:
75 :param hooktype:
76 """
76 """
77
77
78 size_hg_f, size_root_f, size_total_f = _get_scm_size('.hg', repo.root)
78 size_hg_f, size_root_f, size_total_f = _get_scm_size('.hg', repo.root)
79
79
80 last_cs = repo[len(repo) - 1]
80 last_cs = repo[len(repo) - 1]
81
81
82 msg = ('Repository size .hg:%s repo:%s total:%s\n'
82 msg = ('Repository size .hg:%s repo:%s total:%s\n'
83 'Last revision is now r%s:%s\n') % (
83 'Last revision is now r%s:%s\n') % (
84 size_hg_f, size_root_f, size_total_f, last_cs.rev(), last_cs.hex()[:12]
84 size_hg_f, size_root_f, size_total_f, last_cs.rev(), last_cs.hex()[:12]
85 )
85 )
86
86
87 sys.stdout.write(msg)
87 sys.stdout.write(msg)
88
88
89
89
90 def pre_push(ui, repo, **kwargs):
90 def pre_push(ui, repo, **kwargs):
91 # pre push function, currently used to ban pushing when
91 # pre push function, currently used to ban pushing when
92 # repository is locked
92 # repository is locked
93 try:
93 try:
94 rc_extras = json.loads(os.environ.get('RC_SCM_DATA', "{}"))
94 rc_extras = json.loads(os.environ.get('RC_SCM_DATA', "{}"))
95 except:
95 except:
96 rc_extras = {}
96 rc_extras = {}
97 extras = dict(repo.ui.configitems('rhodecode_extras'))
97 extras = dict(repo.ui.configitems('rhodecode_extras'))
98
98
99 if 'username' in extras:
99 if 'username' in extras:
100 username = extras['username']
100 username = extras['username']
101 repository = extras['repository']
101 repository = extras['repository']
102 scm = extras['scm']
102 scm = extras['scm']
103 locked_by = extras['locked_by']
103 locked_by = extras['locked_by']
104 elif 'username' in rc_extras:
104 elif 'username' in rc_extras:
105 username = rc_extras['username']
105 username = rc_extras['username']
106 repository = rc_extras['repository']
106 repository = rc_extras['repository']
107 scm = rc_extras['scm']
107 scm = rc_extras['scm']
108 locked_by = rc_extras['locked_by']
108 locked_by = rc_extras['locked_by']
109 else:
109 else:
110 raise Exception('Missing data in repo.ui and os.environ')
110 raise Exception('Missing data in repo.ui and os.environ')
111
111
112 usr = User.get_by_username(username)
112 usr = User.get_by_username(username)
113
114 if locked_by[0] and usr.user_id != int(locked_by[0]):
113 if locked_by[0] and usr.user_id != int(locked_by[0]):
115 raise HTTPLockedRC(username, repository)
114 locked_by = User.get(locked_by[0]).username
115 raise HTTPLockedRC(repository, locked_by)
116
116
117
117
118 def pre_pull(ui, repo, **kwargs):
118 def pre_pull(ui, repo, **kwargs):
119 # pre push function, currently used to ban pushing when
119 # pre push function, currently used to ban pushing when
120 # repository is locked
120 # repository is locked
121 try:
121 try:
122 rc_extras = json.loads(os.environ.get('RC_SCM_DATA', "{}"))
122 rc_extras = json.loads(os.environ.get('RC_SCM_DATA', "{}"))
123 except:
123 except:
124 rc_extras = {}
124 rc_extras = {}
125 extras = dict(repo.ui.configitems('rhodecode_extras'))
125 extras = dict(repo.ui.configitems('rhodecode_extras'))
126 if 'username' in extras:
126 if 'username' in extras:
127 username = extras['username']
127 username = extras['username']
128 repository = extras['repository']
128 repository = extras['repository']
129 scm = extras['scm']
129 scm = extras['scm']
130 locked_by = extras['locked_by']
130 locked_by = extras['locked_by']
131 elif 'username' in rc_extras:
131 elif 'username' in rc_extras:
132 username = rc_extras['username']
132 username = rc_extras['username']
133 repository = rc_extras['repository']
133 repository = rc_extras['repository']
134 scm = rc_extras['scm']
134 scm = rc_extras['scm']
135 locked_by = rc_extras['locked_by']
135 locked_by = rc_extras['locked_by']
136 else:
136 else:
137 raise Exception('Missing data in repo.ui and os.environ')
137 raise Exception('Missing data in repo.ui and os.environ')
138
138
139 if locked_by[0]:
139 if locked_by[0]:
140 raise HTTPLockedRC(username, repository)
140 locked_by = User.get(locked_by[0]).username
141 raise HTTPLockedRC(repository, locked_by)
141
142
142
143
143 def log_pull_action(ui, repo, **kwargs):
144 def log_pull_action(ui, repo, **kwargs):
144 """
145 """
145 Logs user last pull action
146 Logs user last pull action
146
147
147 :param ui:
148 :param ui:
148 :param repo:
149 :param repo:
149 """
150 """
150 try:
151 try:
151 rc_extras = json.loads(os.environ.get('RC_SCM_DATA', "{}"))
152 rc_extras = json.loads(os.environ.get('RC_SCM_DATA', "{}"))
152 except:
153 except:
153 rc_extras = {}
154 rc_extras = {}
154 extras = dict(repo.ui.configitems('rhodecode_extras'))
155 extras = dict(repo.ui.configitems('rhodecode_extras'))
155 if 'username' in extras:
156 if 'username' in extras:
156 username = extras['username']
157 username = extras['username']
157 repository = extras['repository']
158 repository = extras['repository']
158 scm = extras['scm']
159 scm = extras['scm']
159 make_lock = extras['make_lock']
160 make_lock = extras['make_lock']
160 elif 'username' in rc_extras:
161 elif 'username' in rc_extras:
161 username = rc_extras['username']
162 username = rc_extras['username']
162 repository = rc_extras['repository']
163 repository = rc_extras['repository']
163 scm = rc_extras['scm']
164 scm = rc_extras['scm']
164 make_lock = rc_extras['make_lock']
165 make_lock = rc_extras['make_lock']
165 else:
166 else:
166 raise Exception('Missing data in repo.ui and os.environ')
167 raise Exception('Missing data in repo.ui and os.environ')
167 user = User.get_by_username(username)
168 user = User.get_by_username(username)
168 action = 'pull'
169 action = 'pull'
169 action_logger(user, action, repository, extras['ip'], commit=True)
170 action_logger(user, action, repository, extras['ip'], commit=True)
170 # extension hook call
171 # extension hook call
171 from rhodecode import EXTENSIONS
172 from rhodecode import EXTENSIONS
172 callback = getattr(EXTENSIONS, 'PULL_HOOK', None)
173 callback = getattr(EXTENSIONS, 'PULL_HOOK', None)
173
174
174 if isfunction(callback):
175 if isfunction(callback):
175 kw = {}
176 kw = {}
176 kw.update(extras)
177 kw.update(extras)
177 callback(**kw)
178 callback(**kw)
178
179
179 if make_lock is True:
180 if make_lock is True:
180 Repository.lock(Repository.get_by_repo_name(repository), user.user_id)
181 Repository.lock(Repository.get_by_repo_name(repository), user.user_id)
181 #msg = 'Made lock on repo `%s`' % repository
182 #msg = 'Made lock on repo `%s`' % repository
182 #sys.stdout.write(msg)
183 #sys.stdout.write(msg)
183
184
184 return 0
185 return 0
185
186
186
187
187 def log_push_action(ui, repo, **kwargs):
188 def log_push_action(ui, repo, **kwargs):
188 """
189 """
189 Maps user last push action to new changeset id, from mercurial
190 Maps user last push action to new changeset id, from mercurial
190
191
191 :param ui:
192 :param ui:
192 :param repo: repo object containing the `ui` object
193 :param repo: repo object containing the `ui` object
193 """
194 """
194
195
195 try:
196 try:
196 rc_extras = json.loads(os.environ.get('RC_SCM_DATA', "{}"))
197 rc_extras = json.loads(os.environ.get('RC_SCM_DATA', "{}"))
197 except:
198 except:
198 rc_extras = {}
199 rc_extras = {}
199
200
200 extras = dict(repo.ui.configitems('rhodecode_extras'))
201 extras = dict(repo.ui.configitems('rhodecode_extras'))
201 if 'username' in extras:
202 if 'username' in extras:
202 username = extras['username']
203 username = extras['username']
203 repository = extras['repository']
204 repository = extras['repository']
204 scm = extras['scm']
205 scm = extras['scm']
205 make_lock = extras['make_lock']
206 make_lock = extras['make_lock']
206 elif 'username' in rc_extras:
207 elif 'username' in rc_extras:
207 username = rc_extras['username']
208 username = rc_extras['username']
208 repository = rc_extras['repository']
209 repository = rc_extras['repository']
209 scm = rc_extras['scm']
210 scm = rc_extras['scm']
210 make_lock = rc_extras['make_lock']
211 make_lock = rc_extras['make_lock']
211 else:
212 else:
212 raise Exception('Missing data in repo.ui and os.environ')
213 raise Exception('Missing data in repo.ui and os.environ')
213
214
214 action = 'push' + ':%s'
215 action = 'push' + ':%s'
215
216
216 if scm == 'hg':
217 if scm == 'hg':
217 node = kwargs['node']
218 node = kwargs['node']
218
219
219 def get_revs(repo, rev_opt):
220 def get_revs(repo, rev_opt):
220 if rev_opt:
221 if rev_opt:
221 revs = revrange(repo, rev_opt)
222 revs = revrange(repo, rev_opt)
222
223
223 if len(revs) == 0:
224 if len(revs) == 0:
224 return (nullrev, nullrev)
225 return (nullrev, nullrev)
225 return (max(revs), min(revs))
226 return (max(revs), min(revs))
226 else:
227 else:
227 return (len(repo) - 1, 0)
228 return (len(repo) - 1, 0)
228
229
229 stop, start = get_revs(repo, [node + ':'])
230 stop, start = get_revs(repo, [node + ':'])
230 h = binascii.hexlify
231 h = binascii.hexlify
231 revs = [h(repo[r].node()) for r in xrange(start, stop + 1)]
232 revs = [h(repo[r].node()) for r in xrange(start, stop + 1)]
232 elif scm == 'git':
233 elif scm == 'git':
233 revs = kwargs.get('_git_revs', [])
234 revs = kwargs.get('_git_revs', [])
234 if '_git_revs' in kwargs:
235 if '_git_revs' in kwargs:
235 kwargs.pop('_git_revs')
236 kwargs.pop('_git_revs')
236
237
237 action = action % ','.join(revs)
238 action = action % ','.join(revs)
238
239
239 action_logger(username, action, repository, extras['ip'], commit=True)
240 action_logger(username, action, repository, extras['ip'], commit=True)
240
241
241 # extension hook call
242 # extension hook call
242 from rhodecode import EXTENSIONS
243 from rhodecode import EXTENSIONS
243 callback = getattr(EXTENSIONS, 'PUSH_HOOK', None)
244 callback = getattr(EXTENSIONS, 'PUSH_HOOK', None)
244 if isfunction(callback):
245 if isfunction(callback):
245 kw = {'pushed_revs': revs}
246 kw = {'pushed_revs': revs}
246 kw.update(extras)
247 kw.update(extras)
247 callback(**kw)
248 callback(**kw)
248
249
249 if make_lock is False:
250 if make_lock is False:
250 Repository.unlock(Repository.get_by_repo_name(repository))
251 Repository.unlock(Repository.get_by_repo_name(repository))
251 msg = 'Released lock on repo `%s`\n' % repository
252 msg = 'Released lock on repo `%s`\n' % repository
252 sys.stdout.write(msg)
253 sys.stdout.write(msg)
253
254
254 return 0
255 return 0
255
256
256
257
257 def log_create_repository(repository_dict, created_by, **kwargs):
258 def log_create_repository(repository_dict, created_by, **kwargs):
258 """
259 """
259 Post create repository Hook. This is a dummy function for admins to re-use
260 Post create repository Hook. This is a dummy function for admins to re-use
260 if needed. It's taken from rhodecode-extensions module and executed
261 if needed. It's taken from rhodecode-extensions module and executed
261 if present
262 if present
262
263
263 :param repository: dict dump of repository object
264 :param repository: dict dump of repository object
264 :param created_by: username who created repository
265 :param created_by: username who created repository
265 :param created_date: date of creation
266 :param created_date: date of creation
266
267
267 available keys of repository_dict:
268 available keys of repository_dict:
268
269
269 'repo_type',
270 'repo_type',
270 'description',
271 'description',
271 'private',
272 'private',
272 'created_on',
273 'created_on',
273 'enable_downloads',
274 'enable_downloads',
274 'repo_id',
275 'repo_id',
275 'user_id',
276 'user_id',
276 'enable_statistics',
277 'enable_statistics',
277 'clone_uri',
278 'clone_uri',
278 'fork_id',
279 'fork_id',
279 'group_id',
280 'group_id',
280 'repo_name'
281 'repo_name'
281
282
282 """
283 """
283 from rhodecode import EXTENSIONS
284 from rhodecode import EXTENSIONS
284 callback = getattr(EXTENSIONS, 'CREATE_REPO_HOOK', None)
285 callback = getattr(EXTENSIONS, 'CREATE_REPO_HOOK', None)
285 if isfunction(callback):
286 if isfunction(callback):
286 kw = {}
287 kw = {}
287 kw.update(repository_dict)
288 kw.update(repository_dict)
288 kw.update({'created_by': created_by})
289 kw.update({'created_by': created_by})
289 kw.update(kwargs)
290 kw.update(kwargs)
290 return callback(**kw)
291 return callback(**kw)
291
292
292 return 0
293 return 0
293
294
294 handle_git_pre_receive = (lambda repo_path, revs, env:
295 handle_git_pre_receive = (lambda repo_path, revs, env:
295 handle_git_receive(repo_path, revs, env, hook_type='pre'))
296 handle_git_receive(repo_path, revs, env, hook_type='pre'))
296 handle_git_post_receive = (lambda repo_path, revs, env:
297 handle_git_post_receive = (lambda repo_path, revs, env:
297 handle_git_receive(repo_path, revs, env, hook_type='post'))
298 handle_git_receive(repo_path, revs, env, hook_type='post'))
298
299
299
300
300 def handle_git_receive(repo_path, revs, env, hook_type='post'):
301 def handle_git_receive(repo_path, revs, env, hook_type='post'):
301 """
302 """
302 A really hacky method that is runned by git post-receive hook and logs
303 A really hacky method that is runned by git post-receive hook and logs
303 an push action together with pushed revisions. It's executed by subprocess
304 an push action together with pushed revisions. It's executed by subprocess
304 thus needs all info to be able to create a on the fly pylons enviroment,
305 thus needs all info to be able to create a on the fly pylons enviroment,
305 connect to database and run the logging code. Hacky as sh*t but works.
306 connect to database and run the logging code. Hacky as sh*t but works.
306
307
307 :param repo_path:
308 :param repo_path:
308 :type repo_path:
309 :type repo_path:
309 :param revs:
310 :param revs:
310 :type revs:
311 :type revs:
311 :param env:
312 :param env:
312 :type env:
313 :type env:
313 """
314 """
314 from paste.deploy import appconfig
315 from paste.deploy import appconfig
315 from sqlalchemy import engine_from_config
316 from sqlalchemy import engine_from_config
316 from rhodecode.config.environment import load_environment
317 from rhodecode.config.environment import load_environment
317 from rhodecode.model import init_model
318 from rhodecode.model import init_model
318 from rhodecode.model.db import RhodeCodeUi
319 from rhodecode.model.db import RhodeCodeUi
319 from rhodecode.lib.utils import make_ui
320 from rhodecode.lib.utils import make_ui
320
321
321 path, ini_name = os.path.split(env['RHODECODE_CONFIG_FILE'])
322 path, ini_name = os.path.split(env['RHODECODE_CONFIG_FILE'])
322 conf = appconfig('config:%s' % ini_name, relative_to=path)
323 conf = appconfig('config:%s' % ini_name, relative_to=path)
323 load_environment(conf.global_conf, conf.local_conf)
324 load_environment(conf.global_conf, conf.local_conf)
324
325
325 engine = engine_from_config(conf, 'sqlalchemy.db1.')
326 engine = engine_from_config(conf, 'sqlalchemy.db1.')
326 init_model(engine)
327 init_model(engine)
327
328
328 baseui = make_ui('db')
329 baseui = make_ui('db')
329 # fix if it's not a bare repo
330 # fix if it's not a bare repo
330 if repo_path.endswith('.git'):
331 if repo_path.endswith('.git'):
331 repo_path = repo_path[:-4]
332 repo_path = repo_path[:-4]
332 repo = Repository.get_by_full_path(repo_path)
333 repo = Repository.get_by_full_path(repo_path)
333 _hooks = dict(baseui.configitems('hooks')) or {}
334 _hooks = dict(baseui.configitems('hooks')) or {}
334
335
335 extras = json.loads(env['RHODECODE_EXTRAS'])
336 extras = json.loads(env['RHODECODE_EXTRAS'])
336 for k, v in extras.items():
337 for k, v in extras.items():
337 baseui.setconfig('rhodecode_extras', k, v)
338 baseui.setconfig('rhodecode_extras', k, v)
338 repo = repo.scm_instance
339 repo = repo.scm_instance
339 repo.ui = baseui
340 repo.ui = baseui
340
341
341 if hook_type == 'pre':
342 if hook_type == 'pre':
342 pre_push(baseui, repo)
343 pre_push(baseui, repo)
343
344
344 # if push hook is enabled via web interface
345 # if push hook is enabled via web interface
345 elif hook_type == 'post' and _hooks.get(RhodeCodeUi.HOOK_PUSH):
346 elif hook_type == 'post' and _hooks.get(RhodeCodeUi.HOOK_PUSH):
346
347
347 rev_data = []
348 rev_data = []
348 for l in revs:
349 for l in revs:
349 old_rev, new_rev, ref = l.split(' ')
350 old_rev, new_rev, ref = l.split(' ')
350 _ref_data = ref.split('/')
351 _ref_data = ref.split('/')
351 if _ref_data[1] in ['tags', 'heads']:
352 if _ref_data[1] in ['tags', 'heads']:
352 rev_data.append({'old_rev': old_rev,
353 rev_data.append({'old_rev': old_rev,
353 'new_rev': new_rev,
354 'new_rev': new_rev,
354 'ref': ref,
355 'ref': ref,
355 'type': _ref_data[1],
356 'type': _ref_data[1],
356 'name': _ref_data[2].strip()})
357 'name': _ref_data[2].strip()})
357
358
358 git_revs = []
359 git_revs = []
359 for push_ref in rev_data:
360 for push_ref in rev_data:
360 _type = push_ref['type']
361 _type = push_ref['type']
361 if _type == 'heads':
362 if _type == 'heads':
362 if push_ref['old_rev'] == EmptyChangeset().raw_id:
363 if push_ref['old_rev'] == EmptyChangeset().raw_id:
363 cmd = "for-each-ref --format='%(refname)' 'refs/heads/*'"
364 cmd = "for-each-ref --format='%(refname)' 'refs/heads/*'"
364 heads = repo.run_git_command(cmd)[0]
365 heads = repo.run_git_command(cmd)[0]
365 heads = heads.replace(push_ref['ref'], '')
366 heads = heads.replace(push_ref['ref'], '')
366 heads = ' '.join(map(lambda c: c.strip('\n').strip(),
367 heads = ' '.join(map(lambda c: c.strip('\n').strip(),
367 heads.splitlines()))
368 heads.splitlines()))
368 cmd = (('log %(new_rev)s' % push_ref) +
369 cmd = (('log %(new_rev)s' % push_ref) +
369 ' --reverse --pretty=format:"%H" --not ' + heads)
370 ' --reverse --pretty=format:"%H" --not ' + heads)
370 else:
371 else:
371 cmd = (('log %(old_rev)s..%(new_rev)s' % push_ref) +
372 cmd = (('log %(old_rev)s..%(new_rev)s' % push_ref) +
372 ' --reverse --pretty=format:"%H"')
373 ' --reverse --pretty=format:"%H"')
373 git_revs += repo.run_git_command(cmd)[0].splitlines()
374 git_revs += repo.run_git_command(cmd)[0].splitlines()
374 elif _type == 'tags':
375 elif _type == 'tags':
375 git_revs += [push_ref['name']]
376 git_revs += [push_ref['name']]
376
377
377 log_push_action(baseui, repo, _git_revs=git_revs)
378 log_push_action(baseui, repo, _git_revs=git_revs)
General Comments 0
You need to be logged in to leave comments. Login now