##// END OF EJS Templates
Migrate to Mergely 3.3.4....
Migrate to Mergely 3.3.4. RhodeCode 2.2.5 distributed Mergely 3.3.4 with some of the changes that Mergely 3.3.3 in RhodeCode 1.7.2 also had. That do however not seem to be changes we want for Kallithea this way and we take the 3.3.4 files as they are. I've also included the Mergely license file, as downloaded from: http://www.mergely.com/license.php That LICENSE file is kept in HTML just as it was downloaded from their website. While it's a bit annoying to keep the license file in HTML, this is the way it came from upstream so we'll leave it that way. Since the Javascript code is used with other GPLv3 Javascript, we are using the GPL option of Mergely's tri-license. Finally, note that previously, this was incorrectly called "mergerly", so the opportunity is taken here to correct the name. That required changes to diff_2way.html. As commands:: $ wget -N --output-document LICENSE-MERGELY.html http://www.mergely.com/license.php $ hg add LICENSE-MERGELY.html $ hg mv rhodecode/public/css/mergerly.css rhodecode/public/css/mergely.css $ hg mv rhodecode/public/js/mergerly.js rhodecode/public/js/mergely.js $ sed -i 's,mergerly\.,mergely,g' rhodecode/templates/files/diff_2way.html $ ( cd /tmp; \ wget -N http://www.mergely.com/releases/mergely-3.3.4.zip; \ unzip mergely-3.3.4.zip ) $ sha256sum /tmp/mergely-3.3.4.zip 87415d30494bbe829c248881aa7cdc0303f7e70b458a5f687615564d4498cc82 mergely-3.3.4.zip $ cp /tmp/mergely-3.3.4/lib/mergely.js rhodecode/public/js/mergely.js $ cp /tmp/mergely-3.3.4/lib/mergely.css rhodecode/public/css/mergely.css $ sed -i -e '/^ \* Version/a\ *\n * NOTE by bkuhn@sfconservancy.org for Kallithea:\n * Mergely license appears at http://www.mergely.com/license.php and in LICENSE-MERGELY.html' rhodecode/public/js/mergely.js rhodecode/public/css/mergely.css

File last commit:

r4116:ffd45b18 rhodecode-2.2.5-gpl
r4125:aa3b5594 rhodecode-2.2.5-gpl
Show More
home.py
146 lines | 5.1 KiB | text/x-python | PythonLexer
# -*- coding: utf-8 -*-
# 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 <http://www.gnu.org/licenses/>.
"""
rhodecode.controllers.home
~~~~~~~~~~~~~~~~~~~~~~~~~~
Home controller for Rhodecode
:created_on: Feb 18, 2010
:author: marcink
:copyright: (c) 2013 RhodeCode GmbH.
:license: GPLv3, see LICENSE for more details.
"""
import logging
from pylons import tmpl_context as c, request
from pylons.i18n.translation import _
from webob.exc import HTTPBadRequest
from sqlalchemy.sql.expression import func
import rhodecode
from rhodecode.lib import helpers as h
from rhodecode.lib.utils import jsonify, conditional_cache
from rhodecode.lib.compat import json
from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator
from rhodecode.lib.base import BaseController, render
from rhodecode.model.db import Repository, RepoGroup
from rhodecode.model.repo import RepoModel
log = logging.getLogger(__name__)
class HomeController(BaseController):
def __before__(self):
super(HomeController, self).__before__()
@LoginRequired()
def index(self):
c.groups = self.scm_model.get_repo_groups()
c.group = None
c.repos_list = Repository.query()\
.filter(Repository.group_id == None)\
.order_by(func.lower(Repository.repo_name))\
.all()
repos_data = RepoModel().get_repos_as_dict(repos_list=c.repos_list,
admin=False)
#json used to render the grid
c.data = json.dumps(repos_data)
return render('/index.html')
@LoginRequired()
@jsonify
def repo_switcher_data(self):
#wrapper for conditional cache
def _c():
log.debug('generating switcher repo/groups list')
all_repos = Repository.query().order_by(Repository.repo_name).all()
repo_iter = self.scm_model.get_repos(all_repos, simple=True)
all_groups = RepoGroup.query().order_by(RepoGroup.group_name).all()
repo_groups_iter = self.scm_model.get_repo_groups(all_groups)
res = [{
'text': _('Groups'),
'children': [
{'id': obj.group_name, 'text': obj.group_name,
'type': 'group', 'obj': {}} for obj in repo_groups_iter]
}, {
'text': _('Repositories'),
'children': [
{'id': obj['name'], 'text': obj['name'],
'type': 'repo', 'obj': obj['dbrepo']} for obj in repo_iter]
}]
data = {
'more': False,
'results': res
}
return data
if request.is_xhr:
condition = False
compute = conditional_cache('short_term', 'cache_desc',
condition=condition, func=_c)
return compute()
else:
raise HTTPBadRequest()
@LoginRequired()
@HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
'repository.admin')
def branch_tag_switcher(self, repo_name):
if request.is_xhr:
c.rhodecode_db_repo = Repository.get_by_repo_name(repo_name)
if c.rhodecode_db_repo:
c.rhodecode_repo = c.rhodecode_db_repo.scm_instance
return render('/switch_to_list.html')
raise HTTPBadRequest()
@LoginRequired()
@HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
'repository.admin')
@jsonify
def repo_refs_data(self, repo_name):
repo = Repository.get_by_repo_name(repo_name).scm_instance
res = []
_branches = repo.branches.items()
if _branches:
res.append({
'text': _('Branch'),
'children': [{'id': rev, 'text': name, 'type': 'branch'} for name, rev in _branches]
})
_tags = repo.tags.items()
if _tags:
res.append({
'text': _('Tag'),
'children': [{'id': rev, 'text': name, 'type': 'tag'} for name, rev in _tags]
})
_bookmarks = repo.bookmarks.items()
if _bookmarks:
res.append({
'text': _('Bookmark'),
'children': [{'id': rev, 'text': name, 'type': 'book'} for name, rev in _bookmarks]
})
data = {
'more': False,
'results': res
}
return data