##// END OF EJS Templates
Fixes for raw_id, needed for git...
marcink -
r636:ffd07396 beta
parent child Browse files
Show More
@@ -35,7 +35,7 b' def make_map(config):'
35 #==========================================================================
35 #==========================================================================
36
36
37 #MAIN PAGE
37 #MAIN PAGE
38 map.connect('hg_home', '/', controller='hg', action='index')
38 map.connect('home', '/', controller='home', action='index')
39 map.connect('bugtracker', "http://bitbucket.org/marcinkuzminski/rhodecode/issues", _static=True)
39 map.connect('bugtracker', "http://bitbucket.org/marcinkuzminski/rhodecode/issues", _static=True)
40 map.connect('gpl_license', "http://www.gnu.org/licenses/gpl.html", _static=True)
40 map.connect('gpl_license', "http://www.gnu.org/licenses/gpl.html", _static=True)
41 #ADMIN REPOSITORY REST ROUTES
41 #ADMIN REPOSITORY REST ROUTES
@@ -48,22 +48,22 b' class ReposController(BaseController):'
48 # To properly map this controller, ensure your config/routing.py
48 # To properly map this controller, ensure your config/routing.py
49 # file has a resource setup:
49 # file has a resource setup:
50 # map.resource('repo', 'repos')
50 # map.resource('repo', 'repos')
51
51
52 @LoginRequired()
52 @LoginRequired()
53 @HasPermissionAnyDecorator('hg.admin', 'hg.create.repository')
53 @HasPermissionAnyDecorator('hg.admin', 'hg.create.repository')
54 def __before__(self):
54 def __before__(self):
55 c.admin_user = session.get('admin_user')
55 c.admin_user = session.get('admin_user')
56 c.admin_username = session.get('admin_username')
56 c.admin_username = session.get('admin_username')
57 super(ReposController, self).__before__()
57 super(ReposController, self).__before__()
58
58
59 @HasPermissionAllDecorator('hg.admin')
59 @HasPermissionAllDecorator('hg.admin')
60 def index(self, format='html'):
60 def index(self, format='html'):
61 """GET /repos: All items in the collection"""
61 """GET /repos: All items in the collection"""
62 # url('repos')
62 # url('repos')
63 cached_repo_list = HgModel().get_repos()
63 cached_repo_list = HgModel().get_repos()
64 c.repos_list = sorted(cached_repo_list, key=itemgetter('name_sort'))
64 c.repos_list = sorted(cached_repo_list, key=itemgetter('name_sort'))
65 return render('admin/repos/repos.html')
65 return render('admin/repos/repos.html')
66
66
67 @HasPermissionAnyDecorator('hg.admin', 'hg.create.repository')
67 @HasPermissionAnyDecorator('hg.admin', 'hg.create.repository')
68 def create(self):
68 def create(self):
69 """POST /repos: Create a new item"""
69 """POST /repos: Create a new item"""
@@ -83,22 +83,22 b' class ReposController(BaseController):'
83 form_result['repo_name'], '', self.sa)
83 form_result['repo_name'], '', self.sa)
84 else:
84 else:
85 action_logger(self.rhodecode_user, 'admin_created_repo',
85 action_logger(self.rhodecode_user, 'admin_created_repo',
86 form_result['repo_name'], '', self.sa)
86 form_result['repo_name'], '', self.sa)
87
87
88 except formencode.Invalid, errors:
88 except formencode.Invalid, errors:
89 c.new_repo = errors.value['repo_name']
89 c.new_repo = errors.value['repo_name']
90
90
91 if request.POST.get('user_created'):
91 if request.POST.get('user_created'):
92 r = render('admin/repos/repo_add_create_repository.html')
92 r = render('admin/repos/repo_add_create_repository.html')
93 else:
93 else:
94 r = render('admin/repos/repo_add.html')
94 r = render('admin/repos/repo_add.html')
95
95
96 return htmlfill.render(
96 return htmlfill.render(
97 r,
97 r,
98 defaults=errors.value,
98 defaults=errors.value,
99 errors=errors.error_dict or {},
99 errors=errors.error_dict or {},
100 prefix_error=False,
100 prefix_error=False,
101 encoding="UTF-8")
101 encoding="UTF-8")
102
102
103 except Exception:
103 except Exception:
104 log.error(traceback.format_exc())
104 log.error(traceback.format_exc())
@@ -106,9 +106,9 b' class ReposController(BaseController):'
106 % form_result.get('repo_name')
106 % form_result.get('repo_name')
107 h.flash(msg, category='error')
107 h.flash(msg, category='error')
108 if request.POST.get('user_created'):
108 if request.POST.get('user_created'):
109 return redirect(url('hg_home'))
109 return redirect(url('home'))
110 return redirect(url('repos'))
110 return redirect(url('repos'))
111
111
112 @HasPermissionAllDecorator('hg.admin')
112 @HasPermissionAllDecorator('hg.admin')
113 def new(self, format='html'):
113 def new(self, format='html'):
114 """GET /repos/new: Form to create a new item"""
114 """GET /repos/new: Form to create a new item"""
@@ -116,7 +116,7 b' class ReposController(BaseController):'
116 c.new_repo = h.repo_name_slug(new_repo)
116 c.new_repo = h.repo_name_slug(new_repo)
117
117
118 return render('admin/repos/repo_add.html')
118 return render('admin/repos/repo_add.html')
119
119
120 @HasPermissionAllDecorator('hg.admin')
120 @HasPermissionAllDecorator('hg.admin')
121 def update(self, repo_name):
121 def update(self, repo_name):
122 """PUT /repos/repo_name: Update an existing item"""
122 """PUT /repos/repo_name: Update an existing item"""
@@ -129,7 +129,7 b' class ReposController(BaseController):'
129 repo_model = RepoModel()
129 repo_model = RepoModel()
130 changed_name = repo_name
130 changed_name = repo_name
131 _form = RepoForm(edit=True, old_data={'repo_name':repo_name})()
131 _form = RepoForm(edit=True, old_data={'repo_name':repo_name})()
132
132
133 try:
133 try:
134 form_result = _form.to_python(dict(request.POST))
134 form_result = _form.to_python(dict(request.POST))
135 repo_model.update(repo_name, form_result)
135 repo_model.update(repo_name, form_result)
@@ -147,14 +147,14 b' class ReposController(BaseController):'
147 errors=errors.error_dict or {},
147 errors=errors.error_dict or {},
148 prefix_error=False,
148 prefix_error=False,
149 encoding="UTF-8")
149 encoding="UTF-8")
150
150
151 except Exception:
151 except Exception:
152 log.error(traceback.format_exc())
152 log.error(traceback.format_exc())
153 h.flash(_('error occured during update of repository %s') \
153 h.flash(_('error occured during update of repository %s') \
154 % repo_name, category='error')
154 % repo_name, category='error')
155
155
156 return redirect(url('edit_repo', repo_name=changed_name))
156 return redirect(url('edit_repo', repo_name=changed_name))
157
157
158 @HasPermissionAllDecorator('hg.admin')
158 @HasPermissionAllDecorator('hg.admin')
159 def delete(self, repo_name):
159 def delete(self, repo_name):
160 """DELETE /repos/repo_name: Delete an existing item"""
160 """DELETE /repos/repo_name: Delete an existing item"""
@@ -164,65 +164,65 b' class ReposController(BaseController):'
164 # h.form(url('repo', repo_name=ID),
164 # h.form(url('repo', repo_name=ID),
165 # method='delete')
165 # method='delete')
166 # url('repo', repo_name=ID)
166 # url('repo', repo_name=ID)
167
167
168 repo_model = RepoModel()
168 repo_model = RepoModel()
169 repo = repo_model.get(repo_name)
169 repo = repo_model.get(repo_name)
170 if not repo:
170 if not repo:
171 h.flash(_('%s repository is not mapped to db perhaps'
171 h.flash(_('%s repository is not mapped to db perhaps'
172 ' it was moved or renamed from the filesystem'
172 ' it was moved or renamed from the filesystem'
173 ' please run the application again'
173 ' please run the application again'
174 ' in order to rescan repositories') % repo_name,
174 ' in order to rescan repositories') % repo_name,
175 category='error')
175 category='error')
176
176
177 return redirect(url('repos'))
177 return redirect(url('repos'))
178 try:
178 try:
179 action_logger(self.rhodecode_user, 'admin_deleted_repo',
179 action_logger(self.rhodecode_user, 'admin_deleted_repo',
180 repo_name, '', self.sa)
180 repo_name, '', self.sa)
181 repo_model.delete(repo)
181 repo_model.delete(repo)
182 invalidate_cache('cached_repo_list')
182 invalidate_cache('cached_repo_list')
183 h.flash(_('deleted repository %s') % repo_name, category='success')
183 h.flash(_('deleted repository %s') % repo_name, category='success')
184
184
185 except Exception, e:
185 except Exception, e:
186 log.error(traceback.format_exc())
186 log.error(traceback.format_exc())
187 h.flash(_('An error occured during deletion of %s') % repo_name,
187 h.flash(_('An error occured during deletion of %s') % repo_name,
188 category='error')
188 category='error')
189
189
190 return redirect(url('repos'))
190 return redirect(url('repos'))
191
191
192 @HasPermissionAllDecorator('hg.admin')
192 @HasPermissionAllDecorator('hg.admin')
193 def delete_perm_user(self, repo_name):
193 def delete_perm_user(self, repo_name):
194 """
194 """
195 DELETE an existing repository permission user
195 DELETE an existing repository permission user
196 :param repo_name:
196 :param repo_name:
197 """
197 """
198
198
199 try:
199 try:
200 repo_model = RepoModel()
200 repo_model = RepoModel()
201 repo_model.delete_perm_user(request.POST, repo_name)
201 repo_model.delete_perm_user(request.POST, repo_name)
202 except Exception, e:
202 except Exception, e:
203 h.flash(_('An error occured during deletion of repository user'),
203 h.flash(_('An error occured during deletion of repository user'),
204 category='error')
204 category='error')
205 raise HTTPInternalServerError()
205 raise HTTPInternalServerError()
206
206
207 @HasPermissionAllDecorator('hg.admin')
207 @HasPermissionAllDecorator('hg.admin')
208 def show(self, repo_name, format='html'):
208 def show(self, repo_name, format='html'):
209 """GET /repos/repo_name: Show a specific item"""
209 """GET /repos/repo_name: Show a specific item"""
210 # url('repo', repo_name=ID)
210 # url('repo', repo_name=ID)
211
211
212 @HasPermissionAllDecorator('hg.admin')
212 @HasPermissionAllDecorator('hg.admin')
213 def edit(self, repo_name, format='html'):
213 def edit(self, repo_name, format='html'):
214 """GET /repos/repo_name/edit: Form to edit an existing item"""
214 """GET /repos/repo_name/edit: Form to edit an existing item"""
215 # url('edit_repo', repo_name=ID)
215 # url('edit_repo', repo_name=ID)
216 repo_model = RepoModel()
216 repo_model = RepoModel()
217 c.repo_info = repo = repo_model.get(repo_name)
217 c.repo_info = repo = repo_model.get(repo_name)
218 if not repo:
218 if not repo:
219 h.flash(_('%s repository is not mapped to db perhaps'
219 h.flash(_('%s repository is not mapped to db perhaps'
220 ' it was created or renamed from the filesystem'
220 ' it was created or renamed from the filesystem'
221 ' please run the application again'
221 ' please run the application again'
222 ' in order to rescan repositories') % repo_name,
222 ' in order to rescan repositories') % repo_name,
223 category='error')
223 category='error')
224
224
225 return redirect(url('repos'))
225 return redirect(url('repos'))
226 defaults = c.repo_info.__dict__
226 defaults = c.repo_info.__dict__
227 if c.repo_info.user:
227 if c.repo_info.user:
228 defaults.update({'user':c.repo_info.user.username})
228 defaults.update({'user':c.repo_info.user.username})
@@ -230,16 +230,16 b' class ReposController(BaseController):'
230 replacement_user = self.sa.query(User)\
230 replacement_user = self.sa.query(User)\
231 .filter(User.admin == True).first().username
231 .filter(User.admin == True).first().username
232 defaults.update({'user':replacement_user})
232 defaults.update({'user':replacement_user})
233
233
234 c.users_array = repo_model.get_users_js()
234 c.users_array = repo_model.get_users_js()
235
235
236 for p in c.repo_info.repo_to_perm:
236 for p in c.repo_info.repo_to_perm:
237 defaults.update({'perm_%s' % p.user.username:
237 defaults.update({'perm_%s' % p.user.username:
238 p.permission.permission_name})
238 p.permission.permission_name})
239
239
240 return htmlfill.render(
240 return htmlfill.render(
241 render('admin/repos/repo_edit.html'),
241 render('admin/repos/repo_edit.html'),
242 defaults=defaults,
242 defaults=defaults,
243 encoding="UTF-8",
243 encoding="UTF-8",
244 force_defaults=False
244 force_defaults=False
245 )
245 )
@@ -38,13 +38,13 b' import logging'
38 log = logging.getLogger(__name__)
38 log = logging.getLogger(__name__)
39
39
40 class ChangelogController(BaseController):
40 class ChangelogController(BaseController):
41
41
42 @LoginRequired()
42 @LoginRequired()
43 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
43 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
44 'repository.admin')
44 'repository.admin')
45 def __before__(self):
45 def __before__(self):
46 super(ChangelogController, self).__before__()
46 super(ChangelogController, self).__before__()
47
47
48 def index(self):
48 def index(self):
49 limit = 100
49 limit = 100
50 default = 20
50 default = 20
@@ -53,7 +53,7 b' class ChangelogController(BaseController'
53 int_size = int(request.params.get('size'))
53 int_size = int(request.params.get('size'))
54 except ValueError:
54 except ValueError:
55 int_size = default
55 int_size = default
56 int_size = int_size if int_size <= limit else limit
56 int_size = int_size if int_size <= limit else limit
57 c.size = int_size
57 c.size = int_size
58 session['changelog_size'] = c.size
58 session['changelog_size'] = c.size
59 session.save()
59 session.save()
@@ -61,35 +61,37 b' class ChangelogController(BaseController'
61 c.size = int(session.get('changelog_size', default))
61 c.size = int(session.get('changelog_size', default))
62
62
63 changesets = HgModel().get_repo(c.repo_name)
63 changesets = HgModel().get_repo(c.repo_name)
64
64
65 p = int(request.params.get('page', 1))
65 p = int(request.params.get('page', 1))
66 c.total_cs = len(changesets)
66 c.total_cs = len(changesets)
67 c.pagination = Page(changesets, page=p, item_count=c.total_cs,
67 c.pagination = Page(changesets, page=p, item_count=c.total_cs,
68 items_per_page=c.size)
68 items_per_page=c.size)
69
69
70 self._graph(changesets, c.size, p)
70 self._graph(changesets, c.size, p)
71
71
72 return render('changelog/changelog.html')
72 return render('changelog/changelog.html')
73
73
74
74
75 def _graph(self, repo, size, p):
75 def _graph(self, repo, size, p):
76 revcount = size
76 revcount = size
77 if not repo.revisions:return json.dumps([]), 0
77 if not repo.revisions:return json.dumps([]), 0
78
78
79 max_rev = repo.revisions[-1]
79 max_rev = repo.revisions[-1]
80
80 offset = 1 if p == 1 else ((p - 1) * revcount + 1)
81 offset = 1 if p == 1 else ((p - 1) * revcount + 1)
82
81 rev_start = repo.revisions[(-1 * offset)]
83 rev_start = repo.revisions[(-1 * offset)]
82
84
83 revcount = min(max_rev, revcount)
85 revcount = min(max_rev, revcount)
84 rev_end = max(0, rev_start - revcount)
86 rev_end = max(0, rev_start - revcount)
85 dag = graph_rev(repo.repo, rev_start, rev_end)
87 dag = graph_rev(repo.repo, rev_start, rev_end)
86
88
87 c.dag = tree = list(colored(dag))
89 c.dag = tree = list(colored(dag))
88 data = []
90 data = []
89 for (id, type, ctx, vtx, edges) in tree:
91 for (id, type, ctx, vtx, edges) in tree:
90 if type != CHANGESET:
92 if type != CHANGESET:
91 continue
93 continue
92 data.append(('', vtx, edges))
94 data.append(('', vtx, edges))
93
94 c.jsdata = json.dumps(data)
95
95
96 c.jsdata = json.dumps(data)
97
@@ -37,44 +37,44 b' import traceback'
37 log = logging.getLogger(__name__)
37 log = logging.getLogger(__name__)
38
38
39 class ChangesetController(BaseController):
39 class ChangesetController(BaseController):
40
40
41 @LoginRequired()
41 @LoginRequired()
42 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
42 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
43 'repository.admin')
43 'repository.admin')
44 def __before__(self):
44 def __before__(self):
45 super(ChangesetController, self).__before__()
45 super(ChangesetController, self).__before__()
46
46
47 def index(self, revision):
47 def index(self, revision):
48 hg_model = HgModel()
48 hg_model = HgModel()
49 cut_off_limit = 1024 * 250
49 cut_off_limit = 1024 * 250
50
50
51 def wrap_to_table(str):
51 def wrap_to_table(str):
52
52
53 return '''<table class="code-difftable">
53 return '''<table class="code-difftable">
54 <tr class="line">
54 <tr class="line">
55 <td class="lineno new"></td>
55 <td class="lineno new"></td>
56 <td class="code"><pre>%s</pre></td>
56 <td class="code"><pre>%s</pre></td>
57 </tr>
57 </tr>
58 </table>''' % str
58 </table>''' % str
59
59
60 try:
60 try:
61 c.changeset = hg_model.get_repo(c.repo_name).get_changeset(revision)
61 c.changeset = hg_model.get_repo(c.repo_name).get_changeset(revision)
62 except RepositoryError:
62 except RepositoryError:
63 log.error(traceback.format_exc())
63 log.error(traceback.format_exc())
64 return redirect(url('hg_home'))
64 return redirect(url('home'))
65 else:
65 else:
66 try:
66 try:
67 c.changeset_old = c.changeset.parents[0]
67 c.changeset_old = c.changeset.parents[0]
68 except IndexError:
68 except IndexError:
69 c.changeset_old = None
69 c.changeset_old = None
70 c.changes = []
70 c.changes = []
71
71
72 #===================================================================
72 #===================================================================
73 # ADDED FILES
73 # ADDED FILES
74 #===================================================================
74 #===================================================================
75 c.sum_added = 0
75 c.sum_added = 0
76 for node in c.changeset.added:
76 for node in c.changeset.added:
77
77
78 filenode_old = FileNode(node.path, '', EmptyChangeset())
78 filenode_old = FileNode(node.path, '', EmptyChangeset())
79 if filenode_old.is_binary or node.is_binary:
79 if filenode_old.is_binary or node.is_binary:
80 diff = wrap_to_table(_('binary file'))
80 diff = wrap_to_table(_('binary file'))
@@ -83,29 +83,29 b' class ChangesetController(BaseController'
83 if c.sum_added < cut_off_limit:
83 if c.sum_added < cut_off_limit:
84 f_udiff = differ.get_udiff(filenode_old, node)
84 f_udiff = differ.get_udiff(filenode_old, node)
85 diff = differ.DiffProcessor(f_udiff).as_html()
85 diff = differ.DiffProcessor(f_udiff).as_html()
86
86
87 else:
87 else:
88 diff = wrap_to_table(_('Changeset is to big and was cut'
88 diff = wrap_to_table(_('Changeset is to big and was cut'
89 ' off, see raw changeset instead'))
89 ' off, see raw changeset instead'))
90
90
91 cs1 = None
91 cs1 = None
92 cs2 = node.last_changeset.short_id
92 cs2 = node.last_changeset.raw_id
93 c.changes.append(('added', node, diff, cs1, cs2))
93 c.changes.append(('added', node, diff, cs1, cs2))
94
94
95 #===================================================================
95 #===================================================================
96 # CHANGED FILES
96 # CHANGED FILES
97 #===================================================================
97 #===================================================================
98 c.sum_removed = 0
98 c.sum_removed = 0
99 for node in c.changeset.changed:
99 for node in c.changeset.changed:
100 try:
100 try:
101 filenode_old = c.changeset_old.get_node(node.path)
101 filenode_old = c.changeset_old.get_node(node.path)
102 except ChangesetError:
102 except ChangesetError:
103 filenode_old = FileNode(node.path, '', EmptyChangeset())
103 filenode_old = FileNode(node.path, '', EmptyChangeset())
104
104
105 if filenode_old.is_binary or node.is_binary:
105 if filenode_old.is_binary or node.is_binary:
106 diff = wrap_to_table(_('binary file'))
106 diff = wrap_to_table(_('binary file'))
107 else:
107 else:
108
108
109 if c.sum_removed < cut_off_limit:
109 if c.sum_removed < cut_off_limit:
110 f_udiff = differ.get_udiff(filenode_old, node)
110 f_udiff = differ.get_udiff(filenode_old, node)
111 diff = differ.DiffProcessor(f_udiff).as_html()
111 diff = differ.DiffProcessor(f_udiff).as_html()
@@ -114,68 +114,68 b' class ChangesetController(BaseController'
114 else:
114 else:
115 diff = wrap_to_table(_('Changeset is to big and was cut'
115 diff = wrap_to_table(_('Changeset is to big and was cut'
116 ' off, see raw changeset instead'))
116 ' off, see raw changeset instead'))
117
117
118
118
119 cs1 = filenode_old.last_changeset.short_id
119 cs1 = filenode_old.last_changeset.raw_id
120 cs2 = node.last_changeset.short_id
120 cs2 = node.last_changeset.raw_id
121 c.changes.append(('changed', node, diff, cs1, cs2))
121 c.changes.append(('changed', node, diff, cs1, cs2))
122
122
123 #===================================================================
123 #===================================================================
124 # REMOVED FILES
124 # REMOVED FILES
125 #===================================================================
125 #===================================================================
126 for node in c.changeset.removed:
126 for node in c.changeset.removed:
127 c.changes.append(('removed', node, None, None, None))
127 c.changes.append(('removed', node, None, None, None))
128
128
129 return render('changeset/changeset.html')
129 return render('changeset/changeset.html')
130
130
131 def raw_changeset(self, revision):
131 def raw_changeset(self, revision):
132
132
133 hg_model = HgModel()
133 hg_model = HgModel()
134 method = request.GET.get('diff', 'show')
134 method = request.GET.get('diff', 'show')
135 try:
135 try:
136 c.changeset = hg_model.get_repo(c.repo_name).get_changeset(revision)
136 c.changeset = hg_model.get_repo(c.repo_name).get_changeset(revision)
137 except RepositoryError:
137 except RepositoryError:
138 log.error(traceback.format_exc())
138 log.error(traceback.format_exc())
139 return redirect(url('hg_home'))
139 return redirect(url('home'))
140 else:
140 else:
141 try:
141 try:
142 c.changeset_old = c.changeset.parents[0]
142 c.changeset_old = c.changeset.parents[0]
143 except IndexError:
143 except IndexError:
144 c.changeset_old = None
144 c.changeset_old = None
145 c.changes = []
145 c.changes = []
146
146
147 for node in c.changeset.added:
147 for node in c.changeset.added:
148 filenode_old = FileNode(node.path, '')
148 filenode_old = FileNode(node.path, '')
149 if filenode_old.is_binary or node.is_binary:
149 if filenode_old.is_binary or node.is_binary:
150 diff = _('binary file')
150 diff = _('binary file')
151 else:
151 else:
152 f_udiff = differ.get_udiff(filenode_old, node)
152 f_udiff = differ.get_udiff(filenode_old, node)
153 diff = differ.DiffProcessor(f_udiff).raw_diff()
153 diff = differ.DiffProcessor(f_udiff).raw_diff()
154
154
155 cs1 = None
155 cs1 = None
156 cs2 = node.last_changeset.short_id
156 cs2 = node.last_changeset.raw_id
157 c.changes.append(('added', node, diff, cs1, cs2))
157 c.changes.append(('added', node, diff, cs1, cs2))
158
158
159 for node in c.changeset.changed:
159 for node in c.changeset.changed:
160 filenode_old = c.changeset_old.get_node(node.path)
160 filenode_old = c.changeset_old.get_node(node.path)
161 if filenode_old.is_binary or node.is_binary:
161 if filenode_old.is_binary or node.is_binary:
162 diff = _('binary file')
162 diff = _('binary file')
163 else:
163 else:
164 f_udiff = differ.get_udiff(filenode_old, node)
164 f_udiff = differ.get_udiff(filenode_old, node)
165 diff = differ.DiffProcessor(f_udiff).raw_diff()
165 diff = differ.DiffProcessor(f_udiff).raw_diff()
166
166
167 cs1 = filenode_old.last_changeset.short_id
167 cs1 = filenode_old.last_changeset.raw_id
168 cs2 = node.last_changeset.short_id
168 cs2 = node.last_changeset.raw_id
169 c.changes.append(('changed', node, diff, cs1, cs2))
169 c.changes.append(('changed', node, diff, cs1, cs2))
170
170
171 response.content_type = 'text/plain'
171 response.content_type = 'text/plain'
172 if method == 'download':
172 if method == 'download':
173 response.content_disposition = 'attachment; filename=%s.patch' % revision
173 response.content_disposition = 'attachment; filename=%s.patch' % revision
174 parent = True if len(c.changeset.parents) > 0 else False
174 parent = True if len(c.changeset.parents) > 0 else False
175 c.parent_tmpl = 'Parent %s' % c.changeset.parents[0].raw_id if parent else ''
175 c.parent_tmpl = 'Parent %s' % c.changeset.parents[0].raw_id if parent else ''
176
176
177 c.diffs = ''
177 c.diffs = ''
178 for x in c.changes:
178 for x in c.changes:
179 c.diffs += x[2]
179 c.diffs += x[2]
180
180
181 return render('changeset/raw_changeset.html')
181 return render('changeset/raw_changeset.html')
@@ -54,7 +54,7 b' class FeedController(BaseController):'
54 for cs in changesets[:self.feed_nr]:
54 for cs in changesets[:self.feed_nr]:
55 feed.add_item(title=cs.message,
55 feed.add_item(title=cs.message,
56 link=url('changeset_home', repo_name=repo_name,
56 link=url('changeset_home', repo_name=repo_name,
57 revision=cs.short_id, qualified=True),
57 revision=cs.raw_id, qualified=True),
58 description=str(cs.date))
58 description=str(cs.date))
59
59
60 response.content_type = feed.mime_type
60 response.content_type = feed.mime_type
@@ -73,7 +73,7 b' class FeedController(BaseController):'
73 for cs in changesets[:self.feed_nr]:
73 for cs in changesets[:self.feed_nr]:
74 feed.add_item(title=cs.message,
74 feed.add_item(title=cs.message,
75 link=url('changeset_home', repo_name=repo_name,
75 link=url('changeset_home', repo_name=repo_name,
76 revision=cs.short_id, qualified=True),
76 revision=cs.raw_id, qualified=True),
77 description=str(cs.date))
77 description=str(cs.date))
78
78
79 response.content_type = feed.mime_type
79 response.content_type = feed.mime_type
@@ -36,14 +36,14 b' from vcs.utils import diffs as differ'
36 import logging
36 import logging
37 import rhodecode.lib.helpers as h
37 import rhodecode.lib.helpers as h
38 import tempfile
38 import tempfile
39
39
40 log = logging.getLogger(__name__)
40 log = logging.getLogger(__name__)
41
41
42 class FilesController(BaseController):
42 class FilesController(BaseController):
43
43
44 @LoginRequired()
44 @LoginRequired()
45 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
45 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
46 'repository.admin')
46 'repository.admin')
47 def __before__(self):
47 def __before__(self):
48 super(FilesController, self).__before__()
48 super(FilesController, self).__before__()
49 c.file_size_limit = 250 * 1024 #limit of file size to display
49 c.file_size_limit = 250 * 1024 #limit of file size to display
@@ -52,41 +52,41 b' class FilesController(BaseController):'
52 hg_model = HgModel()
52 hg_model = HgModel()
53 c.repo = repo = hg_model.get_repo(c.repo_name)
53 c.repo = repo = hg_model.get_repo(c.repo_name)
54 revision = request.POST.get('at_rev', None) or revision
54 revision = request.POST.get('at_rev', None) or revision
55
55
56 def get_next_rev(cur):
56 def get_next_rev(cur):
57 max_rev = len(c.repo.revisions) - 1
57 max_rev = len(c.repo.revisions) - 1
58 r = cur + 1
58 r = cur + 1
59 if r > max_rev:
59 if r > max_rev:
60 r = max_rev
60 r = max_rev
61 return r
61 return r
62
62
63 def get_prev_rev(cur):
63 def get_prev_rev(cur):
64 r = cur - 1
64 r = cur - 1
65 return r
65 return r
66
66
67 c.f_path = f_path
67 c.f_path = f_path
68
68
69
69
70 try:
70 try:
71 cur_rev = repo.get_changeset(revision).revision
71 cur_rev = repo.get_changeset(revision).revision
72 prev_rev = repo.get_changeset(get_prev_rev(cur_rev)).short_id
72 prev_rev = repo.get_changeset(get_prev_rev(cur_rev)).raw_id
73 next_rev = repo.get_changeset(get_next_rev(cur_rev)).short_id
73 next_rev = repo.get_changeset(get_next_rev(cur_rev)).raw_id
74
74
75 c.url_prev = url('files_home', repo_name=c.repo_name,
75 c.url_prev = url('files_home', repo_name=c.repo_name,
76 revision=prev_rev, f_path=f_path)
76 revision=prev_rev, f_path=f_path)
77 c.url_next = url('files_home', repo_name=c.repo_name,
77 c.url_next = url('files_home', repo_name=c.repo_name,
78 revision=next_rev, f_path=f_path)
78 revision=next_rev, f_path=f_path)
79
79
80 c.changeset = repo.get_changeset(revision)
80 c.changeset = repo.get_changeset(revision)
81
81
82 c.cur_rev = c.changeset.short_id
82 c.cur_rev = c.changeset.raw_id
83 c.rev_nr = c.changeset.revision
83 c.rev_nr = c.changeset.revision
84 c.files_list = c.changeset.get_node(f_path)
84 c.files_list = c.changeset.get_node(f_path)
85 c.file_history = self._get_history(repo, c.files_list, f_path)
85 c.file_history = self._get_history(repo, c.files_list, f_path)
86
86
87 except (RepositoryError, ChangesetError):
87 except (RepositoryError, ChangesetError):
88 c.files_list = None
88 c.files_list = None
89
89
90 return render('files/files.html')
90 return render('files/files.html')
91
91
92 def rawfile(self, repo_name, revision, f_path):
92 def rawfile(self, repo_name, revision, f_path):
@@ -95,7 +95,7 b' class FilesController(BaseController):'
95 file_node = c.repo.get_changeset(revision).get_node(f_path)
95 file_node = c.repo.get_changeset(revision).get_node(f_path)
96 response.content_type = file_node.mimetype
96 response.content_type = file_node.mimetype
97 response.content_disposition = 'attachment; filename=%s' \
97 response.content_disposition = 'attachment; filename=%s' \
98 % f_path.split('/')[-1]
98 % f_path.split('/')[-1]
99 return file_node.content
99 return file_node.content
100
100
101 def raw(self, repo_name, revision, f_path):
101 def raw(self, repo_name, revision, f_path):
@@ -103,21 +103,21 b' class FilesController(BaseController):'
103 c.repo = hg_model.get_repo(c.repo_name)
103 c.repo = hg_model.get_repo(c.repo_name)
104 file_node = c.repo.get_changeset(revision).get_node(f_path)
104 file_node = c.repo.get_changeset(revision).get_node(f_path)
105 response.content_type = 'text/plain'
105 response.content_type = 'text/plain'
106
106
107 return file_node.content
107 return file_node.content
108
108
109 def annotate(self, repo_name, revision, f_path):
109 def annotate(self, repo_name, revision, f_path):
110 hg_model = HgModel()
110 hg_model = HgModel()
111 c.repo = hg_model.get_repo(c.repo_name)
111 c.repo = hg_model.get_repo(c.repo_name)
112 cs = c.repo.get_changeset(revision)
112 cs = c.repo.get_changeset(revision)
113 c.file = cs.get_node(f_path)
113 c.file = cs.get_node(f_path)
114 c.file_msg = cs.get_file_message(f_path)
114 c.file_msg = cs.get_file_message(f_path)
115 c.cur_rev = cs.short_id
115 c.cur_rev = cs.raw_id
116 c.rev_nr = cs.revision
116 c.rev_nr = cs.revision
117 c.f_path = f_path
117 c.f_path = f_path
118
118
119 return render('files/files_annotate.html')
119 return render('files/files_annotate.html')
120
120
121 def archivefile(self, repo_name, revision, fileformat):
121 def archivefile(self, repo_name, revision, fileformat):
122 archive_specs = {
122 archive_specs = {
123 '.tar.bz2': ('application/x-tar', 'tbz2'),
123 '.tar.bz2': ('application/x-tar', 'tbz2'),
@@ -126,7 +126,7 b' class FilesController(BaseController):'
126 }
126 }
127 if not archive_specs.has_key(fileformat):
127 if not archive_specs.has_key(fileformat):
128 return 'Unknown archive type %s' % fileformat
128 return 'Unknown archive type %s' % fileformat
129
129
130 def read_in_chunks(file_object, chunk_size=1024 * 40):
130 def read_in_chunks(file_object, chunk_size=1024 * 40):
131 """Lazy function (generator) to read a file piece by piece.
131 """Lazy function (generator) to read a file piece by piece.
132 Default chunk size: 40k."""
132 Default chunk size: 40k."""
@@ -134,8 +134,8 b' class FilesController(BaseController):'
134 data = file_object.read(chunk_size)
134 data = file_object.read(chunk_size)
135 if not data:
135 if not data:
136 break
136 break
137 yield data
137 yield data
138
138
139 archive = tempfile.TemporaryFile()
139 archive = tempfile.TemporaryFile()
140 repo = HgModel().get_repo(repo_name).repo
140 repo = HgModel().get_repo(repo_name).repo
141 fname = '%s-%s%s' % (repo_name, revision, fileformat)
141 fname = '%s-%s%s' % (repo_name, revision, fileformat)
@@ -145,7 +145,7 b' class FilesController(BaseController):'
145 response.content_disposition = 'attachment; filename=%s' % fname
145 response.content_disposition = 'attachment; filename=%s' % fname
146 archive.seek(0)
146 archive.seek(0)
147 return read_in_chunks(archive)
147 return read_in_chunks(archive)
148
148
149 def diff(self, repo_name, f_path):
149 def diff(self, repo_name, f_path):
150 hg_model = HgModel()
150 hg_model = HgModel()
151 diff1 = request.GET.get('diff1')
151 diff1 = request.GET.get('diff1')
@@ -162,7 +162,7 b' class FilesController(BaseController):'
162 else:
162 else:
163 c.changeset_1 = EmptyChangeset()
163 c.changeset_1 = EmptyChangeset()
164 node1 = FileNode('.', '', changeset=c.changeset_1)
164 node1 = FileNode('.', '', changeset=c.changeset_1)
165
165
166 if diff2 not in ['', None, 'None', '0' * 12, '0' * 40]:
166 if diff2 not in ['', None, 'None', '0' * 12, '0' * 40]:
167 c.changeset_2 = c.repo.get_changeset(diff2)
167 c.changeset_2 = c.repo.get_changeset(diff2)
168 node2 = c.changeset_2.get_node(f_path)
168 node2 = c.changeset_2.get_node(f_path)
@@ -173,19 +173,16 b' class FilesController(BaseController):'
173 return redirect(url('files_home',
173 return redirect(url('files_home',
174 repo_name=c.repo_name, f_path=f_path))
174 repo_name=c.repo_name, f_path=f_path))
175
175
176 c.diff1 = 'r%s:%s' % (c.changeset_1.revision, c.changeset_1.short_id)
177 c.diff2 = 'r%s:%s' % (c.changeset_2.revision, c.changeset_2.short_id)
178
179 f_udiff = differ.get_udiff(node1, node2)
176 f_udiff = differ.get_udiff(node1, node2)
180 diff = differ.DiffProcessor(f_udiff)
177 diff = differ.DiffProcessor(f_udiff)
181
178
182 if c.action == 'download':
179 if c.action == 'download':
183 diff_name = '%s_vs_%s.diff' % (diff1, diff2)
180 diff_name = '%s_vs_%s.diff' % (diff1, diff2)
184 response.content_type = 'text/plain'
181 response.content_type = 'text/plain'
185 response.content_disposition = 'attachment; filename=%s' \
182 response.content_disposition = 'attachment; filename=%s' \
186 % diff_name
183 % diff_name
187 return diff.raw_diff()
184 return diff.raw_diff()
188
185
189 elif c.action == 'raw':
186 elif c.action == 'raw':
190 c.cur_diff = '<pre class="raw">%s</pre>' % h.escape(diff.raw_diff())
187 c.cur_diff = '<pre class="raw">%s</pre>' % h.escape(diff.raw_diff())
191 elif c.action == 'diff':
188 elif c.action == 'diff':
@@ -199,10 +196,10 b' class FilesController(BaseController):'
199 c.cur_diff = _('Diff is to big to display')
196 c.cur_diff = _('Diff is to big to display')
200 else:
197 else:
201 c.cur_diff = diff.as_html()
198 c.cur_diff = diff.as_html()
202
199
203 if not c.cur_diff: c.no_changes = True
200 if not c.cur_diff: c.no_changes = True
204 return render('files/file_diff.html')
201 return render('files/file_diff.html')
205
202
206 def _get_history(self, repo, node, f_path):
203 def _get_history(self, repo, node, f_path):
207 from vcs.nodes import NodeKind
204 from vcs.nodes import NodeKind
208 if not node.kind is NodeKind.FILE:
205 if not node.kind is NodeKind.FILE:
@@ -211,5 +208,5 b' class FilesController(BaseController):'
211 hist_l = []
208 hist_l = []
212 for chs in changesets:
209 for chs in changesets:
213 n_desc = 'r%s:%s' % (chs.revision, chs.short_id)
210 n_desc = 'r%s:%s' % (chs.revision, chs.short_id)
214 hist_l.append((chs.short_id, n_desc,))
211 hist_l.append((chs.raw_id, n_desc,))
215 return hist_l
212 return hist_l
@@ -30,17 +30,17 b' from rhodecode.model.hg import HgModel'
30 import logging
30 import logging
31 log = logging.getLogger(__name__)
31 log = logging.getLogger(__name__)
32
32
33 class HgController(BaseController):
33 class HomeController(BaseController):
34
34
35 @LoginRequired()
35 @LoginRequired()
36 def __before__(self):
36 def __before__(self):
37 super(HgController, self).__before__()
37 super(HomeController, self).__before__()
38
38
39 def index(self):
39 def index(self):
40 sortables = ['name', 'description', 'last_change', 'tip', 'contact']
40 sortables = ['name', 'description', 'last_change', 'tip', 'contact']
41 current_sort = request.GET.get('sort', 'name')
41 current_sort = request.GET.get('sort', 'name')
42 current_sort_slug = current_sort.replace('-', '')
42 current_sort_slug = current_sort.replace('-', '')
43
43
44 if current_sort_slug not in sortables:
44 if current_sort_slug not in sortables:
45 c.sort_by = 'name'
45 c.sort_by = 'name'
46 current_sort_slug = c.sort_by
46 current_sort_slug = c.sort_by
@@ -48,11 +48,11 b' class HgController(BaseController):'
48 c.sort_by = current_sort
48 c.sort_by = current_sort
49 c.sort_slug = current_sort_slug
49 c.sort_slug = current_sort_slug
50 cached_repo_list = HgModel().get_repos()
50 cached_repo_list = HgModel().get_repos()
51
51
52 sort_key = current_sort_slug + '_sort'
52 sort_key = current_sort_slug + '_sort'
53 if c.sort_by.startswith('-'):
53 if c.sort_by.startswith('-'):
54 c.repos_list = sorted(cached_repo_list, key=itemgetter(sort_key), reverse=True)
54 c.repos_list = sorted(cached_repo_list, key=itemgetter(sort_key), reverse=True)
55 else:
55 else:
56 c.repos_list = sorted(cached_repo_list, key=itemgetter(sort_key), reverse=False)
56 c.repos_list = sorted(cached_repo_list, key=itemgetter(sort_key), reverse=False)
57
57
58 return render('/index.html')
58 return render('/index.html')
@@ -28,7 +28,7 b' from pylons import request, response, se'
28 from pylons.controllers.util import abort, redirect
28 from pylons.controllers.util import abort, redirect
29 from rhodecode.lib.auth import AuthUser, HasPermissionAnyDecorator
29 from rhodecode.lib.auth import AuthUser, HasPermissionAnyDecorator
30 from rhodecode.lib.base import BaseController, render
30 from rhodecode.lib.base import BaseController, render
31 import rhodecode.lib.helpers as h
31 import rhodecode.lib.helpers as h
32 from pylons.i18n.translation import _
32 from pylons.i18n.translation import _
33 from rhodecode.model.forms import LoginForm, RegisterForm, PasswordResetForm
33 from rhodecode.model.forms import LoginForm, RegisterForm, PasswordResetForm
34 from rhodecode.model.user import UserModel
34 from rhodecode.model.user import UserModel
@@ -45,10 +45,10 b' class LoginController(BaseController):'
45 def index(self):
45 def index(self):
46 #redirect if already logged in
46 #redirect if already logged in
47 c.came_from = request.GET.get('came_from', None)
47 c.came_from = request.GET.get('came_from', None)
48
48
49 if c.rhodecode_user.is_authenticated:
49 if c.rhodecode_user.is_authenticated:
50 return redirect(url('hg_home'))
50 return redirect(url('home'))
51
51
52 if request.POST:
52 if request.POST:
53 #import Login Form validator class
53 #import Login Form validator class
54 login_form = LoginForm()
54 login_form = LoginForm()
@@ -66,14 +66,14 b' class LoginController(BaseController):'
66 session['rhodecode_user'] = auth_user
66 session['rhodecode_user'] = auth_user
67 session.save()
67 session.save()
68 log.info('user %s is now authenticated', username)
68 log.info('user %s is now authenticated', username)
69
69
70 user.update_lastlogin()
70 user.update_lastlogin()
71
71
72 if c.came_from:
72 if c.came_from:
73 return redirect(c.came_from)
73 return redirect(c.came_from)
74 else:
74 else:
75 return redirect(url('hg_home'))
75 return redirect(url('home'))
76
76
77 except formencode.Invalid, errors:
77 except formencode.Invalid, errors:
78 return htmlfill.render(
78 return htmlfill.render(
79 render('/login.html'),
79 render('/login.html'),
@@ -81,9 +81,9 b' class LoginController(BaseController):'
81 errors=errors.error_dict or {},
81 errors=errors.error_dict or {},
82 prefix_error=False,
82 prefix_error=False,
83 encoding="UTF-8")
83 encoding="UTF-8")
84
84
85 return render('/login.html')
85 return render('/login.html')
86
86
87 @HasPermissionAnyDecorator('hg.admin', 'hg.register.auto_activate',
87 @HasPermissionAnyDecorator('hg.admin', 'hg.register.auto_activate',
88 'hg.register.manual_activate')
88 'hg.register.manual_activate')
89 def register(self):
89 def register(self):
@@ -93,18 +93,18 b' class LoginController(BaseController):'
93 if perm.permission.permission_name == 'hg.register.auto_activate':
93 if perm.permission.permission_name == 'hg.register.auto_activate':
94 c.auto_active = True
94 c.auto_active = True
95 break
95 break
96
96
97 if request.POST:
97 if request.POST:
98
98
99 register_form = RegisterForm()()
99 register_form = RegisterForm()()
100 try:
100 try:
101 form_result = register_form.to_python(dict(request.POST))
101 form_result = register_form.to_python(dict(request.POST))
102 form_result['active'] = c.auto_active
102 form_result['active'] = c.auto_active
103 user_model.create_registration(form_result)
103 user_model.create_registration(form_result)
104 h.flash(_('You have successfully registered into rhodecode'),
104 h.flash(_('You have successfully registered into rhodecode'),
105 category='success')
105 category='success')
106 return redirect(url('login_home'))
106 return redirect(url('login_home'))
107
107
108 except formencode.Invalid, errors:
108 except formencode.Invalid, errors:
109 return htmlfill.render(
109 return htmlfill.render(
110 render('/register.html'),
110 render('/register.html'),
@@ -112,21 +112,21 b' class LoginController(BaseController):'
112 errors=errors.error_dict or {},
112 errors=errors.error_dict or {},
113 prefix_error=False,
113 prefix_error=False,
114 encoding="UTF-8")
114 encoding="UTF-8")
115
115
116 return render('/register.html')
116 return render('/register.html')
117
117
118 def password_reset(self):
118 def password_reset(self):
119 user_model = UserModel()
119 user_model = UserModel()
120 if request.POST:
120 if request.POST:
121
121
122 password_reset_form = PasswordResetForm()()
122 password_reset_form = PasswordResetForm()()
123 try:
123 try:
124 form_result = password_reset_form.to_python(dict(request.POST))
124 form_result = password_reset_form.to_python(dict(request.POST))
125 user_model.reset_password(form_result)
125 user_model.reset_password(form_result)
126 h.flash(_('Your new password was sent'),
126 h.flash(_('Your new password was sent'),
127 category='success')
127 category='success')
128 return redirect(url('login_home'))
128 return redirect(url('login_home'))
129
129
130 except formencode.Invalid, errors:
130 except formencode.Invalid, errors:
131 return htmlfill.render(
131 return htmlfill.render(
132 render('/password_reset.html'),
132 render('/password_reset.html'),
@@ -134,11 +134,11 b' class LoginController(BaseController):'
134 errors=errors.error_dict or {},
134 errors=errors.error_dict or {},
135 prefix_error=False,
135 prefix_error=False,
136 encoding="UTF-8")
136 encoding="UTF-8")
137
137
138 return render('/password_reset.html')
138 return render('/password_reset.html')
139
139
140 def logout(self):
140 def logout(self):
141 session['rhodecode_user'] = AuthUser()
141 session['rhodecode_user'] = AuthUser()
142 session.save()
142 session.save()
143 log.info('Logging out and setting user as Empty')
143 log.info('Logging out and setting user as Empty')
144 redirect(url('hg_home'))
144 redirect(url('home'))
@@ -41,35 +41,35 b' log = logging.getLogger(__name__)'
41 class SettingsController(BaseController):
41 class SettingsController(BaseController):
42
42
43 @LoginRequired()
43 @LoginRequired()
44 @HasRepoPermissionAllDecorator('repository.admin')
44 @HasRepoPermissionAllDecorator('repository.admin')
45 def __before__(self):
45 def __before__(self):
46 super(SettingsController, self).__before__()
46 super(SettingsController, self).__before__()
47
47
48 def index(self, repo_name):
48 def index(self, repo_name):
49 repo_model = RepoModel()
49 repo_model = RepoModel()
50 c.repo_info = repo = repo_model.get(repo_name)
50 c.repo_info = repo = repo_model.get(repo_name)
51 if not repo:
51 if not repo:
52 h.flash(_('%s repository is not mapped to db perhaps'
52 h.flash(_('%s repository is not mapped to db perhaps'
53 ' it was created or renamed from the filesystem'
53 ' it was created or renamed from the filesystem'
54 ' please run the application again'
54 ' please run the application again'
55 ' in order to rescan repositories') % repo_name,
55 ' in order to rescan repositories') % repo_name,
56 category='error')
56 category='error')
57
57
58 return redirect(url('hg_home'))
58 return redirect(url('home'))
59 defaults = c.repo_info.__dict__
59 defaults = c.repo_info.__dict__
60 defaults.update({'user':c.repo_info.user.username})
60 defaults.update({'user':c.repo_info.user.username})
61 c.users_array = repo_model.get_users_js()
61 c.users_array = repo_model.get_users_js()
62
62
63 for p in c.repo_info.repo_to_perm:
63 for p in c.repo_info.repo_to_perm:
64 defaults.update({'perm_%s' % p.user.username:
64 defaults.update({'perm_%s' % p.user.username:
65 p.permission.permission_name})
65 p.permission.permission_name})
66
66
67 return htmlfill.render(
67 return htmlfill.render(
68 render('settings/repo_settings.html'),
68 render('settings/repo_settings.html'),
69 defaults=defaults,
69 defaults=defaults,
70 encoding="UTF-8",
70 encoding="UTF-8",
71 force_defaults=False
71 force_defaults=False
72 )
72 )
73
73
74 def update(self, repo_name):
74 def update(self, repo_name):
75 repo_model = RepoModel()
75 repo_model = RepoModel()
@@ -81,7 +81,7 b' class SettingsController(BaseController)'
81 invalidate_cache('cached_repo_list')
81 invalidate_cache('cached_repo_list')
82 h.flash(_('Repository %s updated successfully' % repo_name),
82 h.flash(_('Repository %s updated successfully' % repo_name),
83 category='success')
83 category='success')
84 changed_name = form_result['repo_name']
84 changed_name = form_result['repo_name']
85 except formencode.Invalid, errors:
85 except formencode.Invalid, errors:
86 c.repo_info = repo_model.get(repo_name)
86 c.repo_info = repo_model.get(repo_name)
87 c.users_array = repo_model.get_users_js()
87 c.users_array = repo_model.get_users_js()
@@ -91,17 +91,17 b' class SettingsController(BaseController)'
91 defaults=errors.value,
91 defaults=errors.value,
92 errors=errors.error_dict or {},
92 errors=errors.error_dict or {},
93 prefix_error=False,
93 prefix_error=False,
94 encoding="UTF-8")
94 encoding="UTF-8")
95 except Exception:
95 except Exception:
96 log.error(traceback.format_exc())
96 log.error(traceback.format_exc())
97 h.flash(_('error occured during update of repository %s') \
97 h.flash(_('error occured during update of repository %s') \
98 % repo_name, category='error')
98 % repo_name, category='error')
99
99
100 return redirect(url('repo_settings_home', repo_name=changed_name))
100 return redirect(url('repo_settings_home', repo_name=changed_name))
101
101
102
102
103
103
104 def delete(self, repo_name):
104 def delete(self, repo_name):
105 """DELETE /repos/repo_name: Delete an existing item"""
105 """DELETE /repos/repo_name: Delete an existing item"""
106 # Forms posted to this method should contain a hidden field:
106 # Forms posted to this method should contain a hidden field:
107 # <input type="hidden" name="_method" value="DELETE" />
107 # <input type="hidden" name="_method" value="DELETE" />
@@ -109,45 +109,45 b' class SettingsController(BaseController)'
109 # h.form(url('repo_settings_delete', repo_name=ID),
109 # h.form(url('repo_settings_delete', repo_name=ID),
110 # method='delete')
110 # method='delete')
111 # url('repo_settings_delete', repo_name=ID)
111 # url('repo_settings_delete', repo_name=ID)
112
112
113 repo_model = RepoModel()
113 repo_model = RepoModel()
114 repo = repo_model.get(repo_name)
114 repo = repo_model.get(repo_name)
115 if not repo:
115 if not repo:
116 h.flash(_('%s repository is not mapped to db perhaps'
116 h.flash(_('%s repository is not mapped to db perhaps'
117 ' it was moved or renamed from the filesystem'
117 ' it was moved or renamed from the filesystem'
118 ' please run the application again'
118 ' please run the application again'
119 ' in order to rescan repositories') % repo_name,
119 ' in order to rescan repositories') % repo_name,
120 category='error')
120 category='error')
121
121
122 return redirect(url('hg_home'))
122 return redirect(url('home'))
123 try:
123 try:
124 action_logger(self.rhodecode_user, 'user_deleted_repo',
124 action_logger(self.rhodecode_user, 'user_deleted_repo',
125 repo_name, '', self.sa)
125 repo_name, '', self.sa)
126 repo_model.delete(repo)
126 repo_model.delete(repo)
127 invalidate_cache('cached_repo_list')
127 invalidate_cache('cached_repo_list')
128 h.flash(_('deleted repository %s') % repo_name, category='success')
128 h.flash(_('deleted repository %s') % repo_name, category='success')
129 except Exception:
129 except Exception:
130 h.flash(_('An error occurred during deletion of %s') % repo_name,
130 h.flash(_('An error occurred during deletion of %s') % repo_name,
131 category='error')
131 category='error')
132
132
133 return redirect(url('hg_home'))
133 return redirect(url('home'))
134
134
135 def fork(self, repo_name):
135 def fork(self, repo_name):
136 repo_model = RepoModel()
136 repo_model = RepoModel()
137 c.repo_info = repo = repo_model.get(repo_name)
137 c.repo_info = repo = repo_model.get(repo_name)
138 if not repo:
138 if not repo:
139 h.flash(_('%s repository is not mapped to db perhaps'
139 h.flash(_('%s repository is not mapped to db perhaps'
140 ' it was created or renamed from the filesystem'
140 ' it was created or renamed from the filesystem'
141 ' please run the application again'
141 ' please run the application again'
142 ' in order to rescan repositories') % repo_name,
142 ' in order to rescan repositories') % repo_name,
143 category='error')
143 category='error')
144
144
145 return redirect(url('hg_home'))
145 return redirect(url('home'))
146
146
147 return render('settings/repo_fork.html')
147 return render('settings/repo_fork.html')
148
148
149
149
150
150
151 def fork_create(self, repo_name):
151 def fork_create(self, repo_name):
152 repo_model = RepoModel()
152 repo_model = RepoModel()
153 c.repo_info = repo_model.get(repo_name)
153 c.repo_info = repo_model.get(repo_name)
@@ -161,15 +161,15 b' class SettingsController(BaseController)'
161 % (repo_name, form_result['fork_name']),
161 % (repo_name, form_result['fork_name']),
162 category='success')
162 category='success')
163 action_logger(self.rhodecode_user, 'user_forked_repo',
163 action_logger(self.rhodecode_user, 'user_forked_repo',
164 repo_name, '', self.sa)
164 repo_name, '', self.sa)
165 except formencode.Invalid, errors:
165 except formencode.Invalid, errors:
166 c.new_repo = errors.value['fork_name']
166 c.new_repo = errors.value['fork_name']
167 r = render('settings/repo_fork.html')
167 r = render('settings/repo_fork.html')
168
168
169 return htmlfill.render(
169 return htmlfill.render(
170 r,
170 r,
171 defaults=errors.value,
171 defaults=errors.value,
172 errors=errors.error_dict or {},
172 errors=errors.error_dict or {},
173 prefix_error=False,
173 prefix_error=False,
174 encoding="UTF-8")
174 encoding="UTF-8")
175 return redirect(url('hg_home'))
175 return redirect(url('home'))
@@ -272,12 +272,12 b' def pygmentize_annotation(filenode, **kw'
272 changeset.date,
272 changeset.date,
273 tooltip(changeset.message))
273 tooltip(changeset.message))
274 lnk_format = 'r%-5s:%s' % (changeset.revision,
274 lnk_format = 'r%-5s:%s' % (changeset.revision,
275 changeset.short_id)
275 changeset.raw_id)
276 uri = link_to(
276 uri = link_to(
277 lnk_format,
277 lnk_format,
278 url('changeset_home', repo_name=changeset.repository.name,
278 url('changeset_home', repo_name=changeset.repository.name,
279 revision=changeset.short_id),
279 revision=changeset.raw_id),
280 style=get_color_string(changeset.short_id),
280 style=get_color_string(changeset.raw_id),
281 class_='tooltip',
281 class_='tooltip',
282 tooltip_title=tooltip_html
282 tooltip_title=tooltip_html
283 )
283 )
@@ -352,6 +352,7 b' capitalize = lambda x: x.capitalize()'
352 email = util.email
352 email = util.email
353 email_or_none = lambda x: util.email(x) if util.email(x) != x else None
353 email_or_none = lambda x: util.email(x) if util.email(x) != x else None
354 person = lambda x: _person(x)
354 person = lambda x: _person(x)
355 short_id = lambda x: x[:12]
355
356
356 #==============================================================================
357 #==============================================================================
357 # PERMS
358 # PERMS
@@ -303,6 +303,7 b' class EmptyChangeset(BaseChangeset):'
303 message = ''
303 message = ''
304 author = ''
304 author = ''
305 date = ''
305 date = ''
306
306 @LazyProperty
307 @LazyProperty
307 def raw_id(self):
308 def raw_id(self):
308 """
309 """
@@ -158,7 +158,7 b' class HgModel(object):'
158 tmp_d['description_sort'] = tmp_d['description']
158 tmp_d['description_sort'] = tmp_d['description']
159 tmp_d['last_change'] = last_change
159 tmp_d['last_change'] = last_change
160 tmp_d['last_change_sort'] = time.mktime(last_change.timetuple())
160 tmp_d['last_change_sort'] = time.mktime(last_change.timetuple())
161 tmp_d['tip'] = tip.short_id
161 tmp_d['tip'] = tip.raw_id
162 tmp_d['tip_sort'] = tip.revision
162 tmp_d['tip_sort'] = tip.revision
163 tmp_d['rev'] = tip.revision
163 tmp_d['rev'] = tip.revision
164 tmp_d['contact'] = repo.contact
164 tmp_d['contact'] = repo.contact
@@ -1701,6 +1701,7 b' font:100% sans-serif;'
1701 width:auto;
1701 width:auto;
1702 opacity:1px;
1702 opacity:1px;
1703 padding:8px;
1703 padding:8px;
1704 white-space: pre;
1704 }
1705 }
1705
1706
1706 .ac {
1707 .ac {
@@ -31,7 +31,7 b''
31 <div id="header-inner" class="title top-left-rounded-corner top-right-rounded-corner">
31 <div id="header-inner" class="title top-left-rounded-corner top-right-rounded-corner">
32 <!-- logo -->
32 <!-- logo -->
33 <div id="logo">
33 <div id="logo">
34 <h1><a href="${h.url('hg_home')}">${c.rhodecode_name}</a></h1>
34 <h1><a href="${h.url('home')}">${c.rhodecode_name}</a></h1>
35 </div>
35 </div>
36 <!-- end logo -->
36 <!-- end logo -->
37 <!-- menu -->
37 <!-- menu -->
@@ -146,7 +146,7 b''
146 <ul>
146 <ul>
147 %if c.repository_branches.values():
147 %if c.repository_branches.values():
148 %for cnt,branch in enumerate(c.repository_branches.items()):
148 %for cnt,branch in enumerate(c.repository_branches.items()):
149 <li>${h.link_to('%s - %s' % (branch[0],branch[1]),h.url('files_home',repo_name=c.repo_name,revision=branch[1]))}</li>
149 <li>${h.link_to('%s - %s' % (branch[0],h.short_id(branch[1])),h.url('files_home',repo_name=c.repo_name,revision=branch[1]))}</li>
150 %endfor
150 %endfor
151 %else:
151 %else:
152 <li>${h.link_to(_('There are no branches yet'),'#')}</li>
152 <li>${h.link_to(_('There are no branches yet'),'#')}</li>
@@ -158,7 +158,7 b''
158 <ul>
158 <ul>
159 %if c.repository_tags.values():
159 %if c.repository_tags.values():
160 %for cnt,tag in enumerate(c.repository_tags.items()):
160 %for cnt,tag in enumerate(c.repository_tags.items()):
161 <li>${h.link_to('%s - %s' % (tag[0],tag[1]),h.url('files_home',repo_name=c.repo_name,revision=tag[1]))}</li>
161 <li>${h.link_to('%s - %s' % (tag[0],h.short_id(tag[1])),h.url('files_home',repo_name=c.repo_name,revision=tag[1]))}</li>
162 %endfor
162 %endfor
163 %else:
163 %else:
164 <li>${h.link_to(_('There are no tags yet'),'#')}</li>
164 <li>${h.link_to(_('There are no tags yet'),'#')}</li>
@@ -219,7 +219,7 b''
219 ##ROOT MENU
219 ##ROOT MENU
220 <ul id="quick">
220 <ul id="quick">
221 <li>
221 <li>
222 <a title="${_('Home')}" href="${h.url('hg_home')}">
222 <a title="${_('Home')}" href="${h.url('home')}">
223 <span class="icon">
223 <span class="icon">
224 <img src="/images/icons/home_16.png" alt="${_('Home')}" />
224 <img src="/images/icons/home_16.png" alt="${_('Home')}" />
225 </span>
225 </span>
@@ -2,24 +2,26 b''
2 <table class="table_disp">
2 <table class="table_disp">
3 <tr>
3 <tr>
4 <th class="left">${_('date')}</th>
4 <th class="left">${_('date')}</th>
5 <th class="left">${_('name')}</th>
6 <th class="left">${_('author')}</th>
5 <th class="left">${_('revision')}</th>
7 <th class="left">${_('revision')}</th>
6 <th class="left">${_('name')}</th>
7 <th class="left">${_('links')}</th>
8 <th class="left">${_('links')}</th>
8 </tr>
9 </tr>
9 %for cnt,branch in enumerate(c.repo_branches.items()):
10 %for cnt,branch in enumerate(c.repo_branches.items()):
10 <tr class="parity${cnt%2}">
11 <tr class="parity${cnt%2}">
11 <td>${h.age(branch[1].date)}</td>
12 <td>${branch[1].date} - ${h.age(branch[1].date)}</td>
12 <td>r${branch[1].revision}:${branch[1].short_id}</td>
13 <td>
13 <td>
14 <span class="logtags">
14 <span class="logtags">
15 <span class="branchtag">${h.link_to(branch[0],
15 <span class="branchtag">${h.link_to(branch[0],
16 h.url('changeset_home',repo_name=c.repo_name,revision=branch[1].raw_id))}</span>
16 h.url('changeset_home',repo_name=c.repo_name,revision=branch[1].short_id))}</span>
17 </span>
17 </span>
18 </td>
18 </td>
19 <td title="${branch[1].author}">${h.person(branch[1].author)}</td>
20 <td>r${branch[1].revision}:${h.short_id(branch[1].raw_id)}</td>
19 <td class="nowrap">
21 <td class="nowrap">
20 ${h.link_to(_('changeset'),h.url('changeset_home',repo_name=c.repo_name,revision=branch[1].short_id))}
22 ${h.link_to(_('changeset'),h.url('changeset_home',repo_name=c.repo_name,revision=branch[1].raw_id))}
21 |
23 |
22 ${h.link_to(_('files'),h.url('files_home',repo_name=c.repo_name,revision=branch[1].short_id))}
24 ${h.link_to(_('files'),h.url('files_home',repo_name=c.repo_name,revision=branch[1].raw_id))}
23 </td>
25 </td>
24 </tr>
26 </tr>
25 %endfor
27 %endfor
@@ -46,7 +46,7 b''
46 %for cnt,cs in enumerate(c.pagination):
46 %for cnt,cs in enumerate(c.pagination):
47 <div id="chg_${cnt+1}" class="container">
47 <div id="chg_${cnt+1}" class="container">
48 <div class="left">
48 <div class="left">
49 <div class="date">${_('commit')} ${cs.revision}: ${cs.short_id}@${cs.date}</div>
49 <div class="date">${_('commit')} ${cs.revision}: ${cs.raw_id}@${cs.date}</div>
50 <div class="author">
50 <div class="author">
51 <div class="gravatar">
51 <div class="gravatar">
52 <img alt="gravatar" src="${h.gravatar_url(h.email(cs.author),20)}"/>
52 <img alt="gravatar" src="${h.gravatar_url(h.email(cs.author),20)}"/>
@@ -54,7 +54,7 b''
54 <span>${h.person(cs.author)}</span><br/>
54 <span>${h.person(cs.author)}</span><br/>
55 <span><a href="mailto:${h.email_or_none(cs.author)}">${h.email_or_none(cs.author)}</a></span><br/>
55 <span><a href="mailto:${h.email_or_none(cs.author)}">${h.email_or_none(cs.author)}</a></span><br/>
56 </div>
56 </div>
57 <div class="message">${h.link_to(h.wrap_paragraphs(cs.message),h.url('changeset_home',repo_name=c.repo_name,revision=cs.short_id))}</div>
57 <div class="message">${h.link_to(h.wrap_paragraphs(cs.message),h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}</div>
58 </div>
58 </div>
59 <div class="right">
59 <div class="right">
60 <div class="changes">
60 <div class="changes">
@@ -69,8 +69,8 b''
69 %endif
69 %endif
70 %if cs.parents:
70 %if cs.parents:
71 %for p_cs in reversed(cs.parents):
71 %for p_cs in reversed(cs.parents):
72 <div class="parent">${_('Parent')} ${p_cs.revision}: ${h.link_to(p_cs.short_id,
72 <div class="parent">${_('Parent')} ${p_cs.revision}: ${h.link_to(p_cs.raw_id,
73 h.url('changeset_home',repo_name=c.repo_name,revision=p_cs.short_id),title=p_cs.message)}
73 h.url('changeset_home',repo_name=c.repo_name,revision=p_cs.raw_id),title=p_cs.message)}
74 </div>
74 </div>
75 %endfor
75 %endfor
76 %else:
76 %else:
@@ -79,10 +79,10 b''
79
79
80 <span class="logtags">
80 <span class="logtags">
81 <span class="branchtag" title="${'%s %s' % (_('branch'),cs.branch)}">
81 <span class="branchtag" title="${'%s %s' % (_('branch'),cs.branch)}">
82 ${h.link_to(cs.branch,h.url('files_home',repo_name=c.repo_name,revision=cs.short_id))}</span>
82 ${h.link_to(cs.branch,h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id))}</span>
83 %for tag in cs.tags:
83 %for tag in cs.tags:
84 <span class="tagtag" title="${'%s %s' % (_('tag'),tag)}">
84 <span class="tagtag" title="${'%s %s' % (_('tag'),tag)}">
85 ${h.link_to(tag,h.url('files_home',repo_name=c.repo_name,revision=cs.short_id))}</span>
85 ${h.link_to(tag,h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id))}</span>
86 %endfor
86 %endfor
87 </span>
87 </span>
88 </div>
88 </div>
@@ -1,7 +1,7 b''
1 <%inherit file="/base/base.html"/>
1 <%inherit file="/base/base.html"/>
2
2
3 <%def name="title()">
3 <%def name="title()">
4 ${c.repo_name} ${_('Changeset')} - r${c.changeset.revision}:${c.changeset.short_id} - ${c.rhodecode_name}
4 ${c.repo_name} ${_('Changeset')} - r${c.changeset.revision}:${h.short_id(c.changeset.raw_id)} - ${c.rhodecode_name}
5 </%def>
5 </%def>
6
6
7 <%def name="breadcrumbs_links()">
7 <%def name="breadcrumbs_links()">
@@ -9,7 +9,7 b''
9 &raquo;
9 &raquo;
10 ${h.link_to(c.repo_name,h.url('summary_home',repo_name=c.repo_name))}
10 ${h.link_to(c.repo_name,h.url('summary_home',repo_name=c.repo_name))}
11 &raquo;
11 &raquo;
12 ${_('Changeset')} - r${c.changeset.revision}:${c.changeset.short_id}
12 ${_('Changeset')} - r${c.changeset.revision}:${h.short_id(c.changeset.raw_id)}
13 </%def>
13 </%def>
14
14
15 <%def name="page_nav()">
15 <%def name="page_nav()">
@@ -26,18 +26,18 b''
26 <div id="body" class="diffblock">
26 <div id="body" class="diffblock">
27 <div class="code-header">
27 <div class="code-header">
28 <div>
28 <div>
29 ${_('Changeset')} - r${c.changeset.revision}:${c.changeset.short_id}
29 ${_('Changeset')} - r${c.changeset.revision}:${h.short_id(c.changeset.raw_id)}
30 &raquo; <span>${h.link_to(_('raw diff'),
30 &raquo; <span>${h.link_to(_('raw diff'),
31 h.url('raw_changeset_home',repo_name=c.repo_name,revision=c.changeset.short_id,diff='show'))}</span>
31 h.url('raw_changeset_home',repo_name=c.repo_name,revision=c.changeset.raw_id,diff='show'))}</span>
32 &raquo; <span>${h.link_to(_('download diff'),
32 &raquo; <span>${h.link_to(_('download diff'),
33 h.url('raw_changeset_home',repo_name=c.repo_name,revision=c.changeset.short_id,diff='download'))}</span>
33 h.url('raw_changeset_home',repo_name=c.repo_name,revision=c.changeset.raw_id,diff='download'))}</span>
34 </div>
34 </div>
35 </div>
35 </div>
36 </div>
36 </div>
37 <div id="changeset_content">
37 <div id="changeset_content">
38 <div class="container">
38 <div class="container">
39 <div class="left">
39 <div class="left">
40 <div class="date">${_('commit')} ${c.changeset.revision}: ${c.changeset.short_id}@${c.changeset.date}</div>
40 <div class="date">${_('commit')} ${c.changeset.revision}: ${h.short_id(c.changeset.raw_id)}@${c.changeset.date}</div>
41 <div class="author">
41 <div class="author">
42 <div class="gravatar">
42 <div class="gravatar">
43 <img alt="gravatar" src="${h.gravatar_url(h.email(c.changeset.author),20)}"/>
43 <img alt="gravatar" src="${h.gravatar_url(h.email(c.changeset.author),20)}"/>
@@ -45,7 +45,7 b''
45 <span>${h.person(c.changeset.author)}</span><br/>
45 <span>${h.person(c.changeset.author)}</span><br/>
46 <span><a href="mailto:${h.email_or_none(c.changeset.author)}">${h.email_or_none(c.changeset.author)}</a></span><br/>
46 <span><a href="mailto:${h.email_or_none(c.changeset.author)}">${h.email_or_none(c.changeset.author)}</a></span><br/>
47 </div>
47 </div>
48 <div class="message">${h.link_to(h.wrap_paragraphs(c.changeset.message),h.url('changeset_home',repo_name=c.repo_name,revision=c.changeset.short_id))}</div>
48 <div class="message">${h.link_to(h.wrap_paragraphs(c.changeset.message),h.url('changeset_home',repo_name=c.repo_name,revision=c.changeset.raw_id))}</div>
49 </div>
49 </div>
50 <div class="right">
50 <div class="right">
51 <div class="changes">
51 <div class="changes">
@@ -61,8 +61,8 b''
61
61
62 %if c.changeset.parents:
62 %if c.changeset.parents:
63 %for p_cs in reversed(c.changeset.parents):
63 %for p_cs in reversed(c.changeset.parents):
64 <div class="parent">${_('Parent')} ${p_cs.revision}: ${h.link_to(p_cs.short_id,
64 <div class="parent">${_('Parent')} ${p_cs.revision}: ${h.link_to(h.short_id(p_cs.raw_id),
65 h.url('changeset_home',repo_name=c.repo_name,revision=p_cs.short_id),title=p_cs.message)}
65 h.url('changeset_home',repo_name=c.repo_name,revision=p_cs.raw_id),title=p_cs.message)}
66 </div>
66 </div>
67 %endfor
67 %endfor
68 %else:
68 %else:
@@ -70,10 +70,10 b''
70 %endif
70 %endif
71 <span class="logtags">
71 <span class="logtags">
72 <span class="branchtag" title="${'%s %s' % (_('branch'),c.changeset.branch)}">
72 <span class="branchtag" title="${'%s %s' % (_('branch'),c.changeset.branch)}">
73 ${h.link_to(c.changeset.branch,h.url('files_home',repo_name=c.repo_name,revision=c.changeset.short_id))}</span>
73 ${h.link_to(c.changeset.branch,h.url('files_home',repo_name=c.repo_name,revision=c.changeset.raw_id))}</span>
74 %for tag in c.changeset.tags:
74 %for tag in c.changeset.tags:
75 <span class="tagtag" title="${'%s %s' % (_('tag'),tag)}">
75 <span class="tagtag" title="${'%s %s' % (_('tag'),tag)}">
76 ${h.link_to(tag,h.url('files_home',repo_name=c.repo_name,revision=c.changeset.short_id))}</span>
76 ${h.link_to(tag,h.url('files_home',repo_name=c.repo_name,revision=c.changeset.raw_id))}</span>
77 %endfor
77 %endfor
78 </span>
78 </span>
79 </div>
79 </div>
@@ -96,7 +96,7 b''
96 <div>
96 <div>
97 <span>
97 <span>
98 ${h.link_to_if(change!='removed',filenode.path,h.url('files_home',repo_name=c.repo_name,
98 ${h.link_to_if(change!='removed',filenode.path,h.url('files_home',repo_name=c.repo_name,
99 revision=filenode.changeset.short_id,f_path=filenode.path))}
99 revision=filenode.changeset.raw_id,f_path=filenode.path))}
100 </span>
100 </span>
101 %if 1:
101 %if 1:
102 &raquo; <span>${h.link_to(_('diff'),
102 &raquo; <span>${h.link_to(_('diff'),
@@ -6,7 +6,7 b''
6 </%def>
6 </%def>
7
7
8 <%def name="breadcrumbs()">
8 <%def name="breadcrumbs()">
9 ${h.link_to(u'Home',h.url('hg_home'))}
9 ${h.link_to(u'Home',h.url('home'))}
10 /
10 /
11 ${h.link_to(u'Admin',h.url('admin_home'))}
11 ${h.link_to(u'Admin',h.url('admin_home'))}
12 </%def>
12 </%def>
@@ -26,7 +26,7 b''
26 ${_('Create "%s" repository as %s' % (c.repo_name,c.repo_name_cleaned))}</a>
26 ${_('Create "%s" repository as %s' % (c.repo_name,c.repo_name_cleaned))}</a>
27
27
28 </p>
28 </p>
29 <p class="normal">${h.link_to(_('Go back to the main repository list page'),h.url('hg_home'))}</p>
29 <p class="normal">${h.link_to(_('Go back to the main repository list page'),h.url('home'))}</p>
30 <div class="page-footer">
30 <div class="page-footer">
31 </div>
31 </div>
32 </%def> No newline at end of file
32 </%def>
@@ -9,7 +9,7 b''
9 &raquo;
9 &raquo;
10 ${h.link_to(c.repo_name,h.url('summary_home',repo_name=c.repo_name))}
10 ${h.link_to(c.repo_name,h.url('summary_home',repo_name=c.repo_name))}
11 &raquo;
11 &raquo;
12 ${'%s: %s %s %s' % (_('File diff'),c.diff2,'&rarr;',c.diff1)|n}
12 ${_('File diff')} r${c.changeset_1.revision}:${h.short_id(c.changeset_1.raw_id)} &rarr; r${c.changeset_2.revision}:${h.short_id(c.changeset_2.raw_id)}
13 </%def>
13 </%def>
14
14
15 <%def name="page_nav()">
15 <%def name="page_nav()">
@@ -26,13 +26,13 b''
26 <div class="code-header">
26 <div class="code-header">
27 <div>
27 <div>
28 <span>${h.link_to(c.f_path,h.url('files_home',repo_name=c.repo_name,
28 <span>${h.link_to(c.f_path,h.url('files_home',repo_name=c.repo_name,
29 revision=c.diff2.split(':')[1],f_path=c.f_path))}</span>
29 revision=c.changeset_2.raw_id,f_path=c.f_path))}</span>
30 &raquo; <span>${h.link_to(_('diff'),
30 &raquo; <span>${h.link_to(_('diff'),
31 h.url.current(diff2=c.diff2.split(':')[-1],diff1=c.diff1.split(':')[-1],diff='diff'))}</span>
31 h.url.current(diff2=c.changeset_2.raw_id,diff1=c.changeset_1.raw_id,diff='diff'))}</span>
32 &raquo; <span>${h.link_to(_('raw diff'),
32 &raquo; <span>${h.link_to(_('raw diff'),
33 h.url.current(diff2=c.diff2.split(':')[-1],diff1=c.diff1.split(':')[-1],diff='raw'))}</span>
33 h.url.current(diff2=c.changeset_2.raw_id,diff1=c.changeset_1.raw_id,diff='raw'))}</span>
34 &raquo; <span>${h.link_to(_('download diff'),
34 &raquo; <span>${h.link_to(_('download diff'),
35 h.url.current(diff2=c.diff2.split(':')[-1],diff1=c.diff1.split(':')[-1],diff='download'))}</span>
35 h.url.current(diff2=c.changeset_2.raw_id,diff1=c.changeset_1.raw_id,diff='download'))}</span>
36 </div>
36 </div>
37 </div>
37 </div>
38 <div class="code-body">
38 <div class="code-body">
@@ -11,7 +11,7 b''
11 &raquo;
11 &raquo;
12 ${_('files')}
12 ${_('files')}
13 %if c.files_list:
13 %if c.files_list:
14 @ R${c.rev_nr}:${c.cur_rev}
14 @ R${c.rev_nr}:${h.short_id(c.cur_rev)}
15 %endif
15 %endif
16 </%def>
16 </%def>
17
17
@@ -26,8 +26,8 b''
26 <h3 class="files_location">${_('Location')}: ${h.files_breadcrumbs(c.repo_name,c.cur_rev,c.file.path)}</h3>
26 <h3 class="files_location">${_('Location')}: ${h.files_breadcrumbs(c.repo_name,c.cur_rev,c.file.path)}</h3>
27 <dl class="overview">
27 <dl class="overview">
28 <dt>${_('Last revision')}</dt>
28 <dt>${_('Last revision')}</dt>
29 <dd>${h.link_to("r%s:%s" % (c.file.last_changeset.revision,c.file.last_changeset.short_id),
29 <dd>${h.link_to("r%s:%s" % (c.file.last_changeset.revision,c.file.last_changeset.raw_id),
30 h.url('files_annotate_home',repo_name=c.repo_name,revision=c.file.last_changeset.short_id,f_path=c.f_path))} </dd>
30 h.url('files_annotate_home',repo_name=c.repo_name,revision=c.file.last_changeset.raw_id,f_path=c.f_path))} </dd>
31 <dt>${_('Size')}</dt>
31 <dt>${_('Size')}</dt>
32 <dd>${h.format_byte_size(c.file.size,binary=True)}</dd>
32 <dd>${h.format_byte_size(c.file.size,binary=True)}</dd>
33 <dt>${_('Mimetype')}</dt>
33 <dt>${_('Mimetype')}</dt>
@@ -43,7 +43,7 b''
43 </dl>
43 </dl>
44 <div id="body" class="codeblock">
44 <div id="body" class="codeblock">
45 <div class="code-header">
45 <div class="code-header">
46 <div class="revision">${c.file.name}@r${c.file.last_changeset.revision}:${c.file.last_changeset.short_id}</div>
46 <div class="revision">${c.file.name}@r${c.file.last_changeset.revision}:${c.file.last_changeset.raw_id}</div>
47 <div class="commit">"${c.file_msg}"</div>
47 <div class="commit">"${c.file_msg}"</div>
48 </div>
48 </div>
49 <div class="code-body">
49 <div class="code-body">
@@ -1,8 +1,8 b''
1 <dl>
1 <dl>
2 <dt>${_('Last revision')}</dt>
2 <dt>${_('Last revision')}</dt>
3 <dd>
3 <dd>
4 ${h.link_to("r%s:%s" % (c.files_list.last_changeset.revision,c.files_list.last_changeset.short_id),
4 ${h.link_to("r%s:%s" % (c.files_list.last_changeset.revision,h.short_id(c.files_list.last_changeset.raw_id)),
5 h.url('files_home',repo_name=c.repo_name,revision=c.files_list.last_changeset.short_id,f_path=c.f_path))}
5 h.url('files_home',repo_name=c.repo_name,revision=c.files_list.last_changeset.raw_id,f_path=c.f_path))}
6 </dd>
6 </dd>
7 <dt>${_('Size')}</dt>
7 <dt>${_('Size')}</dt>
8 <dd>${h.format_byte_size(c.files_list.size,binary=True)}</dd>
8 <dd>${h.format_byte_size(c.files_list.size,binary=True)}</dd>
@@ -20,8 +20,8 b''
20 <dd>
20 <dd>
21 <div>
21 <div>
22 ${h.form(h.url('files_diff_home',repo_name=c.repo_name,f_path=c.f_path),method='get')}
22 ${h.form(h.url('files_diff_home',repo_name=c.repo_name,f_path=c.f_path),method='get')}
23 ${h.hidden('diff2',c.files_list.last_changeset.short_id)}
23 ${h.hidden('diff2',c.files_list.last_changeset.raw_id)}
24 ${h.select('diff1',c.files_list.last_changeset.short_id,c.file_history)}
24 ${h.select('diff1',c.files_list.last_changeset.raw_id,c.file_history)}
25 ${h.submit('diff','diff to revision',class_="ui-button ui-widget ui-state-default ui-corner-all")}
25 ${h.submit('diff','diff to revision',class_="ui-button ui-widget ui-state-default ui-corner-all")}
26 ${h.submit('show_rev','show at revision',class_="ui-button ui-widget ui-state-default ui-corner-all")}
26 ${h.submit('show_rev','show at revision',class_="ui-button ui-widget ui-state-default ui-corner-all")}
27 ${h.end_form()}
27 ${h.end_form()}
@@ -32,7 +32,7 b''
32
32
33 <div id="body" class="codeblock">
33 <div id="body" class="codeblock">
34 <div class="code-header">
34 <div class="code-header">
35 <div class="revision">${c.files_list.name}@r${c.files_list.last_changeset.revision}:${c.files_list.last_changeset.short_id}</div>
35 <div class="revision">${c.files_list.name}@r${c.files_list.last_changeset.revision}:${h.short_id(c.files_list.last_changeset.raw_id)}</div>
36 <div class="commit">"${c.files_list.last_changeset.message}"</div>
36 <div class="commit">"${c.files_list.last_changeset.message}"</div>
37 </div>
37 </div>
38 <div class="code-body">
38 <div class="code-body">
@@ -56,33 +56,36 b''
56 <tr class="parity${cnt%2}">
56 <tr class="parity${cnt%2}">
57 <td>
57 <td>
58 %if repo['repo'].dbrepo.repo_type =='hg':
58 %if repo['repo'].dbrepo.repo_type =='hg':
59 <img class="icon" alt="${_('Mercurial repository')}" src="/images/icons/hgicon.png"/>
59 <img class="icon" title="${_('Mercurial repository')}" alt="${_('Mercurial repository')}" src="/images/icons/hgicon.png"/>
60 %elif repo['repo'].dbrepo.repo_type =='git':
60 %elif repo['repo'].dbrepo.repo_type =='git':
61 <img class="icon" alt="${_('Git repository')}" src="/images/icons/giticon.png"/>
61 <img class="icon" title="${_('Git repository')}" alt="${_('Git repository')}" src="/images/icons/giticon.png"/>
62 %else:
62 %else:
63
63
64 %endif
64 %endif
65
65
66 %if repo['repo'].dbrepo.private:
66 %if repo['repo'].dbrepo.private:
67 <img class="icon" alt="${_('private')}" src="/images/icons/lock.png"/>
67 <img class="icon" title="${_('private repository')}" alt="${_('private repository')}" src="/images/icons/lock.png"/>
68 %else:
68 %else:
69 <img class="icon" alt="${_('public')}" src="/images/icons/lock_open.png"/>
69 <img class="icon" title="${_('public repository')}" alt="${_('public repository')}" src="/images/icons/lock_open.png"/>
70 %endif
70 %endif
71 ${h.link_to(repo['name'],
71 ${h.link_to(repo['name'],
72 h.url('summary_home',repo_name=repo['name']))}
72 h.url('summary_home',repo_name=repo['name']))}
73 %if repo['repo'].dbrepo.fork:
73 %if repo['repo'].dbrepo.fork:
74 <a href="${h.url('summary_home',repo_name=repo['repo'].dbrepo.fork.repo_name)}">
74 <a href="${h.url('summary_home',repo_name=repo['repo'].dbrepo.fork.repo_name)}">
75 <img class="icon" alt="${_('public')}"
75 <img class="icon" alt="${_('fork')}"
76 title="${_('Fork of')} ${repo['repo'].dbrepo.fork.repo_name}"
76 title="${_('Fork of')} ${repo['repo'].dbrepo.fork.repo_name}"
77 src="/images/icons/arrow_divide.png"/></a>
77 src="/images/icons/arrow_divide.png"/></a>
78 %endif
78 %endif
79 </td>
79 </td>
80 <td title="${repo['description']}">${h.truncate(repo['description'],60)}</td>
80 <td><span class="tooltip" tooltip_title="${repo['description']}">
81 ${h.truncate(repo['description'],60)}</span>
82 </td>
81 <td><span class="tooltip" tooltip_title="${repo['last_change']}">
83 <td><span class="tooltip" tooltip_title="${repo['last_change']}">
82 ${h.age(repo['last_change'])} </span></td>
84 ${h.age(repo['last_change'])} </span>
85 </td>
83 <td>
86 <td>
84 %if repo['rev']>=0:
87 %if repo['rev']>=0:
85 ${h.link_to('r%s:%s' % (repo['rev'],repo['tip']),
88 ${h.link_to('r%s:%s' % (repo['rev'],h.short_id(repo['tip'])),
86 h.url('changeset_home',repo_name=repo['name'],revision=repo['tip']),
89 h.url('changeset_home',repo_name=repo['name'],revision=repo['tip']),
87 class_="tooltip",
90 class_="tooltip",
88 tooltip_title=h.tooltip(repo['last_msg']))}
91 tooltip_title=h.tooltip(repo['last_msg']))}
@@ -3,9 +3,9 b''
3 <table>
3 <table>
4 <tr>
4 <tr>
5 <th class="left">${_('date')}</th>
5 <th class="left">${_('date')}</th>
6 <th class="left">${_('commit message')}</th>
6 <th class="left">${_('author')}</th>
7 <th class="left">${_('author')}</th>
7 <th class="left">${_('revision')}</th>
8 <th class="left">${_('revision')}</th>
8 <th class="left">${_('commit message')}</th>
9 <th class="left">${_('branch')}</th>
9 <th class="left">${_('branch')}</th>
10 <th class="left">${_('tags')}</th>
10 <th class="left">${_('tags')}</th>
11 <th class="left">${_('links')}</th>
11 <th class="left">${_('links')}</th>
@@ -13,14 +13,14 b''
13 </tr>
13 </tr>
14 %for cnt,cs in enumerate(c.repo_changesets):
14 %for cnt,cs in enumerate(c.repo_changesets):
15 <tr class="parity${cnt%2}">
15 <tr class="parity${cnt%2}">
16 <td>${h.age(cs.date)} - ${cs.date} </td>
16 <td>${cs.date} - ${h.age(cs.date)}</td>
17 <td>
18 ${h.link_to(h.truncate(cs.message,60),
19 h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id),
20 title=cs.message)}
21 </td>
17 <td title="${cs.author}">${h.person(cs.author)}</td>
22 <td title="${cs.author}">${h.person(cs.author)}</td>
18 <td>r${cs.revision}:${cs.short_id}</td>
23 <td>r${cs.revision}:${h.short_id(cs.raw_id)}</td>
19 <td>
20 ${h.link_to(h.truncate(cs.message,60),
21 h.url('changeset_home',repo_name=c.repo_name,revision=cs.short_id),
22 title=cs.message)}
23 </td>
24 <td>
24 <td>
25 <span class="logtags">
25 <span class="logtags">
26 <span class="branchtag">${cs.branch}</span>
26 <span class="branchtag">${cs.branch}</span>
@@ -34,9 +34,9 b''
34 </span>
34 </span>
35 </td>
35 </td>
36 <td class="nowrap">
36 <td class="nowrap">
37 ${h.link_to(_('changeset'),h.url('changeset_home',repo_name=c.repo_name,revision=cs.short_id))}
37 ${h.link_to(_('changeset'),h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}
38 |
38 |
39 ${h.link_to(_('files'),h.url('files_home',repo_name=c.repo_name,revision=cs.short_id))}
39 ${h.link_to(_('files'),h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id))}
40 </td>
40 </td>
41 </tr>
41 </tr>
42 %endfor
42 %endfor
@@ -42,10 +42,19 b' E.onDOMReady(function(e){'
42 <label>${_('Name')}:</label>
42 <label>${_('Name')}:</label>
43 </div>
43 </div>
44 <div class="input-short">
44 <div class="input-short">
45
46 %if c.repo_info.dbrepo.repo_type =='hg':
47 <img style="margin-bottom:2px" class="icon" title="${_('Mercurial repository')}" alt="${_('Mercurial repository')}" src="/images/icons/hgicon.png"/>
48 %elif c.repo_info.dbrepo.repo_type =='git':
49 <img style="margin-bottom:2px" class="icon" title="${_('Git repository')}" alt="${_('Git repository')}" src="/images/icons/giticon.png"/>
50 %else:
51
52 %endif
53
45 %if c.repo_info.dbrepo.private:
54 %if c.repo_info.dbrepo.private:
46 <img style="margin-bottom:2px" class="icon" title="${_('private repository')}" alt="${_('private')}" src="/images/icons/lock.png"/>
55 <img style="margin-bottom:2px" class="icon" title="${_('private repository')}" alt="${_('private repository')}" src="/images/icons/lock.png"/>
47 %else:
56 %else:
48 <img style="margin-bottom:2px" class="icon" title="${_('public repository')}" alt="${_('public')}" src="/images/icons/lock_open.png"/>
57 <img style="margin-bottom:2px" class="icon" title="${_('public repository')}" alt="${_('public repository')}" src="/images/icons/lock_open.png"/>
49 %endif
58 %endif
50 <span style="font-size: 1.6em;font-weight: bold;vertical-align: baseline;">${c.repo_info.name}</span>
59 <span style="font-size: 1.6em;font-weight: bold;vertical-align: baseline;">${c.repo_info.name}</span>
51 <br/>
60 <br/>
@@ -1,25 +1,27 b''
1 %if c.repo_tags:
1 %if c.repo_tags:
2 <table>
2 <table>
3 <tr>
3 <tr>
4 <th class="left">${_('date')}</th>
4 <th class="left">${_('date')}</th>
5 <th class="left">${_('revision')}</th>
5 <th class="left">${_('name')}</th>
6 <th class="left">${_('name')}</th>
6 <th class="left">${_('author')}</th>
7 <th class="left">${_('revision')}</th>
7 <th class="left">${_('links')}</th>
8 <th class="left">${_('links')}</th>
8 </tr>
9 </tr>
9 %for cnt,tag in enumerate(c.repo_tags.items()):
10 %for cnt,tag in enumerate(c.repo_tags.items()):
10 <tr class="parity${cnt%2}">
11 <tr class="parity${cnt%2}">
11 <td>${h.age(tag[1].date)}</td>
12 <td>${tag[1].date} - ${h.age(tag[1].date)}</td>
12 <td>r${tag[1].revision}:${tag[1].short_id}</td>
13 <td>
13 <td>
14 <span class="logtags">
14 <span class="logtags">
15 <span class="tagtag">${h.link_to(tag[0],
15 <span class="tagtag">${h.link_to(tag[0],
16 h.url('changeset_home',repo_name=c.repo_name,revision=tag[1].raw_id))}</span>
16 h.url('changeset_home',repo_name=c.repo_name,revision=tag[1].short_id))}</span>
17 </span>
17 </span>
18 </td>
18 </td>
19 <td title="${tag[1].author}">${h.person(tag[1].author)}</td>
20 <td>r${tag[1].revision}:${h.short_id(tag[1].raw_id)}</td>
19 <td class="nowrap">
21 <td class="nowrap">
20 ${h.link_to(_('changeset'),h.url('changeset_home',repo_name=c.repo_name,revision=tag[1].short_id))}
22 ${h.link_to(_('changeset'),h.url('changeset_home',repo_name=c.repo_name,revision=tag[1].raw_id))}
21 |
23 |
22 ${h.link_to(_('files'),h.url('files_home',repo_name=c.repo_name,revision=tag[1].short_id))}
24 ${h.link_to(_('files'),h.url('files_home',repo_name=c.repo_name,revision=tag[1].raw_id))}
23 </td>
25 </td>
24 </tr>
26 </tr>
25 %endfor
27 %endfor
General Comments 0
You need to be logged in to leave comments. Login now