diff --git a/kallithea/controllers/branches.py b/kallithea/controllers/branches.py
--- a/kallithea/controllers/branches.py
+++ b/kallithea/controllers/branches.py
@@ -57,7 +57,7 @@ class BranchesController(BaseRepoControl
cs_g = c.rhodecode_repo.get_changeset
c.repo_closed_branches = {}
- if c.rhodecode_db_repo.repo_type == 'hg':
+ if c.db_repo.repo_type == 'hg':
bt_closed = _branchtags(c.rhodecode_repo._repo)
_closed_branches = [(safe_unicode(n), cs_g(binascii.hexlify(h)),)
for n, h in bt_closed.items()]
diff --git a/kallithea/controllers/changelog.py b/kallithea/controllers/changelog.py
--- a/kallithea/controllers/changelog.py
+++ b/kallithea/controllers/changelog.py
@@ -51,7 +51,7 @@ def _load_changelog_summary():
def url_generator(**kw):
return url('changelog_summary_home',
- repo_name=c.rhodecode_db_repo.repo_name, size=size, **kw)
+ repo_name=c.db_repo.repo_name, size=size, **kw)
collection = c.rhodecode_repo
@@ -59,8 +59,8 @@ def _load_changelog_summary():
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)
+ c.comments = c.db_repo.get_comments(page_revisions)
+ c.statuses = c.db_repo.statuses(page_revisions)
class ChangelogController(BaseRepoController):
@@ -170,8 +170,8 @@ class ChangelogController(BaseRepoContro
items_per_page=c.size, branch=branch_name,)
collection = list(c.pagination)
page_revisions = [x.raw_id for x in c.pagination]
- c.comments = c.rhodecode_db_repo.get_comments(page_revisions)
- c.statuses = c.rhodecode_db_repo.statuses(page_revisions)
+ c.comments = c.db_repo.get_comments(page_revisions)
+ c.statuses = c.db_repo.statuses(page_revisions)
except (EmptyRepositoryError), e:
h.flash(safe_str(e), category='warning')
return redirect(url('summary_home', repo_name=c.repo_name))
diff --git a/kallithea/controllers/changeset.py b/kallithea/controllers/changeset.py
--- a/kallithea/controllers/changeset.py
+++ b/kallithea/controllers/changeset.py
@@ -227,15 +227,15 @@ class ChangesetController(BaseRepoContro
inlines = []
if method == 'show':
c.statuses.extend([ChangesetStatusModel().get_status(
- c.rhodecode_db_repo.repo_id, changeset.raw_id)])
+ c.db_repo.repo_id, changeset.raw_id)])
c.comments.extend(ChangesetCommentsModel()\
- .get_comments(c.rhodecode_db_repo.repo_id,
+ .get_comments(c.db_repo.repo_id,
revision=changeset.raw_id))
#comments from PR
st = ChangesetStatusModel().get_statuses(
- c.rhodecode_db_repo.repo_id, changeset.raw_id,
+ c.db_repo.repo_id, changeset.raw_id,
with_revisions=True)
# from associated statuses, check the pull requests, and
# show comments from them
@@ -246,7 +246,7 @@ class ChangesetController(BaseRepoContro
for pr in prs:
c.comments.extend(pr.comments)
inlines = ChangesetCommentsModel()\
- .get_inline_comments(c.rhodecode_db_repo.repo_id,
+ .get_inline_comments(c.db_repo.repo_id,
revision=changeset.raw_id)
c.inline_comments.extend(inlines)
@@ -355,7 +355,7 @@ class ChangesetController(BaseRepoContro
c.co = comm = ChangesetCommentsModel().create(
text=text,
- repo=c.rhodecode_db_repo.repo_id,
+ repo=c.db_repo.repo_id,
user=c.rhodecode_user.user_id,
revision=revision,
f_path=request.POST.get('f_path'),
@@ -372,7 +372,7 @@ class ChangesetController(BaseRepoContro
try:
ChangesetStatusModel().set_status(
- c.rhodecode_db_repo.repo_id,
+ c.db_repo.repo_id,
status,
c.rhodecode_user.user_id,
comm,
@@ -388,7 +388,7 @@ class ChangesetController(BaseRepoContro
revision=revision))
action_logger(self.rhodecode_user,
'user_commented_revision:%s' % revision,
- c.rhodecode_db_repo, self.ip_addr, self.sa)
+ c.db_repo, self.ip_addr, self.sa)
Session().commit()
diff --git a/kallithea/controllers/compare.py b/kallithea/controllers/compare.py
--- a/kallithea/controllers/compare.py
+++ b/kallithea/controllers/compare.py
@@ -185,7 +185,7 @@ class CompareController(BaseRepoControll
'repository.admin')
def index(self, repo_name):
c.compare_home = True
- org_repo = c.rhodecode_db_repo.repo_name
+ org_repo = c.db_repo.repo_name
other_repo = request.GET.get('other_repo', org_repo)
c.org_repo = Repository.get_by_repo_name(org_repo)
c.other_repo = Repository.get_by_repo_name(other_repo)
@@ -197,7 +197,7 @@ class CompareController(BaseRepoControll
'repository.admin')
def compare(self, repo_name, org_ref_type, org_ref, other_ref_type, other_ref):
# org_ref will be evaluated in org_repo
- org_repo = c.rhodecode_db_repo.repo_name
+ org_repo = c.db_repo.repo_name
org_ref = (org_ref_type, org_ref)
# other_ref will be evaluated in other_repo
other_ref = (other_ref_type, other_ref)
@@ -260,7 +260,7 @@ class CompareController(BaseRepoControll
c.cs_ranges, c.ancestor = self._get_changesets(
org_repo.scm_instance.alias, org_repo.scm_instance, org_rev,
other_repo.scm_instance, other_rev, merge)
- c.statuses = c.rhodecode_db_repo.statuses(
+ c.statuses = c.db_repo.statuses(
[x.raw_id for x in c.cs_ranges])
if merge and not c.ancestor:
diff --git a/kallithea/controllers/feed.py b/kallithea/controllers/feed.py
--- a/kallithea/controllers/feed.py
+++ b/kallithea/controllers/feed.py
@@ -100,7 +100,7 @@ class FeedController(BaseRepoController)
desc_msg.append('tag: %s
' % tag)
diff_processor, changes = self.__changes(cs)
# rev link
- _url = url('changeset_home', repo_name=c.rhodecode_db_repo.repo_name,
+ _url = url('changeset_home', repo_name=c.db_repo.repo_name,
revision=cs.raw_id, qualified=True)
desc_msg.append('changeset: %s' % (_url, cs.raw_id[:8]))
diff --git a/kallithea/controllers/files.py b/kallithea/controllers/files.py
--- a/kallithea/controllers/files.py
+++ b/kallithea/controllers/files.py
@@ -294,7 +294,7 @@ class FilesController(BaseRepoController
@LoginRequired()
@HasRepoPermissionAnyDecorator('repository.write', 'repository.admin')
def delete(self, repo_name, revision, f_path):
- repo = c.rhodecode_db_repo
+ repo = c.db_repo
if repo.enable_locking and repo.locked[0]:
h.flash(_('This repository is has been locked by %s on %s')
% (h.person_by_id(repo.locked[0]),
@@ -334,7 +334,7 @@ class FilesController(BaseRepoController
}
}
self.scm_model.delete_nodes(
- user=c.rhodecode_user.user_id, repo=c.rhodecode_db_repo,
+ user=c.rhodecode_user.user_id, repo=c.db_repo,
message=message,
nodes=nodes,
parent_cs=c.cs,
@@ -354,7 +354,7 @@ class FilesController(BaseRepoController
@LoginRequired()
@HasRepoPermissionAnyDecorator('repository.write', 'repository.admin')
def edit(self, repo_name, revision, f_path):
- repo = c.rhodecode_db_repo
+ repo = c.db_repo
if repo.enable_locking and repo.locked[0]:
h.flash(_('This repository is has been locked by %s on %s')
% (h.person_by_id(repo.locked[0]),
@@ -475,7 +475,7 @@ class FilesController(BaseRepoController
}
}
self.scm_model.create_nodes(
- user=c.rhodecode_user.user_id, repo=c.rhodecode_db_repo,
+ user=c.rhodecode_user.user_id, repo=c.db_repo,
message=message,
nodes=nodes,
parent_cs=c.cs,
diff --git a/kallithea/controllers/followers.py b/kallithea/controllers/followers.py
--- a/kallithea/controllers/followers.py
+++ b/kallithea/controllers/followers.py
@@ -46,7 +46,7 @@ class FollowersController(BaseRepoContro
'repository.admin')
def followers(self, repo_name):
p = safe_int(request.GET.get('page', 1), 1)
- repo_id = c.rhodecode_db_repo.repo_id
+ repo_id = c.db_repo.repo_id
d = UserFollowing.get_repo_followers(repo_id)\
.order_by(UserFollowing.follows_from)
c.followers_pager = Page(d, page=p, items_per_page=20)
diff --git a/kallithea/controllers/forks.py b/kallithea/controllers/forks.py
--- a/kallithea/controllers/forks.py
+++ b/kallithea/controllers/forks.py
@@ -113,7 +113,7 @@ class ForksController(BaseRepoController
'repository.admin')
def forks(self, repo_name):
p = safe_int(request.GET.get('page', 1), 1)
- repo_id = c.rhodecode_db_repo.repo_id
+ repo_id = c.db_repo.repo_id
d = []
for r in Repository.get_repo_forks(repo_id):
if not HasRepoPermissionAny(
diff --git a/kallithea/controllers/home.py b/kallithea/controllers/home.py
--- a/kallithea/controllers/home.py
+++ b/kallithea/controllers/home.py
@@ -111,9 +111,9 @@ class HomeController(BaseController):
'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
+ c.db_repo = Repository.get_by_repo_name(repo_name)
+ if c.db_repo:
+ c.rhodecode_repo = c.db_repo.scm_instance
return render('/switch_to_list.html')
raise HTTPBadRequest()
diff --git a/kallithea/controllers/pullrequests.py b/kallithea/controllers/pullrequests.py
--- a/kallithea/controllers/pullrequests.py
+++ b/kallithea/controllers/pullrequests.py
@@ -255,7 +255,7 @@ class PullrequestsController(BaseRepoCon
@HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
'repository.admin')
def index(self):
- org_repo = c.rhodecode_db_repo
+ org_repo = c.db_repo
try:
org_repo.scm_instance.get_changeset()
@@ -440,14 +440,14 @@ class PullrequestsController(BaseRepoCon
# inline comments
c.inline_cnt = 0
c.inline_comments = cc_model.get_inline_comments(
- c.rhodecode_db_repo.repo_id,
+ c.db_repo.repo_id,
pull_request=pull_request_id)
# count inline comments
for __, lines in c.inline_comments:
for comments in lines.values():
c.inline_cnt += len(comments)
# comments
- c.comments = cc_model.get_comments(c.rhodecode_db_repo.repo_id,
+ c.comments = cc_model.get_comments(c.db_repo.repo_id,
pull_request=pull_request_id)
# (badly named) pull-request status calculation based on reviewer votes
@@ -484,7 +484,7 @@ class PullrequestsController(BaseRepoCon
text = text or _def
comm = ChangesetCommentsModel().create(
text=text,
- repo=c.rhodecode_db_repo.repo_id,
+ repo=c.db_repo.repo_id,
user=c.rhodecode_user.user_id,
pull_request=pull_request_id,
f_path=request.POST.get('f_path'),
@@ -497,13 +497,13 @@ class PullrequestsController(BaseRepoCon
action_logger(self.rhodecode_user,
'user_commented_pull_request:%s' % pull_request_id,
- c.rhodecode_db_repo, self.ip_addr, self.sa)
+ c.db_repo, self.ip_addr, self.sa)
if allowed_to_change_status:
# get status if set !
if status and change_status:
ChangesetStatusModel().set_status(
- c.rhodecode_db_repo.repo_id,
+ c.db_repo.repo_id,
status,
c.rhodecode_user.user_id,
comm,
@@ -515,7 +515,7 @@ class PullrequestsController(BaseRepoCon
PullRequestModel().close_pull_request(pull_request_id)
action_logger(self.rhodecode_user,
'user_closed_pull_request:%s' % pull_request_id,
- c.rhodecode_db_repo, self.ip_addr, self.sa)
+ c.db_repo, self.ip_addr, self.sa)
else:
h.flash(_('Closing pull request on other statuses than '
'rejected or approved forbidden'),
diff --git a/kallithea/controllers/summary.py b/kallithea/controllers/summary.py
--- a/kallithea/controllers/summary.py
+++ b/kallithea/controllers/summary.py
@@ -145,24 +145,24 @@ class SummaryController(BaseRepoControll
elif '{repoid}' in _def_clone_uri:
_def_clone_uri_by_id = _def_clone_uri.replace('_{repoid}', '{repo}')
- c.clone_repo_url = c.rhodecode_db_repo.clone_url(user=username,
+ c.clone_repo_url = c.db_repo.clone_url(user=username,
uri_tmpl=_def_clone_uri)
- c.clone_repo_url_id = c.rhodecode_db_repo.clone_url(user=username,
+ c.clone_repo_url_id = c.db_repo.clone_url(user=username,
uri_tmpl=_def_clone_uri_by_id)
- if c.rhodecode_db_repo.enable_statistics:
+ if c.db_repo.enable_statistics:
c.show_stats = True
else:
c.show_stats = False
stats = self.sa.query(Statistics)\
- .filter(Statistics.repository == c.rhodecode_db_repo)\
+ .filter(Statistics.repository == c.db_repo)\
.scalar()
c.stats_percentage = 0
if stats and stats.languages:
- c.no_data = False is c.rhodecode_db_repo.enable_statistics
+ c.no_data = False is c.db_repo.enable_statistics
lang_stats_d = json.loads(stats.languages)
lang_stats = ((x, {"count": y,
@@ -176,9 +176,9 @@ class SummaryController(BaseRepoControll
c.no_data = True
c.trending_languages = json.dumps({})
- c.enable_downloads = c.rhodecode_db_repo.enable_downloads
+ c.enable_downloads = c.db_repo.enable_downloads
c.readme_data, c.readme_file = \
- self.__get_readme_data(c.rhodecode_db_repo)
+ self.__get_readme_data(c.db_repo)
return render('summary/summary.html')
@LoginRequired()
@@ -188,7 +188,7 @@ class SummaryController(BaseRepoControll
@jsonify
def repo_size(self, repo_name):
if request.is_xhr:
- return c.rhodecode_db_repo._repo_size()
+ return c.db_repo._repo_size()
else:
raise HTTPBadRequest()
@@ -196,7 +196,7 @@ class SummaryController(BaseRepoControll
@HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
'repository.admin')
def statistics(self, repo_name):
- if c.rhodecode_db_repo.enable_statistics:
+ if c.db_repo.enable_statistics:
c.show_stats = True
c.no_data_msg = _('No data loaded yet')
else:
@@ -214,10 +214,10 @@ class SummaryController(BaseRepoControll
c.ts_max = ts_max_y
stats = self.sa.query(Statistics)\
- .filter(Statistics.repository == c.rhodecode_db_repo)\
+ .filter(Statistics.repository == c.db_repo)\
.scalar()
if stats and stats.languages:
- c.no_data = False is c.rhodecode_db_repo.enable_statistics
+ c.no_data = False is c.db_repo.enable_statistics
lang_stats_d = json.loads(stats.languages)
c.commit_data = stats.commit_activity
c.overview_data = stats.commit_activity_combined
@@ -244,6 +244,6 @@ class SummaryController(BaseRepoControll
c.no_data = True
recurse_limit = 500 # don't recurse more than 500 times when parsing
- run_task(get_commits_stats, c.rhodecode_db_repo.repo_name, ts_min_y,
+ run_task(get_commits_stats, c.db_repo.repo_name, ts_min_y,
ts_max_y, recurse_limit)
return render('summary/statistics.html')
diff --git a/kallithea/lib/base.py b/kallithea/lib/base.py
--- a/kallithea/lib/base.py
+++ b/kallithea/lib/base.py
@@ -370,7 +370,7 @@ class BaseRepoController(BaseController)
repository loaded items are
c.rhodecode_repo: instance of scm repository
- c.rhodecode_db_repo: instance of db
+ c.db_repo: instance of db
c.repository_followers: number of followers
c.repository_forks: number of forks
c.repository_following: weather the current user is following the current repo
@@ -397,8 +397,8 @@ class BaseRepoController(BaseController)
check_url = url('repo_creating_home', repo_name=c.repo_name)
return redirect(check_url)
- dbr = c.rhodecode_db_repo = _dbr
- c.rhodecode_repo = c.rhodecode_db_repo.scm_instance
+ dbr = c.db_repo = _dbr
+ c.rhodecode_repo = c.db_repo.scm_instance
if c.rhodecode_repo is None:
log.error('%s this repository is present in database but it '
'cannot be created as an scm instance', c.repo_name)
diff --git a/kallithea/templates/base/base.html b/kallithea/templates/base/base.html
--- a/kallithea/templates/base/base.html
+++ b/kallithea/templates/base/base.html
@@ -115,20 +115,20 @@