Show More
@@ -41,7 +41,7 b' from rhodecode.model.scm import ScmModel' | |||||
41 |
|
41 | |||
42 | from vcs.backends import ARCHIVE_SPECS |
|
42 | from vcs.backends import ARCHIVE_SPECS | |
43 | from vcs.exceptions import RepositoryError, ChangesetError, \ |
|
43 | from vcs.exceptions import RepositoryError, ChangesetError, \ | |
44 |
ChangesetDoesNotExistError, EmptyRepositoryError, I |
|
44 | ChangesetDoesNotExistError, EmptyRepositoryError, ImproperArchiveTypeError | |
45 | from vcs.nodes import FileNode |
|
45 | from vcs.nodes import FileNode | |
46 | from vcs.utils import diffs as differ |
|
46 | from vcs.utils import diffs as differ | |
47 |
|
47 |
@@ -394,68 +394,69 b' def action_parser(user_log):' | |||||
394 | action, action_params = x |
|
394 | action, action_params = x | |
395 |
|
395 | |||
396 | def get_cs_links(): |
|
396 | def get_cs_links(): | |
397 | if action == 'push': |
|
397 | revs_limit = 5 #display this amount always | |
398 |
|
|
398 | revs_top_limit = 50 #show upto this amount of changesets hidden | |
399 | revs_top_limit = 50 #show upto this amount of changesets hidden |
|
399 | revs = action_params.split(',') | |
400 | revs = action_params.split(',') |
|
400 | repo_name = user_log.repository.repo_name | |
401 | repo_name = user_log.repository.repo_name |
|
401 | from rhodecode.model.scm import ScmModel | |
402 | from rhodecode.model.scm import ScmModel |
|
|||
403 |
|
402 | |||
404 |
|
|
403 | message = lambda rev: get_changeset_safe(ScmModel().get(repo_name), | |
405 |
|
|
404 | rev).message | |
406 |
|
405 | |||
407 |
|
|
406 | cs_links = " " + ', '.join ([link_to(rev, | |
408 |
|
|
407 | url('changeset_home', | |
409 |
|
|
408 | repo_name=repo_name, | |
410 |
|
|
409 | revision=rev), title=tooltip(message(rev)), | |
411 |
|
|
410 | class_='tooltip') for rev in revs[:revs_limit] ]) | |
412 |
|
|
411 | if len(revs) > revs_limit: | |
413 |
|
|
412 | uniq_id = revs[0] | |
414 |
|
|
413 | html_tmpl = ('<span> %s ' | |
415 |
|
|
414 | '<a class="show_more" id="_%s" href="#">%s</a> ' | |
416 |
|
|
415 | '%s</span>') | |
417 |
|
|
416 | cs_links += html_tmpl % (_('and'), uniq_id, _('%s more') \ | |
418 |
|
|
417 | % (len(revs) - revs_limit), | |
419 |
|
|
418 | _('revisions')) | |
420 |
|
419 | |||
421 |
|
|
420 | html_tmpl = '<span id="%s" style="display:none"> %s </span>' | |
422 |
|
|
421 | cs_links += html_tmpl % (uniq_id, ', '.join([link_to(rev, | |
423 |
|
|
422 | url('changeset_home', | |
424 |
|
|
423 | repo_name=repo_name, revision=rev), | |
425 |
|
|
424 | title=message(rev), class_='tooltip') | |
426 |
|
|
425 | for rev in revs[revs_limit:revs_top_limit]])) | |
427 |
|
426 | |||
428 |
|
|
427 | return cs_links | |
429 | return '' |
|
|||
430 |
|
428 | |||
431 | def get_fork_name(): |
|
429 | def get_fork_name(): | |
432 | if action == 'user_forked_repo': |
|
430 | from rhodecode.model.scm import ScmModel | |
433 | from rhodecode.model.scm import ScmModel |
|
431 | repo_name = action_params | |
434 | repo_name = action_params |
|
432 | repo = ScmModel().get(repo_name) | |
435 | repo = ScmModel().get(repo_name) |
|
433 | if repo is None: | |
436 |
|
|
434 | return repo_name | |
437 | return repo_name |
|
435 | return link_to(action_params, url('summary_home', | |
438 | return link_to(action_params, url('summary_home', |
|
436 | repo_name=repo.name,), | |
439 |
|
|
437 | title=repo.dbrepo.description) | |
440 | title=repo.dbrepo.description) |
|
438 | ||
441 | return '' |
|
439 | map = {'user_deleted_repo':(_('User [deleted] repository'), None), | |
442 |
|
|
440 | 'user_created_repo':(_('User [created] repository'), None), | |
443 |
'user_ |
|
441 | 'user_forked_repo':(_('User [forked] repository as:'), get_fork_name), | |
444 |
'user_ |
|
442 | 'user_updated_repo':(_('User [updated] repository'), None), | |
445 |
' |
|
443 | 'admin_deleted_repo':(_('Admin [delete] repository'), None), | |
446 |
'admin_ |
|
444 | 'admin_created_repo':(_('Admin [created] repository'), None), | |
447 |
'admin_ |
|
445 | 'admin_forked_repo':(_('Admin [forked] repository'), None), | |
448 |
'admin_ |
|
446 | 'admin_updated_repo':(_('Admin [updated] repository'), None), | |
449 | 'admin_updated_repo':_('Admin [updated] repository'), |
|
447 | 'push':(_('[Pushed]'), get_cs_links), | |
450 |
'pu |
|
448 | 'pull':(_('[Pulled]'), None), | |
451 | 'pull':_('[Pulled]'), |
|
449 | 'started_following_repo':(_('User [started following] repository'), None), | |
452 |
'st |
|
450 | 'stopped_following_repo':(_('User [stopped following] repository'), None), | |
453 | 'stopped_following_repo':_('User [stopped following] repository'), |
|
|||
454 | } |
|
451 | } | |
455 |
|
452 | |||
456 | action_str = map.get(action, action) |
|
453 | action_str = map.get(action, action) | |
457 |
|
|
454 | action = action_str[0].replace('[', '<span class="journal_highlight">')\ | |
458 |
.replace(']', '</span>') |
|
455 | .replace(']', '</span>') | |
|
456 | if action_str[1] is not None: | |||
|
457 | action = action + " " + action_str[1]() | |||
|
458 | ||||
|
459 | return literal(action) | |||
459 |
|
460 | |||
460 | def action_parser_icon(user_log): |
|
461 | def action_parser_icon(user_log): | |
461 | action = user_log.action |
|
462 | action = user_log.action |
General Comments 0
You need to be logged in to leave comments.
Login now