diff --git a/rhodecode/config/routing.py b/rhodecode/config/routing.py
--- a/rhodecode/config/routing.py
+++ b/rhodecode/config/routing.py
@@ -35,7 +35,7 @@ def make_map(config):
#==========================================================================
#MAIN PAGE
- map.connect('hg_home', '/', controller='hg', action='index')
+ map.connect('home', '/', controller='home', action='index')
map.connect('bugtracker', "http://bitbucket.org/marcinkuzminski/rhodecode/issues", _static=True)
map.connect('gpl_license', "http://www.gnu.org/licenses/gpl.html", _static=True)
#ADMIN REPOSITORY REST ROUTES
diff --git a/rhodecode/controllers/admin/repos.py b/rhodecode/controllers/admin/repos.py
--- a/rhodecode/controllers/admin/repos.py
+++ b/rhodecode/controllers/admin/repos.py
@@ -48,22 +48,22 @@ class ReposController(BaseController):
# To properly map this controller, ensure your config/routing.py
# file has a resource setup:
# map.resource('repo', 'repos')
-
+
@LoginRequired()
@HasPermissionAnyDecorator('hg.admin', 'hg.create.repository')
def __before__(self):
c.admin_user = session.get('admin_user')
c.admin_username = session.get('admin_username')
super(ReposController, self).__before__()
-
- @HasPermissionAllDecorator('hg.admin')
+
+ @HasPermissionAllDecorator('hg.admin')
def index(self, format='html'):
"""GET /repos: All items in the collection"""
# url('repos')
cached_repo_list = HgModel().get_repos()
c.repos_list = sorted(cached_repo_list, key=itemgetter('name_sort'))
return render('admin/repos/repos.html')
-
+
@HasPermissionAnyDecorator('hg.admin', 'hg.create.repository')
def create(self):
"""POST /repos: Create a new item"""
@@ -83,22 +83,22 @@ class ReposController(BaseController):
form_result['repo_name'], '', self.sa)
else:
action_logger(self.rhodecode_user, 'admin_created_repo',
- form_result['repo_name'], '', self.sa)
-
+ form_result['repo_name'], '', self.sa)
+
except formencode.Invalid, errors:
c.new_repo = errors.value['repo_name']
-
+
if request.POST.get('user_created'):
r = render('admin/repos/repo_add_create_repository.html')
- else:
+ else:
r = render('admin/repos/repo_add.html')
-
+
return htmlfill.render(
r,
defaults=errors.value,
errors=errors.error_dict or {},
prefix_error=False,
- encoding="UTF-8")
+ encoding="UTF-8")
except Exception:
log.error(traceback.format_exc())
@@ -106,9 +106,9 @@ class ReposController(BaseController):
% form_result.get('repo_name')
h.flash(msg, category='error')
if request.POST.get('user_created'):
- return redirect(url('hg_home'))
+ return redirect(url('home'))
return redirect(url('repos'))
-
+
@HasPermissionAllDecorator('hg.admin')
def new(self, format='html'):
"""GET /repos/new: Form to create a new item"""
@@ -116,7 +116,7 @@ class ReposController(BaseController):
c.new_repo = h.repo_name_slug(new_repo)
return render('admin/repos/repo_add.html')
-
+
@HasPermissionAllDecorator('hg.admin')
def update(self, repo_name):
"""PUT /repos/repo_name: Update an existing item"""
@@ -129,7 +129,7 @@ class ReposController(BaseController):
repo_model = RepoModel()
changed_name = repo_name
_form = RepoForm(edit=True, old_data={'repo_name':repo_name})()
-
+
try:
form_result = _form.to_python(dict(request.POST))
repo_model.update(repo_name, form_result)
@@ -147,14 +147,14 @@ class ReposController(BaseController):
errors=errors.error_dict or {},
prefix_error=False,
encoding="UTF-8")
-
+
except Exception:
log.error(traceback.format_exc())
h.flash(_('error occured during update of repository %s') \
% repo_name, category='error')
-
+
return redirect(url('edit_repo', repo_name=changed_name))
-
+
@HasPermissionAllDecorator('hg.admin')
def delete(self, repo_name):
"""DELETE /repos/repo_name: Delete an existing item"""
@@ -164,65 +164,65 @@ class ReposController(BaseController):
# h.form(url('repo', repo_name=ID),
# method='delete')
# url('repo', repo_name=ID)
-
+
repo_model = RepoModel()
repo = repo_model.get(repo_name)
if not repo:
- h.flash(_('%s repository is not mapped to db perhaps'
+ h.flash(_('%s repository is not mapped to db perhaps'
' it was moved or renamed from the filesystem'
' please run the application again'
' in order to rescan repositories') % repo_name,
category='error')
-
+
return redirect(url('repos'))
try:
action_logger(self.rhodecode_user, 'admin_deleted_repo',
repo_name, '', self.sa)
- repo_model.delete(repo)
+ repo_model.delete(repo)
invalidate_cache('cached_repo_list')
h.flash(_('deleted repository %s') % repo_name, category='success')
-
+
except Exception, e:
log.error(traceback.format_exc())
h.flash(_('An error occured during deletion of %s') % repo_name,
category='error')
-
+
return redirect(url('repos'))
-
- @HasPermissionAllDecorator('hg.admin')
+
+ @HasPermissionAllDecorator('hg.admin')
def delete_perm_user(self, repo_name):
"""
DELETE an existing repository permission user
:param repo_name:
"""
-
+
try:
repo_model = RepoModel()
- repo_model.delete_perm_user(request.POST, repo_name)
+ repo_model.delete_perm_user(request.POST, repo_name)
except Exception, e:
h.flash(_('An error occured during deletion of repository user'),
category='error')
raise HTTPInternalServerError()
-
- @HasPermissionAllDecorator('hg.admin')
+
+ @HasPermissionAllDecorator('hg.admin')
def show(self, repo_name, format='html'):
"""GET /repos/repo_name: Show a specific item"""
# url('repo', repo_name=ID)
-
- @HasPermissionAllDecorator('hg.admin')
+
+ @HasPermissionAllDecorator('hg.admin')
def edit(self, repo_name, format='html'):
"""GET /repos/repo_name/edit: Form to edit an existing item"""
# url('edit_repo', repo_name=ID)
repo_model = RepoModel()
c.repo_info = repo = repo_model.get(repo_name)
if not repo:
- h.flash(_('%s repository is not mapped to db perhaps'
+ h.flash(_('%s repository is not mapped to db perhaps'
' it was created or renamed from the filesystem'
' please run the application again'
' in order to rescan repositories') % repo_name,
category='error')
-
- return redirect(url('repos'))
+
+ return redirect(url('repos'))
defaults = c.repo_info.__dict__
if c.repo_info.user:
defaults.update({'user':c.repo_info.user.username})
@@ -230,16 +230,16 @@ class ReposController(BaseController):
replacement_user = self.sa.query(User)\
.filter(User.admin == True).first().username
defaults.update({'user':replacement_user})
-
+
c.users_array = repo_model.get_users_js()
-
+
for p in c.repo_info.repo_to_perm:
- defaults.update({'perm_%s' % p.user.username:
+ defaults.update({'perm_%s' % p.user.username:
p.permission.permission_name})
-
+
return htmlfill.render(
render('admin/repos/repo_edit.html'),
defaults=defaults,
encoding="UTF-8",
force_defaults=False
- )
+ )
diff --git a/rhodecode/controllers/changelog.py b/rhodecode/controllers/changelog.py
--- a/rhodecode/controllers/changelog.py
+++ b/rhodecode/controllers/changelog.py
@@ -38,13 +38,13 @@ import logging
log = logging.getLogger(__name__)
class ChangelogController(BaseController):
-
+
@LoginRequired()
@HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
- 'repository.admin')
+ 'repository.admin')
def __before__(self):
super(ChangelogController, self).__before__()
-
+
def index(self):
limit = 100
default = 20
@@ -53,7 +53,7 @@ class ChangelogController(BaseController
int_size = int(request.params.get('size'))
except ValueError:
int_size = default
- int_size = int_size if int_size <= limit else limit
+ int_size = int_size if int_size <= limit else limit
c.size = int_size
session['changelog_size'] = c.size
session.save()
@@ -61,35 +61,37 @@ class ChangelogController(BaseController
c.size = int(session.get('changelog_size', default))
changesets = HgModel().get_repo(c.repo_name)
-
+
p = int(request.params.get('page', 1))
c.total_cs = len(changesets)
c.pagination = Page(changesets, page=p, item_count=c.total_cs,
items_per_page=c.size)
-
+
self._graph(changesets, c.size, p)
-
+
return render('changelog/changelog.html')
def _graph(self, repo, size, p):
revcount = size
if not repo.revisions:return json.dumps([]), 0
-
+
max_rev = repo.revisions[-1]
+
offset = 1 if p == 1 else ((p - 1) * revcount + 1)
+
rev_start = repo.revisions[(-1 * offset)]
-
+
revcount = min(max_rev, revcount)
rev_end = max(0, rev_start - revcount)
dag = graph_rev(repo.repo, rev_start, rev_end)
-
+
c.dag = tree = list(colored(dag))
data = []
for (id, type, ctx, vtx, edges) in tree:
if type != CHANGESET:
continue
data.append(('', vtx, edges))
-
- c.jsdata = json.dumps(data)
+ c.jsdata = json.dumps(data)
+
diff --git a/rhodecode/controllers/changeset.py b/rhodecode/controllers/changeset.py
--- a/rhodecode/controllers/changeset.py
+++ b/rhodecode/controllers/changeset.py
@@ -37,44 +37,44 @@ import traceback
log = logging.getLogger(__name__)
class ChangesetController(BaseController):
-
+
@LoginRequired()
@HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
- 'repository.admin')
+ 'repository.admin')
def __before__(self):
super(ChangesetController, self).__before__()
-
+
def index(self, revision):
hg_model = HgModel()
cut_off_limit = 1024 * 250
-
+
def wrap_to_table(str):
-
+
return '''
''' % str
-
+
try:
c.changeset = hg_model.get_repo(c.repo_name).get_changeset(revision)
except RepositoryError:
log.error(traceback.format_exc())
- return redirect(url('hg_home'))
+ return redirect(url('home'))
else:
try:
c.changeset_old = c.changeset.parents[0]
except IndexError:
c.changeset_old = None
c.changes = []
-
+
#===================================================================
# ADDED FILES
#===================================================================
c.sum_added = 0
for node in c.changeset.added:
-
+
filenode_old = FileNode(node.path, '', EmptyChangeset())
if filenode_old.is_binary or node.is_binary:
diff = wrap_to_table(_('binary file'))
@@ -83,29 +83,29 @@ class ChangesetController(BaseController
if c.sum_added < cut_off_limit:
f_udiff = differ.get_udiff(filenode_old, node)
diff = differ.DiffProcessor(f_udiff).as_html()
-
+
else:
diff = wrap_to_table(_('Changeset is to big and was cut'
' off, see raw changeset instead'))
-
+
cs1 = None
- cs2 = node.last_changeset.short_id
+ cs2 = node.last_changeset.raw_id
c.changes.append(('added', node, diff, cs1, cs2))
-
+
#===================================================================
# CHANGED FILES
#===================================================================
- c.sum_removed = 0
+ c.sum_removed = 0
for node in c.changeset.changed:
try:
filenode_old = c.changeset_old.get_node(node.path)
except ChangesetError:
filenode_old = FileNode(node.path, '', EmptyChangeset())
-
+
if filenode_old.is_binary or node.is_binary:
diff = wrap_to_table(_('binary file'))
else:
-
+
if c.sum_removed < cut_off_limit:
f_udiff = differ.get_udiff(filenode_old, node)
diff = differ.DiffProcessor(f_udiff).as_html()
@@ -114,68 +114,68 @@ class ChangesetController(BaseController
else:
diff = wrap_to_table(_('Changeset is to big and was cut'
' off, see raw changeset instead'))
-
-
- cs1 = filenode_old.last_changeset.short_id
- cs2 = node.last_changeset.short_id
+
+
+ cs1 = filenode_old.last_changeset.raw_id
+ cs2 = node.last_changeset.raw_id
c.changes.append(('changed', node, diff, cs1, cs2))
-
+
#===================================================================
# REMOVED FILES
#===================================================================
for node in c.changeset.removed:
- c.changes.append(('removed', node, None, None, None))
-
+ c.changes.append(('removed', node, None, None, None))
+
return render('changeset/changeset.html')
def raw_changeset(self, revision):
-
+
hg_model = HgModel()
method = request.GET.get('diff', 'show')
try:
c.changeset = hg_model.get_repo(c.repo_name).get_changeset(revision)
except RepositoryError:
log.error(traceback.format_exc())
- return redirect(url('hg_home'))
+ return redirect(url('home'))
else:
try:
c.changeset_old = c.changeset.parents[0]
except IndexError:
c.changeset_old = None
c.changes = []
-
+
for node in c.changeset.added:
filenode_old = FileNode(node.path, '')
if filenode_old.is_binary or node.is_binary:
diff = _('binary file')
- else:
+ else:
f_udiff = differ.get_udiff(filenode_old, node)
diff = differ.DiffProcessor(f_udiff).raw_diff()
cs1 = None
- cs2 = node.last_changeset.short_id
+ cs2 = node.last_changeset.raw_id
c.changes.append(('added', node, diff, cs1, cs2))
-
+
for node in c.changeset.changed:
filenode_old = c.changeset_old.get_node(node.path)
if filenode_old.is_binary or node.is_binary:
diff = _('binary file')
- else:
+ else:
f_udiff = differ.get_udiff(filenode_old, node)
diff = differ.DiffProcessor(f_udiff).raw_diff()
- cs1 = filenode_old.last_changeset.short_id
- cs2 = node.last_changeset.short_id
- c.changes.append(('changed', node, diff, cs1, cs2))
-
+ cs1 = filenode_old.last_changeset.raw_id
+ cs2 = node.last_changeset.raw_id
+ c.changes.append(('changed', node, diff, cs1, cs2))
+
response.content_type = 'text/plain'
if method == 'download':
- response.content_disposition = 'attachment; filename=%s.patch' % revision
+ response.content_disposition = 'attachment; filename=%s.patch' % revision
parent = True if len(c.changeset.parents) > 0 else False
c.parent_tmpl = 'Parent %s' % c.changeset.parents[0].raw_id if parent else ''
-
+
c.diffs = ''
for x in c.changes:
c.diffs += x[2]
-
+
return render('changeset/raw_changeset.html')
diff --git a/rhodecode/controllers/feed.py b/rhodecode/controllers/feed.py
--- a/rhodecode/controllers/feed.py
+++ b/rhodecode/controllers/feed.py
@@ -54,7 +54,7 @@ class FeedController(BaseController):
for cs in changesets[:self.feed_nr]:
feed.add_item(title=cs.message,
link=url('changeset_home', repo_name=repo_name,
- revision=cs.short_id, qualified=True),
+ revision=cs.raw_id, qualified=True),
description=str(cs.date))
response.content_type = feed.mime_type
@@ -73,7 +73,7 @@ class FeedController(BaseController):
for cs in changesets[:self.feed_nr]:
feed.add_item(title=cs.message,
link=url('changeset_home', repo_name=repo_name,
- revision=cs.short_id, qualified=True),
+ revision=cs.raw_id, qualified=True),
description=str(cs.date))
response.content_type = feed.mime_type
diff --git a/rhodecode/controllers/files.py b/rhodecode/controllers/files.py
--- a/rhodecode/controllers/files.py
+++ b/rhodecode/controllers/files.py
@@ -36,14 +36,14 @@ from vcs.utils import diffs as differ
import logging
import rhodecode.lib.helpers as h
import tempfile
-
+
log = logging.getLogger(__name__)
class FilesController(BaseController):
-
+
@LoginRequired()
@HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
- 'repository.admin')
+ 'repository.admin')
def __before__(self):
super(FilesController, self).__before__()
c.file_size_limit = 250 * 1024 #limit of file size to display
@@ -52,41 +52,41 @@ class FilesController(BaseController):
hg_model = HgModel()
c.repo = repo = hg_model.get_repo(c.repo_name)
revision = request.POST.get('at_rev', None) or revision
-
+
def get_next_rev(cur):
max_rev = len(c.repo.revisions) - 1
r = cur + 1
if r > max_rev:
r = max_rev
return r
-
+
def get_prev_rev(cur):
r = cur - 1
return r
c.f_path = f_path
-
-
+
+
try:
cur_rev = repo.get_changeset(revision).revision
- prev_rev = repo.get_changeset(get_prev_rev(cur_rev)).short_id
- next_rev = repo.get_changeset(get_next_rev(cur_rev)).short_id
-
+ prev_rev = repo.get_changeset(get_prev_rev(cur_rev)).raw_id
+ next_rev = repo.get_changeset(get_next_rev(cur_rev)).raw_id
+
c.url_prev = url('files_home', repo_name=c.repo_name,
- revision=prev_rev, f_path=f_path)
+ revision=prev_rev, f_path=f_path)
c.url_next = url('files_home', repo_name=c.repo_name,
- revision=next_rev, f_path=f_path)
-
+ revision=next_rev, f_path=f_path)
+
c.changeset = repo.get_changeset(revision)
-
- c.cur_rev = c.changeset.short_id
+
+ c.cur_rev = c.changeset.raw_id
c.rev_nr = c.changeset.revision
c.files_list = c.changeset.get_node(f_path)
c.file_history = self._get_history(repo, c.files_list, f_path)
-
+
except (RepositoryError, ChangesetError):
c.files_list = None
-
+
return render('files/files.html')
def rawfile(self, repo_name, revision, f_path):
@@ -95,7 +95,7 @@ class FilesController(BaseController):
file_node = c.repo.get_changeset(revision).get_node(f_path)
response.content_type = file_node.mimetype
response.content_disposition = 'attachment; filename=%s' \
- % f_path.split('/')[-1]
+ % f_path.split('/')[-1]
return file_node.content
def raw(self, repo_name, revision, f_path):
@@ -103,21 +103,21 @@ class FilesController(BaseController):
c.repo = hg_model.get_repo(c.repo_name)
file_node = c.repo.get_changeset(revision).get_node(f_path)
response.content_type = 'text/plain'
-
+
return file_node.content
-
+
def annotate(self, repo_name, revision, f_path):
hg_model = HgModel()
c.repo = hg_model.get_repo(c.repo_name)
cs = c.repo.get_changeset(revision)
c.file = cs.get_node(f_path)
c.file_msg = cs.get_file_message(f_path)
- c.cur_rev = cs.short_id
- c.rev_nr = cs.revision
+ c.cur_rev = cs.raw_id
+ c.rev_nr = cs.revision
c.f_path = f_path
return render('files/files_annotate.html')
-
+
def archivefile(self, repo_name, revision, fileformat):
archive_specs = {
'.tar.bz2': ('application/x-tar', 'tbz2'),
@@ -126,7 +126,7 @@ class FilesController(BaseController):
}
if not archive_specs.has_key(fileformat):
return 'Unknown archive type %s' % fileformat
-
+
def read_in_chunks(file_object, chunk_size=1024 * 40):
"""Lazy function (generator) to read a file piece by piece.
Default chunk size: 40k."""
@@ -134,8 +134,8 @@ class FilesController(BaseController):
data = file_object.read(chunk_size)
if not data:
break
- yield data
-
+ yield data
+
archive = tempfile.TemporaryFile()
repo = HgModel().get_repo(repo_name).repo
fname = '%s-%s%s' % (repo_name, revision, fileformat)
@@ -145,7 +145,7 @@ class FilesController(BaseController):
response.content_disposition = 'attachment; filename=%s' % fname
archive.seek(0)
return read_in_chunks(archive)
-
+
def diff(self, repo_name, f_path):
hg_model = HgModel()
diff1 = request.GET.get('diff1')
@@ -162,7 +162,7 @@ class FilesController(BaseController):
else:
c.changeset_1 = EmptyChangeset()
node1 = FileNode('.', '', changeset=c.changeset_1)
-
+
if diff2 not in ['', None, 'None', '0' * 12, '0' * 40]:
c.changeset_2 = c.repo.get_changeset(diff2)
node2 = c.changeset_2.get_node(f_path)
@@ -173,19 +173,16 @@ class FilesController(BaseController):
return redirect(url('files_home',
repo_name=c.repo_name, f_path=f_path))
- c.diff1 = 'r%s:%s' % (c.changeset_1.revision, c.changeset_1.short_id)
- c.diff2 = 'r%s:%s' % (c.changeset_2.revision, c.changeset_2.short_id)
-
f_udiff = differ.get_udiff(node1, node2)
diff = differ.DiffProcessor(f_udiff)
-
+
if c.action == 'download':
diff_name = '%s_vs_%s.diff' % (diff1, diff2)
response.content_type = 'text/plain'
response.content_disposition = 'attachment; filename=%s' \
- % diff_name
+ % diff_name
return diff.raw_diff()
-
+
elif c.action == 'raw':
c.cur_diff = '%s
' % h.escape(diff.raw_diff())
elif c.action == 'diff':
@@ -199,10 +196,10 @@ class FilesController(BaseController):
c.cur_diff = _('Diff is to big to display')
else:
c.cur_diff = diff.as_html()
-
- if not c.cur_diff: c.no_changes = True
+
+ if not c.cur_diff: c.no_changes = True
return render('files/file_diff.html')
-
+
def _get_history(self, repo, node, f_path):
from vcs.nodes import NodeKind
if not node.kind is NodeKind.FILE:
@@ -211,5 +208,5 @@ class FilesController(BaseController):
hist_l = []
for chs in changesets:
n_desc = 'r%s:%s' % (chs.revision, chs.short_id)
- hist_l.append((chs.short_id, n_desc,))
+ hist_l.append((chs.raw_id, n_desc,))
return hist_l
diff --git a/rhodecode/controllers/hg.py b/rhodecode/controllers/home.py
rename from rhodecode/controllers/hg.py
rename to rhodecode/controllers/home.py
--- a/rhodecode/controllers/hg.py
+++ b/rhodecode/controllers/home.py
@@ -30,17 +30,17 @@ from rhodecode.model.hg import HgModel
import logging
log = logging.getLogger(__name__)
-class HgController(BaseController):
+class HomeController(BaseController):
@LoginRequired()
def __before__(self):
- super(HgController, self).__before__()
-
+ super(HomeController, self).__before__()
+
def index(self):
sortables = ['name', 'description', 'last_change', 'tip', 'contact']
current_sort = request.GET.get('sort', 'name')
current_sort_slug = current_sort.replace('-', '')
-
+
if current_sort_slug not in sortables:
c.sort_by = 'name'
current_sort_slug = c.sort_by
@@ -48,11 +48,11 @@ class HgController(BaseController):
c.sort_by = current_sort
c.sort_slug = current_sort_slug
cached_repo_list = HgModel().get_repos()
-
+
sort_key = current_sort_slug + '_sort'
if c.sort_by.startswith('-'):
c.repos_list = sorted(cached_repo_list, key=itemgetter(sort_key), reverse=True)
else:
c.repos_list = sorted(cached_repo_list, key=itemgetter(sort_key), reverse=False)
-
+
return render('/index.html')
diff --git a/rhodecode/controllers/login.py b/rhodecode/controllers/login.py
--- a/rhodecode/controllers/login.py
+++ b/rhodecode/controllers/login.py
@@ -28,7 +28,7 @@ from pylons import request, response, se
from pylons.controllers.util import abort, redirect
from rhodecode.lib.auth import AuthUser, HasPermissionAnyDecorator
from rhodecode.lib.base import BaseController, render
-import rhodecode.lib.helpers as h
+import rhodecode.lib.helpers as h
from pylons.i18n.translation import _
from rhodecode.model.forms import LoginForm, RegisterForm, PasswordResetForm
from rhodecode.model.user import UserModel
@@ -45,10 +45,10 @@ class LoginController(BaseController):
def index(self):
#redirect if already logged in
c.came_from = request.GET.get('came_from', None)
-
+
if c.rhodecode_user.is_authenticated:
- return redirect(url('hg_home'))
-
+ return redirect(url('home'))
+
if request.POST:
#import Login Form validator class
login_form = LoginForm()
@@ -66,14 +66,14 @@ class LoginController(BaseController):
session['rhodecode_user'] = auth_user
session.save()
log.info('user %s is now authenticated', username)
-
+
user.update_lastlogin()
-
+
if c.came_from:
return redirect(c.came_from)
else:
- return redirect(url('hg_home'))
-
+ return redirect(url('home'))
+
except formencode.Invalid, errors:
return htmlfill.render(
render('/login.html'),
@@ -81,9 +81,9 @@ class LoginController(BaseController):
errors=errors.error_dict or {},
prefix_error=False,
encoding="UTF-8")
-
+
return render('/login.html')
-
+
@HasPermissionAnyDecorator('hg.admin', 'hg.register.auto_activate',
'hg.register.manual_activate')
def register(self):
@@ -93,18 +93,18 @@ class LoginController(BaseController):
if perm.permission.permission_name == 'hg.register.auto_activate':
c.auto_active = True
break
-
+
if request.POST:
-
+
register_form = RegisterForm()()
try:
form_result = register_form.to_python(dict(request.POST))
form_result['active'] = c.auto_active
user_model.create_registration(form_result)
h.flash(_('You have successfully registered into rhodecode'),
- category='success')
+ category='success')
return redirect(url('login_home'))
-
+
except formencode.Invalid, errors:
return htmlfill.render(
render('/register.html'),
@@ -112,21 +112,21 @@ class LoginController(BaseController):
errors=errors.error_dict or {},
prefix_error=False,
encoding="UTF-8")
-
+
return render('/register.html')
def password_reset(self):
user_model = UserModel()
if request.POST:
-
+
password_reset_form = PasswordResetForm()()
try:
form_result = password_reset_form.to_python(dict(request.POST))
user_model.reset_password(form_result)
h.flash(_('Your new password was sent'),
- category='success')
+ category='success')
return redirect(url('login_home'))
-
+
except formencode.Invalid, errors:
return htmlfill.render(
render('/password_reset.html'),
@@ -134,11 +134,11 @@ class LoginController(BaseController):
errors=errors.error_dict or {},
prefix_error=False,
encoding="UTF-8")
-
+
return render('/password_reset.html')
-
+
def logout(self):
session['rhodecode_user'] = AuthUser()
session.save()
log.info('Logging out and setting user as Empty')
- redirect(url('hg_home'))
+ redirect(url('home'))
diff --git a/rhodecode/controllers/settings.py b/rhodecode/controllers/settings.py
--- a/rhodecode/controllers/settings.py
+++ b/rhodecode/controllers/settings.py
@@ -41,35 +41,35 @@ log = logging.getLogger(__name__)
class SettingsController(BaseController):
@LoginRequired()
- @HasRepoPermissionAllDecorator('repository.admin')
+ @HasRepoPermissionAllDecorator('repository.admin')
def __before__(self):
super(SettingsController, self).__before__()
-
+
def index(self, repo_name):
repo_model = RepoModel()
c.repo_info = repo = repo_model.get(repo_name)
if not repo:
- h.flash(_('%s repository is not mapped to db perhaps'
+ h.flash(_('%s repository is not mapped to db perhaps'
' it was created or renamed from the filesystem'
' please run the application again'
' in order to rescan repositories') % repo_name,
category='error')
-
- return redirect(url('hg_home'))
+
+ return redirect(url('home'))
defaults = c.repo_info.__dict__
defaults.update({'user':c.repo_info.user.username})
c.users_array = repo_model.get_users_js()
-
+
for p in c.repo_info.repo_to_perm:
- defaults.update({'perm_%s' % p.user.username:
+ defaults.update({'perm_%s' % p.user.username:
p.permission.permission_name})
-
+
return htmlfill.render(
render('settings/repo_settings.html'),
defaults=defaults,
encoding="UTF-8",
force_defaults=False
- )
+ )
def update(self, repo_name):
repo_model = RepoModel()
@@ -81,7 +81,7 @@ class SettingsController(BaseController)
invalidate_cache('cached_repo_list')
h.flash(_('Repository %s updated successfully' % repo_name),
category='success')
- changed_name = form_result['repo_name']
+ changed_name = form_result['repo_name']
except formencode.Invalid, errors:
c.repo_info = repo_model.get(repo_name)
c.users_array = repo_model.get_users_js()
@@ -91,17 +91,17 @@ class SettingsController(BaseController)
defaults=errors.value,
errors=errors.error_dict or {},
prefix_error=False,
- encoding="UTF-8")
+ encoding="UTF-8")
except Exception:
log.error(traceback.format_exc())
h.flash(_('error occured during update of repository %s') \
% repo_name, category='error')
-
+
return redirect(url('repo_settings_home', repo_name=changed_name))
- def delete(self, repo_name):
+ def delete(self, repo_name):
"""DELETE /repos/repo_name: Delete an existing item"""
# Forms posted to this method should contain a hidden field:
#
@@ -109,45 +109,45 @@ class SettingsController(BaseController)
# h.form(url('repo_settings_delete', repo_name=ID),
# method='delete')
# url('repo_settings_delete', repo_name=ID)
-
+
repo_model = RepoModel()
repo = repo_model.get(repo_name)
if not repo:
- h.flash(_('%s repository is not mapped to db perhaps'
+ h.flash(_('%s repository is not mapped to db perhaps'
' it was moved or renamed from the filesystem'
' please run the application again'
' in order to rescan repositories') % repo_name,
category='error')
-
- return redirect(url('hg_home'))
+
+ return redirect(url('home'))
try:
action_logger(self.rhodecode_user, 'user_deleted_repo',
- repo_name, '', self.sa)
- repo_model.delete(repo)
+ repo_name, '', self.sa)
+ repo_model.delete(repo)
invalidate_cache('cached_repo_list')
h.flash(_('deleted repository %s') % repo_name, category='success')
except Exception:
h.flash(_('An error occurred during deletion of %s') % repo_name,
category='error')
-
- return redirect(url('hg_home'))
-
+
+ return redirect(url('home'))
+
def fork(self, repo_name):
repo_model = RepoModel()
c.repo_info = repo = repo_model.get(repo_name)
if not repo:
- h.flash(_('%s repository is not mapped to db perhaps'
+ h.flash(_('%s repository is not mapped to db perhaps'
' it was created or renamed from the filesystem'
' please run the application again'
' in order to rescan repositories') % repo_name,
category='error')
-
- return redirect(url('hg_home'))
-
+
+ return redirect(url('home'))
+
return render('settings/repo_fork.html')
-
-
-
+
+
+
def fork_create(self, repo_name):
repo_model = RepoModel()
c.repo_info = repo_model.get(repo_name)
@@ -161,15 +161,15 @@ class SettingsController(BaseController)
% (repo_name, form_result['fork_name']),
category='success')
action_logger(self.rhodecode_user, 'user_forked_repo',
- repo_name, '', self.sa)
+ repo_name, '', self.sa)
except formencode.Invalid, errors:
c.new_repo = errors.value['fork_name']
r = render('settings/repo_fork.html')
-
+
return htmlfill.render(
r,
defaults=errors.value,
errors=errors.error_dict or {},
prefix_error=False,
- encoding="UTF-8")
- return redirect(url('hg_home'))
+ encoding="UTF-8")
+ return redirect(url('home'))
diff --git a/rhodecode/lib/helpers.py b/rhodecode/lib/helpers.py
--- a/rhodecode/lib/helpers.py
+++ b/rhodecode/lib/helpers.py
@@ -272,12 +272,12 @@ def pygmentize_annotation(filenode, **kw
changeset.date,
tooltip(changeset.message))
lnk_format = 'r%-5s:%s' % (changeset.revision,
- changeset.short_id)
+ changeset.raw_id)
uri = link_to(
lnk_format,
url('changeset_home', repo_name=changeset.repository.name,
- revision=changeset.short_id),
- style=get_color_string(changeset.short_id),
+ revision=changeset.raw_id),
+ style=get_color_string(changeset.raw_id),
class_='tooltip',
tooltip_title=tooltip_html
)
@@ -352,6 +352,7 @@ capitalize = lambda x: x.capitalize()
email = util.email
email_or_none = lambda x: util.email(x) if util.email(x) != x else None
person = lambda x: _person(x)
+short_id = lambda x: x[:12]
#==============================================================================
# PERMS
diff --git a/rhodecode/lib/utils.py b/rhodecode/lib/utils.py
--- a/rhodecode/lib/utils.py
+++ b/rhodecode/lib/utils.py
@@ -303,6 +303,7 @@ class EmptyChangeset(BaseChangeset):
message = ''
author = ''
date = ''
+
@LazyProperty
def raw_id(self):
"""
diff --git a/rhodecode/model/hg.py b/rhodecode/model/hg.py
--- a/rhodecode/model/hg.py
+++ b/rhodecode/model/hg.py
@@ -158,7 +158,7 @@ class HgModel(object):
tmp_d['description_sort'] = tmp_d['description']
tmp_d['last_change'] = last_change
tmp_d['last_change_sort'] = time.mktime(last_change.timetuple())
- tmp_d['tip'] = tip.short_id
+ tmp_d['tip'] = tip.raw_id
tmp_d['tip_sort'] = tip.revision
tmp_d['rev'] = tip.revision
tmp_d['contact'] = repo.contact
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
@@ -1701,6 +1701,7 @@ font:100% sans-serif;
width:auto;
opacity:1px;
padding:8px;
+white-space: pre;
}
.ac {
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
@@ -31,7 +31,7 @@