# HG changeset patch # User Marcin Kuzminski # Date 2013-04-15 22:44:48 # Node ID c7970889c5c0228036e3d18fbd8ad3b9006ac4c1 # Parent aab189b312fa113c843310f02c33e2498588d8d7 Removed shortlog aka lightweight changelog. Current version of changelog is fast and condensed. There's no sense to keep changelog duplicity. diff --git a/rhodecode/config/routing.py b/rhodecode/config/routing.py --- a/rhodecode/config/routing.py +++ b/rhodecode/config/routing.py @@ -586,9 +586,6 @@ def make_map(config): rmap.connect('summary_home_summary', '/{repo_name:.*?}/summary', controller='summary', conditions=dict(function=check_repo)) - rmap.connect('shortlog_home', '/{repo_name:.*?}/shortlog', - controller='shortlog', conditions=dict(function=check_repo)) - rmap.connect('branches_home', '/{repo_name:.*?}/branches', controller='branches', conditions=dict(function=check_repo)) @@ -601,6 +598,10 @@ def make_map(config): rmap.connect('changelog_home', '/{repo_name:.*?}/changelog', controller='changelog', conditions=dict(function=check_repo)) + rmap.connect('changelog_summary_home', '/{repo_name:.*?}/changelog_summary', + controller='changelog', action='changelog_summary', + conditions=dict(function=check_repo)) + rmap.connect('changelog_file_home', '/{repo_name:.*?}/changelog/{revision}/{f_path:.*}', controller='changelog', f_path=None, conditions=dict(function=check_repo)) diff --git a/rhodecode/controllers/changelog.py b/rhodecode/controllers/changelog.py --- a/rhodecode/controllers/changelog.py +++ b/rhodecode/controllers/changelog.py @@ -39,10 +39,29 @@ from rhodecode.lib.graphmod import _colo from rhodecode.lib.vcs.exceptions import RepositoryError, ChangesetDoesNotExistError,\ ChangesetError, NodeDoesNotExistError from rhodecode.lib.utils2 import safe_int +from webob.exc import HTTPNotFound log = logging.getLogger(__name__) +def _load_changelog_summary(): + p = safe_int(request.GET.get('page'), 1) + size = safe_int(request.GET.get('size'), 10) + + def url_generator(**kw): + return url('changelog_summary_home', + repo_name=c.rhodecode_db_repo.repo_name, size=size, **kw) + + collection = c.rhodecode_repo + + c.repo_changesets = RepoPage(collection, page=p, + items_per_page=size, + url=url_generator) + page_revisions = [x.raw_id for x in list(c.repo_changesets)] + c.comments = c.rhodecode_db_repo.get_comments(page_revisions) + c.statuses = c.rhodecode_db_repo.statuses(page_revisions) + + class ChangelogController(BaseRepoController): def __before__(self): @@ -140,3 +159,14 @@ class ChangelogController(BaseRepoContro if request.environ.get('HTTP_X_PARTIAL_XHR'): c.cs = c.rhodecode_repo.get_changeset(cs) return render('changelog/changelog_details.html') + raise HTTPNotFound() + + @LoginRequired() + @HasRepoPermissionAnyDecorator('repository.read', 'repository.write', + 'repository.admin') + def changelog_summary(self, repo_name): + if request.environ.get('HTTP_X_PARTIAL_XHR'): + _load_changelog_summary() + + return render('changelog/changelog_summary_data.html') + raise HTTPNotFound() diff --git a/rhodecode/controllers/shortlog.py b/rhodecode/controllers/shortlog.py deleted file mode 100644 --- a/rhodecode/controllers/shortlog.py +++ /dev/null @@ -1,107 +0,0 @@ -# -*- coding: utf-8 -*- -""" - rhodecode.controllers.shortlog - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - Shortlog controller for rhodecode - - :created_on: Apr 18, 2010 - :author: marcink - :copyright: (C) 2010-2012 Marcin Kuzminski - :license: GPLv3, see COPYING for more details. -""" -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -import logging - -from pylons import tmpl_context as c, request, url -from pylons.i18n.translation import _ - -from rhodecode.lib import helpers as h -from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator -from rhodecode.lib.base import BaseRepoController, render -from rhodecode.lib.helpers import RepoPage -from pylons.controllers.util import redirect -from rhodecode.lib.utils2 import safe_int -from rhodecode.lib.vcs.exceptions import NodeDoesNotExistError, ChangesetError,\ - RepositoryError - -log = logging.getLogger(__name__) - - -class ShortlogController(BaseRepoController): - - def __before__(self): - super(ShortlogController, self).__before__() - - def __get_cs_or_redirect(self, rev, repo_name, redirect_after=True): - """ - Safe way to get changeset if error occur it redirects to tip with - proper message - - :param rev: revision to fetch - :param repo_name: repo name to redirect after - """ - - try: - return c.rhodecode_repo.get_changeset(rev) - except RepositoryError, e: - h.flash(str(e), category='warning') - redirect(h.url('shortlog_home', repo_name=repo_name)) - - @LoginRequired() - @HasRepoPermissionAnyDecorator('repository.read', 'repository.write', - 'repository.admin') - def index(self, repo_name, revision=None, f_path=None): - p = safe_int(request.GET.get('page', 1), 1) - size = safe_int(request.GET.get('size', 20), 20) - collection = c.rhodecode_repo - c.file_history = f_path - - def url_generator(**kw): - if f_path: - return url('shortlog_file_home', repo_name=repo_name, - revision=revision, f_path=f_path, size=size, **kw) - return url('shortlog_home', repo_name=repo_name, size=size, **kw) - - if f_path: - log.debug('generating shortlog for path %s' % f_path) - # get the history for the file ! - tip_cs = c.rhodecode_repo.get_changeset() - try: - collection = tip_cs.get_file_history(f_path) - except (NodeDoesNotExistError, ChangesetError): - #this node is not present at tip ! - try: - cs = self.__get_cs_or_redirect(revision, repo_name) - collection = cs.get_file_history(f_path) - except RepositoryError, e: - h.flash(str(e), category='warning') - redirect(h.url('shortlog_home', repo_name=repo_name)) - collection = list(reversed(collection)) - - c.repo_changesets = RepoPage(collection, page=p, - items_per_page=size, url=url_generator) - page_revisions = [x.raw_id for x in list(c.repo_changesets)] - c.statuses = c.rhodecode_db_repo.statuses(page_revisions) - - if not c.repo_changesets: - h.flash(_('There are no changesets yet'), category='warning') - return redirect(url('summary_home', repo_name=repo_name)) - - c.shortlog_data = render('shortlog/shortlog_data.html') - if request.environ.get('HTTP_X_PARTIAL_XHR'): - return c.shortlog_data - r = render('shortlog/shortlog.html') - return r diff --git a/rhodecode/controllers/summary.py b/rhodecode/controllers/summary.py --- a/rhodecode/controllers/summary.py +++ b/rhodecode/controllers/summary.py @@ -55,6 +55,7 @@ from rhodecode.lib.celerylib.tasks impor from rhodecode.lib.helpers import RepoPage from rhodecode.lib.compat import json, OrderedDict from rhodecode.lib.vcs.nodes import FileNode +from rhodecode.controllers.changelog import _load_changelog_summary log = logging.getLogger(__name__) @@ -136,15 +137,7 @@ class SummaryController(BaseRepoControll 'repository.admin') def index(self, repo_name): c.dbrepo = dbrepo = c.rhodecode_db_repo - - def url_generator(**kw): - return url('shortlog_home', repo_name=repo_name, size=10, **kw) - - c.repo_changesets = RepoPage(c.rhodecode_repo, page=1, - items_per_page=10, url=url_generator) - page_revisions = [x.raw_id for x in list(c.repo_changesets)] - c.statuses = c.rhodecode_db_repo.statuses(page_revisions) - + _load_changelog_summary() if self.rhodecode_user.username == 'default': # for default(anonymous) user we don't need to pass credentials username = '' diff --git a/rhodecode/public/css/contextbar.css b/rhodecode/public/css/contextbar.css --- a/rhodecode/public/css/contextbar.css +++ b/rhodecode/public/css/contextbar.css @@ -21,7 +21,6 @@ #context-bar a.tags { background-image: url("../images/icons/tag_blue.png"); } #context-bar a.bookmarks { background-image: url("../images/icons/tag_green.png"); } #context-bar a.settings { background-image: url("../images/icons/cog.png"); } -#context-bar a.shortlog { background-image: url("../images/icons/time.png"); } #context-bar a.search { background-image: url("../images/icons/search_16.png"); } #context-bar a.admin { background-image: url("../images/icons/cog_edit.png"); } diff --git a/rhodecode/public/css/style.css b/rhodecode/public/css/style.css --- a/rhodecode/public/css/style.css +++ b/rhodecode/public/css/style.css @@ -544,10 +544,6 @@ div:hover > a.permalink { background-image: url("../images/icons/search_16.png"); } -#header #header-inner #quick li ul li a.shortlog, #header #header-inner #quick li ul li a.shortlog:hover { - background-image: url("../images/icons/clock_16.png"); -} - #header #header-inner #quick li ul li a.delete, #header #header-inner #quick li ul li a.delete:hover { background-image: url("../images/icons/delete.png"); } @@ -2761,12 +2757,6 @@ h3.files_location { margin: 0px 2px; } -#shortlog_data .branchtag, -#shortlog_data .booktag, -#shortlog_data .tagtag { - margin: 0px 2px; -} - .branchtag, .tagtag, .booktag, diff --git a/rhodecode/templates/base/base.html b/rhodecode/templates/base/base.html --- a/rhodecode/templates/base/base.html +++ b/rhodecode/templates/base/base.html @@ -128,7 +128,6 @@ %if c.rhodecode_db_repo.fork:
  • ${h.link_to(_('Compare fork'),h.url('compare_url',repo_name=c.rhodecode_db_repo.fork.repo_name,org_ref_type='branch',org_ref='default',other_repo=c.repo_name,other_ref_type='branch',other_ref=request.GET.get('branch') or 'default', merge=1),class_='compare_request')}
  • %endif -
  • ${h.link_to(_('Lightweight changelog'),h.url('shortlog_home',repo_name=c.repo_name),class_='shortlog')}
  • ${h.link_to(_('Search'),h.url('search_repo',repo_name=c.repo_name),class_='search')}
  • %if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name) and c.rhodecode_db_repo.enable_locking: diff --git a/rhodecode/templates/changelog/changelog_summary_data.html b/rhodecode/templates/changelog/changelog_summary_data.html new file mode 100644 --- /dev/null +++ b/rhodecode/templates/changelog/changelog_summary_data.html @@ -0,0 +1,103 @@ +## -*- coding: utf-8 -*- +%if c.repo_changesets: + + + + + + + + +%for cnt,cs in enumerate(c.repo_changesets): + + + + + + + +%endfor + +
    ${_('Revision')}${_('Commit message')}${_('Age')}${_('Author')}${_('Refs')}
    +
    +
    + %if c.statuses.get(cs.raw_id): +
    + %if c.statuses.get(cs.raw_id)[2]: + + + + %else: + + %endif +
    + %endif +
    +
    ${h.show_id(cs)}
    +
    +
    + ${h.urlify_commit(h.truncate(cs.message,50),c.repo_name, h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))} + + ${h.age(cs.date)} + ${h.person(cs.author)} + %if h.is_hg(c.rhodecode_repo): + %for book in cs.bookmarks: +
    + ${h.link_to(h.shorter(book),h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id))} +
    + %endfor + %endif + %for tag in cs.tags: +
    + ${h.link_to(h.shorter(tag),h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id))} +
    + %endfor + %if cs.branch: +
    + ${h.link_to(h.shorter(cs.branch),h.url('changelog_home',repo_name=c.repo_name,branch=cs.branch))} +
    + %endif +
    + + + +
    +${c.repo_changesets.pager('$link_previous ~2~ $link_next')} +
    +%else: + +%if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name): +

    ${_('Add or upload files directly via RhodeCode')}

    +
    + +
    +%endif + + +

    ${_('Push new repo')}

    +
    +    ${c.rhodecode_repo.alias} clone ${c.clone_repo_url}
    +    ${c.rhodecode_repo.alias} add README # add first file
    +    ${c.rhodecode_repo.alias} commit -m "Initial" # commit with message
    +    ${c.rhodecode_repo.alias} push ${'origin master' if h.is_git(c.rhodecode_repo) else ''} # push changes back
    +
    + +

    ${_('Existing repository?')}

    +
    +%if h.is_git(c.rhodecode_repo):
    +    git remote add origin ${c.clone_repo_url}
    +    git push -u origin master
    +%else:
    +    hg push ${c.clone_repo_url}
    +%endif
    +
    +%endif diff --git a/rhodecode/templates/shortlog/shortlog.html b/rhodecode/templates/shortlog/shortlog.html deleted file mode 100644 --- a/rhodecode/templates/shortlog/shortlog.html +++ /dev/null @@ -1,37 +0,0 @@ -## -*- coding: utf-8 -*- -<%inherit file="/base/base.html"/> - -<%def name="title()"> - ${_('%s Lightweight Changelog') % c.repo_name} · ${c.rhodecode_name} - - - -<%def name="breadcrumbs_links()"> - %if c.file_history: - ${h.link_to(_('Lightweight Changelog'),h.url('shortlog_home',repo_name=c.repo_name))} - » - ${c.file_history} - %else: - ${_('Lightweight Changelog')} - %endif - - -<%def name="page_nav()"> - ${self.menu('repositories')} - - -<%def name="main()"> -${self.context_bar('options')} -
    - -
    - ${self.breadcrumbs()} -
    - -
    -
    - ${c.shortlog_data} -
    -
    -
    - diff --git a/rhodecode/templates/shortlog/shortlog_data.html b/rhodecode/templates/shortlog/shortlog_data.html deleted file mode 100644 --- a/rhodecode/templates/shortlog/shortlog_data.html +++ /dev/null @@ -1,103 +0,0 @@ -## -*- coding: utf-8 -*- -%if c.repo_changesets: - - - - - - - - -%for cnt,cs in enumerate(c.repo_changesets): - - - - - - - -%endfor - -
    ${_('Revision')}${_('Commit message')}${_('Age')}${_('Author')}${_('Refs')}
    -
    -
    - %if c.statuses.get(cs.raw_id): -
    - %if c.statuses.get(cs.raw_id)[2]: - - - - %else: - - %endif -
    - %endif -
    -
    ${h.show_id(cs)}
    -
    -
    - ${h.urlify_commit(h.truncate(cs.message,50),c.repo_name, h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))} - - ${h.age(cs.date)} - ${h.person(cs.author)} - %if h.is_hg(c.rhodecode_repo): - %for book in cs.bookmarks: -
    - ${h.link_to(h.shorter(book),h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id))} -
    - %endfor - %endif - %for tag in cs.tags: -
    - ${h.link_to(h.shorter(tag),h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id))} -
    - %endfor - %if cs.branch: -
    - ${h.link_to(h.shorter(cs.branch),h.url('changelog_home',repo_name=c.repo_name,branch=cs.branch))} -
    - %endif -
    - - - -
    -${c.repo_changesets.pager('$link_previous ~2~ $link_next')} -
    -%else: - -%if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name): -

    ${_('Add or upload files directly via RhodeCode')}

    -
    - -
    -%endif - - -

    ${_('Push new repo')}

    -
    -    ${c.rhodecode_repo.alias} clone ${c.clone_repo_url}
    -    ${c.rhodecode_repo.alias} add README # add first file
    -    ${c.rhodecode_repo.alias} commit -m "Initial" # commit with message
    -    ${c.rhodecode_repo.alias} push ${'origin master' if h.is_git(c.rhodecode_repo) else ''} # push changes back
    -
    - -

    ${_('Existing repository?')}

    -
    -%if h.is_git(c.rhodecode_repo):
    -    git remote add origin ${c.clone_repo_url}
    -    git push -u origin master
    -%else:
    -    hg push ${c.clone_repo_url}
    -%endif
    -
    -%endif diff --git a/rhodecode/templates/summary/summary.html b/rhodecode/templates/summary/summary.html --- a/rhodecode/templates/summary/summary.html +++ b/rhodecode/templates/summary/summary.html @@ -261,7 +261,7 @@ window.onhashchange = function() {
    - <%include file='../shortlog/shortlog_data.html'/> + <%include file='../changelog/changelog_summary_data.html'/>
    diff --git a/rhodecode/tests/functional/test_shortlog.py b/rhodecode/tests/functional/test_shortlog.py deleted file mode 100644 --- a/rhodecode/tests/functional/test_shortlog.py +++ /dev/null @@ -1,16 +0,0 @@ -from rhodecode.tests import * - - -class TestShortlogController(TestController): - - def test_index_hg(self): - self.log_user() - response = self.app.get(url(controller='shortlog', action='index', - repo_name=HG_REPO)) - # Test response... - - def test_index_git(self): - self.log_user() - response = self.app.get(url(controller='shortlog', action='index', - repo_name=GIT_REPO)) - # Test response...