Mercurial > kallithea
annotate rhodecode/controllers/files.py @ 1218:3d9da7893fdb
fixes for stable
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Tue, 05 Apr 2011 18:51:34 +0200 |
parents | a3b2b4b4e440 |
children | 0dc8d578ff49 |
rev | line source |
---|---|
812
30ad41c76fae
fixes #79 cut off limit was added into .ini config files
Marcin Kuzminski <marcin@python-works.com>
parents:
774
diff
changeset
|
1 # -*- coding: utf-8 -*- |
30ad41c76fae
fixes #79 cut off limit was added into .ini config files
Marcin Kuzminski <marcin@python-works.com>
parents:
774
diff
changeset
|
2 """ |
30ad41c76fae
fixes #79 cut off limit was added into .ini config files
Marcin Kuzminski <marcin@python-works.com>
parents:
774
diff
changeset
|
3 rhodecode.controllers.files |
30ad41c76fae
fixes #79 cut off limit was added into .ini config files
Marcin Kuzminski <marcin@python-works.com>
parents:
774
diff
changeset
|
4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
318
fdf9f6ee5217
Implemented permissions into hg app, secured admin controllers, templates and repository specific controllers
Marcin Kuzminski <marcin@python-works.com>
parents:
275
diff
changeset
|
5 |
812
30ad41c76fae
fixes #79 cut off limit was added into .ini config files
Marcin Kuzminski <marcin@python-works.com>
parents:
774
diff
changeset
|
6 Files controller for RhodeCode |
1218
3d9da7893fdb
fixes for stable
Marcin Kuzminski <marcin@python-works.com>
parents:
1217
diff
changeset
|
7 |
812
30ad41c76fae
fixes #79 cut off limit was added into .ini config files
Marcin Kuzminski <marcin@python-works.com>
parents:
774
diff
changeset
|
8 :created_on: Apr 21, 2010 |
30ad41c76fae
fixes #79 cut off limit was added into .ini config files
Marcin Kuzminski <marcin@python-works.com>
parents:
774
diff
changeset
|
9 :author: marcink |
1136
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
10 :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> |
812
30ad41c76fae
fixes #79 cut off limit was added into .ini config files
Marcin Kuzminski <marcin@python-works.com>
parents:
774
diff
changeset
|
11 :license: GPLv3, see COPYING for more details. |
30ad41c76fae
fixes #79 cut off limit was added into .ini config files
Marcin Kuzminski <marcin@python-works.com>
parents:
774
diff
changeset
|
12 """ |
1217
a3b2b4b4e440
fixes for issue #149
Marcin Kuzminski <marcin@python-works.com>
parents:
1136
diff
changeset
|
13 # This program is free software: you can redistribute it and/or modify |
a3b2b4b4e440
fixes for issue #149
Marcin Kuzminski <marcin@python-works.com>
parents:
1136
diff
changeset
|
14 # it under the terms of the GNU General Public License as published by |
a3b2b4b4e440
fixes for issue #149
Marcin Kuzminski <marcin@python-works.com>
parents:
1136
diff
changeset
|
15 # the Free Software Foundation, either version 3 of the License, or |
a3b2b4b4e440
fixes for issue #149
Marcin Kuzminski <marcin@python-works.com>
parents:
1136
diff
changeset
|
16 # (at your option) any later version. |
a3b2b4b4e440
fixes for issue #149
Marcin Kuzminski <marcin@python-works.com>
parents:
1136
diff
changeset
|
17 # |
252
3782a6d698af
licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
245
diff
changeset
|
18 # This program is distributed in the hope that it will be useful, |
3782a6d698af
licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
245
diff
changeset
|
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
3782a6d698af
licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
245
diff
changeset
|
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3782a6d698af
licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
245
diff
changeset
|
21 # GNU General Public License for more details. |
1217
a3b2b4b4e440
fixes for issue #149
Marcin Kuzminski <marcin@python-works.com>
parents:
1136
diff
changeset
|
22 # |
252
3782a6d698af
licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
245
diff
changeset
|
23 # You should have received a copy of the GNU General Public License |
1217
a3b2b4b4e440
fixes for issue #149
Marcin Kuzminski <marcin@python-works.com>
parents:
1136
diff
changeset
|
24 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
1218
3d9da7893fdb
fixes for stable
Marcin Kuzminski <marcin@python-works.com>
parents:
1217
diff
changeset
|
25 import os |
812
30ad41c76fae
fixes #79 cut off limit was added into .ini config files
Marcin Kuzminski <marcin@python-works.com>
parents:
774
diff
changeset
|
26 import tempfile |
30ad41c76fae
fixes #79 cut off limit was added into .ini config files
Marcin Kuzminski <marcin@python-works.com>
parents:
774
diff
changeset
|
27 import logging |
30ad41c76fae
fixes #79 cut off limit was added into .ini config files
Marcin Kuzminski <marcin@python-works.com>
parents:
774
diff
changeset
|
28 import rhodecode.lib.helpers as h |
30ad41c76fae
fixes #79 cut off limit was added into .ini config files
Marcin Kuzminski <marcin@python-works.com>
parents:
774
diff
changeset
|
29 |
318
fdf9f6ee5217
Implemented permissions into hg app, secured admin controllers, templates and repository specific controllers
Marcin Kuzminski <marcin@python-works.com>
parents:
275
diff
changeset
|
30 from mercurial import archival |
812
30ad41c76fae
fixes #79 cut off limit was added into .ini config files
Marcin Kuzminski <marcin@python-works.com>
parents:
774
diff
changeset
|
31 |
318
fdf9f6ee5217
Implemented permissions into hg app, secured admin controllers, templates and repository specific controllers
Marcin Kuzminski <marcin@python-works.com>
parents:
275
diff
changeset
|
32 from pylons import request, response, session, tmpl_context as c, url |
544
d8778cde98f0
added limits to single file diffs
Marcin Kuzminski <marcin@python-works.com>
parents:
512
diff
changeset
|
33 from pylons.i18n.translation import _ |
318
fdf9f6ee5217
Implemented permissions into hg app, secured admin controllers, templates and repository specific controllers
Marcin Kuzminski <marcin@python-works.com>
parents:
275
diff
changeset
|
34 from pylons.controllers.util import redirect |
812
30ad41c76fae
fixes #79 cut off limit was added into .ini config files
Marcin Kuzminski <marcin@python-works.com>
parents:
774
diff
changeset
|
35 |
547
1e757ac98988
renamed project to rhodecode
Marcin Kuzminski <marcin@python-works.com>
parents:
544
diff
changeset
|
36 from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator |
1e757ac98988
renamed project to rhodecode
Marcin Kuzminski <marcin@python-works.com>
parents:
544
diff
changeset
|
37 from rhodecode.lib.base import BaseController, render |
1e757ac98988
renamed project to rhodecode
Marcin Kuzminski <marcin@python-works.com>
parents:
544
diff
changeset
|
38 from rhodecode.lib.utils import EmptyChangeset |
691
7486da5f0628
Refactor codes for scm model
Marcin Kuzminski <marcin@python-works.com>
parents:
662
diff
changeset
|
39 from rhodecode.model.scm import ScmModel |
812
30ad41c76fae
fixes #79 cut off limit was added into .ini config files
Marcin Kuzminski <marcin@python-works.com>
parents:
774
diff
changeset
|
40 |
921
136af52f374b
merged found bugs and fixed for stable release:
Marcin Kuzminski <marcin@python-works.com>
parents:
813
diff
changeset
|
41 from vcs.exceptions import RepositoryError, ChangesetError, \ |
136af52f374b
merged found bugs and fixed for stable release:
Marcin Kuzminski <marcin@python-works.com>
parents:
813
diff
changeset
|
42 ChangesetDoesNotExistError, EmptyRepositoryError |
318
fdf9f6ee5217
Implemented permissions into hg app, secured admin controllers, templates and repository specific controllers
Marcin Kuzminski <marcin@python-works.com>
parents:
275
diff
changeset
|
43 from vcs.nodes import FileNode |
fdf9f6ee5217
Implemented permissions into hg app, secured admin controllers, templates and repository specific controllers
Marcin Kuzminski <marcin@python-works.com>
parents:
275
diff
changeset
|
44 from vcs.utils import diffs as differ |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
45 |
93
aec4c0071cb3
added empty controllers for branches tags files graph, routing and test for them
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
46 log = logging.getLogger(__name__) |
aec4c0071cb3
added empty controllers for branches tags files graph, routing and test for them
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
47 |
aec4c0071cb3
added empty controllers for branches tags files graph, routing and test for them
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
48 class FilesController(BaseController): |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
49 |
191
b68b2246e5a6
Authenticated controller with LoginRequired decorator, and cleaned __before__ (used in baseController now). fixed User for clone url with logged in session user.
Marcin Kuzminski <marcin@python-works.com>
parents:
160
diff
changeset
|
50 @LoginRequired() |
318
fdf9f6ee5217
Implemented permissions into hg app, secured admin controllers, templates and repository specific controllers
Marcin Kuzminski <marcin@python-works.com>
parents:
275
diff
changeset
|
51 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write', |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
52 'repository.admin') |
99
5b57295601b6
Updated basic files browser with, pygments
Marcin Kuzminski <marcin@python-works.com>
parents:
93
diff
changeset
|
53 def __before__(self): |
191
b68b2246e5a6
Authenticated controller with LoginRequired decorator, and cleaned __before__ (used in baseController now). fixed User for clone url with logged in session user.
Marcin Kuzminski <marcin@python-works.com>
parents:
160
diff
changeset
|
54 super(FilesController, self).__before__() |
813
e8b5be26fb78
fixed small issue made on latest patches
Marcin Kuzminski <marcin@python-works.com>
parents:
812
diff
changeset
|
55 c.cut_off_limit = self.cut_off_limit |
93
aec4c0071cb3
added empty controllers for branches tags files graph, routing and test for them
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
56 |
1136
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
57 def __get_cs_or_redirect(self, rev, repo_name): |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
58 """ |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
59 Safe way to get changeset if error occur it redirects to tip with |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
60 proper message |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
61 |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
62 :param rev: revision to fetch |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
63 :param repo_name: repo name to redirect after |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
64 """ |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
65 |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
66 _repo = ScmModel().get_repo(c.repo_name) |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
67 try: |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
68 return _repo.get_changeset(rev) |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
69 except EmptyRepositoryError, e: |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
70 h.flash(_('There are no files yet'), category='warning') |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
71 redirect(h.url('summary_home', repo_name=repo_name)) |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
72 |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
73 except RepositoryError, e: |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
74 h.flash(str(e), category='warning') |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
75 redirect(h.url('files_home', repo_name=repo_name, revision='tip')) |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
76 |
99
5b57295601b6
Updated basic files browser with, pygments
Marcin Kuzminski <marcin@python-works.com>
parents:
93
diff
changeset
|
77 def index(self, repo_name, revision, f_path): |
1136
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
78 cs = self.__get_cs_or_redirect(revision, repo_name) |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
79 c.repo = ScmModel().get_repo(c.repo_name) |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
80 |
149
b3c93efd1c97
Updated template for summary (archives links)
Marcin Kuzminski <marcin@python-works.com>
parents:
147
diff
changeset
|
81 revision = request.POST.get('at_rev', None) or revision |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
82 |
149
b3c93efd1c97
Updated template for summary (archives links)
Marcin Kuzminski <marcin@python-works.com>
parents:
147
diff
changeset
|
83 def get_next_rev(cur): |
145
3f01d02c2cc6
fixed error when browsing revisions on path that doesn't exist. Fixed files browsing. Fixed templates in branches and tags
Marcin Kuzminski <marcin@python-works.com>
parents:
142
diff
changeset
|
84 max_rev = len(c.repo.revisions) - 1 |
149
b3c93efd1c97
Updated template for summary (archives links)
Marcin Kuzminski <marcin@python-works.com>
parents:
147
diff
changeset
|
85 r = cur + 1 |
b3c93efd1c97
Updated template for summary (archives links)
Marcin Kuzminski <marcin@python-works.com>
parents:
147
diff
changeset
|
86 if r > max_rev: |
b3c93efd1c97
Updated template for summary (archives links)
Marcin Kuzminski <marcin@python-works.com>
parents:
147
diff
changeset
|
87 r = max_rev |
b3c93efd1c97
Updated template for summary (archives links)
Marcin Kuzminski <marcin@python-works.com>
parents:
147
diff
changeset
|
88 return r |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
89 |
149
b3c93efd1c97
Updated template for summary (archives links)
Marcin Kuzminski <marcin@python-works.com>
parents:
147
diff
changeset
|
90 def get_prev_rev(cur): |
b3c93efd1c97
Updated template for summary (archives links)
Marcin Kuzminski <marcin@python-works.com>
parents:
147
diff
changeset
|
91 r = cur - 1 |
b3c93efd1c97
Updated template for summary (archives links)
Marcin Kuzminski <marcin@python-works.com>
parents:
147
diff
changeset
|
92 return r |
b3c93efd1c97
Updated template for summary (archives links)
Marcin Kuzminski <marcin@python-works.com>
parents:
147
diff
changeset
|
93 |
99
5b57295601b6
Updated basic files browser with, pygments
Marcin Kuzminski <marcin@python-works.com>
parents:
93
diff
changeset
|
94 c.f_path = f_path |
1136
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
95 c.changeset = cs |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
96 cur_rev = c.changeset.revision |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
97 prev_rev = c.repo.get_changeset(get_prev_rev(cur_rev)).raw_id |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
98 next_rev = c.repo.get_changeset(get_next_rev(cur_rev)).raw_id |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
99 |
1136
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
100 c.url_prev = url('files_home', repo_name=c.repo_name, |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
101 revision=prev_rev, f_path=f_path) |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
102 c.url_next = url('files_home', repo_name=c.repo_name, |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
103 revision=next_rev, f_path=f_path) |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
104 |
138
5f42d751c719
fixed files when repository is empty
Marcin Kuzminski <marcin@python-works.com>
parents:
131
diff
changeset
|
105 try: |
1136
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
106 c.files_list = c.changeset.get_node(f_path) |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
107 c.file_history = self._get_history(c.repo, c.files_list, f_path) |
644
c8bd0e6cc3da
some changes for #45.
Marcin Kuzminski <marcin@python-works.com>
parents:
636
diff
changeset
|
108 except RepositoryError, e: |
c8bd0e6cc3da
some changes for #45.
Marcin Kuzminski <marcin@python-works.com>
parents:
636
diff
changeset
|
109 h.flash(str(e), category='warning') |
1136
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
110 redirect(h.url('files_home', repo_name=repo_name, |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
111 revision=revision)) |
644
c8bd0e6cc3da
some changes for #45.
Marcin Kuzminski <marcin@python-works.com>
parents:
636
diff
changeset
|
112 |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
113 |
128
9deb6f1d5b90
Implemented file history.
Marcin Kuzminski <marcin@python-works.com>
parents:
106
diff
changeset
|
114 return render('files/files.html') |
9deb6f1d5b90
Implemented file history.
Marcin Kuzminski <marcin@python-works.com>
parents:
106
diff
changeset
|
115 |
147
873fd2dc62c2
Added rawfile support, and few fixes for file
Marcin Kuzminski <marcin@python-works.com>
parents:
145
diff
changeset
|
116 def rawfile(self, repo_name, revision, f_path): |
1136
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
117 cs = self.__get_cs_or_redirect(revision, repo_name) |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
118 try: |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
119 file_node = cs.get_node(f_path) |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
120 except RepositoryError, e: |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
121 h.flash(str(e), category='warning') |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
122 redirect(h.url('files_home', repo_name=repo_name, |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
123 revision=cs.raw_id)) |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
124 |
1218
3d9da7893fdb
fixes for stable
Marcin Kuzminski <marcin@python-works.com>
parents:
1217
diff
changeset
|
125 fname = f_path.split(os.sep)[-1].encode('utf8', 'replace') |
1136
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
126 |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
127 response.content_disposition = 'attachment; filename=%s' % fname |
160
0f7f93df5802
implemented rawdiff and diff download into diff view.
Marcin Kuzminski <marcin@python-works.com>
parents:
158
diff
changeset
|
128 response.content_type = file_node.mimetype |
147
873fd2dc62c2
Added rawfile support, and few fixes for file
Marcin Kuzminski <marcin@python-works.com>
parents:
145
diff
changeset
|
129 return file_node.content |
485
9836541b0509
added limit for showing pygemntized source codes larger than 250kb.
Marcin Kuzminski <marcin@python-works.com>
parents:
438
diff
changeset
|
130 |
9836541b0509
added limit for showing pygemntized source codes larger than 250kb.
Marcin Kuzminski <marcin@python-works.com>
parents:
438
diff
changeset
|
131 def raw(self, repo_name, revision, f_path): |
1136
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
132 cs = self.__get_cs_or_redirect(revision, repo_name) |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
133 try: |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
134 file_node = cs.get_node(f_path) |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
135 except RepositoryError, e: |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
136 h.flash(str(e), category='warning') |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
137 redirect(h.url('files_home', repo_name=repo_name, |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
138 revision=cs.raw_id)) |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
139 |
485
9836541b0509
added limit for showing pygemntized source codes larger than 250kb.
Marcin Kuzminski <marcin@python-works.com>
parents:
438
diff
changeset
|
140 response.content_type = 'text/plain' |
9836541b0509
added limit for showing pygemntized source codes larger than 250kb.
Marcin Kuzminski <marcin@python-works.com>
parents:
438
diff
changeset
|
141 return file_node.content |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
142 |
191
b68b2246e5a6
Authenticated controller with LoginRequired decorator, and cleaned __before__ (used in baseController now). fixed User for clone url with logged in session user.
Marcin Kuzminski <marcin@python-works.com>
parents:
160
diff
changeset
|
143 def annotate(self, repo_name, revision, f_path): |
1136
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
144 cs = self.__get_cs_or_redirect(revision, repo_name) |
774
c47152c5fe01
added tags, and branches to file history select box, fixed annotation changeset errors crash on wrongly given revions
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
145 try: |
1136
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
146 c.file = cs.get_node(f_path) |
774
c47152c5fe01
added tags, and branches to file history select box, fixed annotation changeset errors crash on wrongly given revions
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
147 except RepositoryError, e: |
c47152c5fe01
added tags, and branches to file history select box, fixed annotation changeset errors crash on wrongly given revions
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
148 h.flash(str(e), category='warning') |
1136
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
149 redirect(h.url('files_home', repo_name=repo_name, revision=cs.raw_id)) |
774
c47152c5fe01
added tags, and branches to file history select box, fixed annotation changeset errors crash on wrongly given revions
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
150 |
1136
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
151 c.file_history = self._get_history(ScmModel().get_repo(c.repo_name), c.file, f_path) |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
152 c.cs = cs |
191
b68b2246e5a6
Authenticated controller with LoginRequired decorator, and cleaned __before__ (used in baseController now). fixed User for clone url with logged in session user.
Marcin Kuzminski <marcin@python-works.com>
parents:
160
diff
changeset
|
153 c.f_path = f_path |
335
588c6147efc7
removed unneded value
Marcin Kuzminski <marcin@python-works.com>
parents:
318
diff
changeset
|
154 |
191
b68b2246e5a6
Authenticated controller with LoginRequired decorator, and cleaned __before__ (used in baseController now). fixed User for clone url with logged in session user.
Marcin Kuzminski <marcin@python-works.com>
parents:
160
diff
changeset
|
155 return render('files/files_annotate.html') |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
156 |
149
b3c93efd1c97
Updated template for summary (archives links)
Marcin Kuzminski <marcin@python-works.com>
parents:
147
diff
changeset
|
157 def archivefile(self, repo_name, revision, fileformat): |
209
1a18994cdc3b
Added archives support. Version bump
Marcin Kuzminski <marcin@python-works.com>
parents:
191
diff
changeset
|
158 archive_specs = { |
1a18994cdc3b
Added archives support. Version bump
Marcin Kuzminski <marcin@python-works.com>
parents:
191
diff
changeset
|
159 '.tar.bz2': ('application/x-tar', 'tbz2'), |
1a18994cdc3b
Added archives support. Version bump
Marcin Kuzminski <marcin@python-works.com>
parents:
191
diff
changeset
|
160 '.tar.gz': ('application/x-tar', 'tgz'), |
1a18994cdc3b
Added archives support. Version bump
Marcin Kuzminski <marcin@python-works.com>
parents:
191
diff
changeset
|
161 '.zip': ('application/zip', 'zip'), |
1a18994cdc3b
Added archives support. Version bump
Marcin Kuzminski <marcin@python-works.com>
parents:
191
diff
changeset
|
162 } |
1a18994cdc3b
Added archives support. Version bump
Marcin Kuzminski <marcin@python-works.com>
parents:
191
diff
changeset
|
163 if not archive_specs.has_key(fileformat): |
1a18994cdc3b
Added archives support. Version bump
Marcin Kuzminski <marcin@python-works.com>
parents:
191
diff
changeset
|
164 return 'Unknown archive type %s' % fileformat |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
165 |
209
1a18994cdc3b
Added archives support. Version bump
Marcin Kuzminski <marcin@python-works.com>
parents:
191
diff
changeset
|
166 def read_in_chunks(file_object, chunk_size=1024 * 40): |
1a18994cdc3b
Added archives support. Version bump
Marcin Kuzminski <marcin@python-works.com>
parents:
191
diff
changeset
|
167 """Lazy function (generator) to read a file piece by piece. |
1a18994cdc3b
Added archives support. Version bump
Marcin Kuzminski <marcin@python-works.com>
parents:
191
diff
changeset
|
168 Default chunk size: 40k.""" |
1a18994cdc3b
Added archives support. Version bump
Marcin Kuzminski <marcin@python-works.com>
parents:
191
diff
changeset
|
169 while True: |
1a18994cdc3b
Added archives support. Version bump
Marcin Kuzminski <marcin@python-works.com>
parents:
191
diff
changeset
|
170 data = file_object.read(chunk_size) |
1a18994cdc3b
Added archives support. Version bump
Marcin Kuzminski <marcin@python-works.com>
parents:
191
diff
changeset
|
171 if not data: |
1a18994cdc3b
Added archives support. Version bump
Marcin Kuzminski <marcin@python-works.com>
parents:
191
diff
changeset
|
172 break |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
173 yield data |
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
174 |
209
1a18994cdc3b
Added archives support. Version bump
Marcin Kuzminski <marcin@python-works.com>
parents:
191
diff
changeset
|
175 archive = tempfile.TemporaryFile() |
691
7486da5f0628
Refactor codes for scm model
Marcin Kuzminski <marcin@python-works.com>
parents:
662
diff
changeset
|
176 repo = ScmModel().get_repo(repo_name).repo |
209
1a18994cdc3b
Added archives support. Version bump
Marcin Kuzminski <marcin@python-works.com>
parents:
191
diff
changeset
|
177 fname = '%s-%s%s' % (repo_name, revision, fileformat) |
1a18994cdc3b
Added archives support. Version bump
Marcin Kuzminski <marcin@python-works.com>
parents:
191
diff
changeset
|
178 archival.archive(repo, archive, revision, archive_specs[fileformat][1], |
1a18994cdc3b
Added archives support. Version bump
Marcin Kuzminski <marcin@python-works.com>
parents:
191
diff
changeset
|
179 prefix='%s-%s' % (repo_name, revision)) |
1a18994cdc3b
Added archives support. Version bump
Marcin Kuzminski <marcin@python-works.com>
parents:
191
diff
changeset
|
180 response.content_type = archive_specs[fileformat][0] |
1a18994cdc3b
Added archives support. Version bump
Marcin Kuzminski <marcin@python-works.com>
parents:
191
diff
changeset
|
181 response.content_disposition = 'attachment; filename=%s' % fname |
1a18994cdc3b
Added archives support. Version bump
Marcin Kuzminski <marcin@python-works.com>
parents:
191
diff
changeset
|
182 archive.seek(0) |
1a18994cdc3b
Added archives support. Version bump
Marcin Kuzminski <marcin@python-works.com>
parents:
191
diff
changeset
|
183 return read_in_chunks(archive) |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
184 |
129
42d46deb124d
implemented simple diffs for history of files.
Marcin Kuzminski <marcin@python-works.com>
parents:
128
diff
changeset
|
185 def diff(self, repo_name, f_path): |
691
7486da5f0628
Refactor codes for scm model
Marcin Kuzminski <marcin@python-works.com>
parents:
662
diff
changeset
|
186 hg_model = ScmModel() |
129
42d46deb124d
implemented simple diffs for history of files.
Marcin Kuzminski <marcin@python-works.com>
parents:
128
diff
changeset
|
187 diff1 = request.GET.get('diff1') |
42d46deb124d
implemented simple diffs for history of files.
Marcin Kuzminski <marcin@python-works.com>
parents:
128
diff
changeset
|
188 diff2 = request.GET.get('diff2') |
337
fa3835d34fc1
fixed bug when diff command was different than available options
Marcin Kuzminski <marcin@python-works.com>
parents:
335
diff
changeset
|
189 c.action = request.GET.get('diff') |
131
49c7e191c2cd
Implemented mercurial style diff-lib
Marcin Kuzminski <marcin@python-works.com>
parents:
130
diff
changeset
|
190 c.no_changes = diff1 == diff2 |
129
42d46deb124d
implemented simple diffs for history of files.
Marcin Kuzminski <marcin@python-works.com>
parents:
128
diff
changeset
|
191 c.f_path = f_path |
42d46deb124d
implemented simple diffs for history of files.
Marcin Kuzminski <marcin@python-works.com>
parents:
128
diff
changeset
|
192 c.repo = hg_model.get_repo(c.repo_name) |
152
0c00fbaff55a
Fixed differ to properly extract filenames, and dates from diff file. and swaped order of columns with lines nr in diff html
Marcin Kuzminski <marcin@python-works.com>
parents:
149
diff
changeset
|
193 |
275
2d61aa00e855
fixed bugs when putting empty or unknown changesets into diff
Marcin Kuzminski <marcin@python-works.com>
parents:
272
diff
changeset
|
194 try: |
544
d8778cde98f0
added limits to single file diffs
Marcin Kuzminski <marcin@python-works.com>
parents:
512
diff
changeset
|
195 if diff1 not in ['', None, 'None', '0' * 12, '0' * 40]: |
275
2d61aa00e855
fixed bugs when putting empty or unknown changesets into diff
Marcin Kuzminski <marcin@python-works.com>
parents:
272
diff
changeset
|
196 c.changeset_1 = c.repo.get_changeset(diff1) |
2d61aa00e855
fixed bugs when putting empty or unknown changesets into diff
Marcin Kuzminski <marcin@python-works.com>
parents:
272
diff
changeset
|
197 node1 = c.changeset_1.get_node(f_path) |
2d61aa00e855
fixed bugs when putting empty or unknown changesets into diff
Marcin Kuzminski <marcin@python-works.com>
parents:
272
diff
changeset
|
198 else: |
2d61aa00e855
fixed bugs when putting empty or unknown changesets into diff
Marcin Kuzminski <marcin@python-works.com>
parents:
272
diff
changeset
|
199 c.changeset_1 = EmptyChangeset() |
544
d8778cde98f0
added limits to single file diffs
Marcin Kuzminski <marcin@python-works.com>
parents:
512
diff
changeset
|
200 node1 = FileNode('.', '', changeset=c.changeset_1) |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
201 |
544
d8778cde98f0
added limits to single file diffs
Marcin Kuzminski <marcin@python-works.com>
parents:
512
diff
changeset
|
202 if diff2 not in ['', None, 'None', '0' * 12, '0' * 40]: |
275
2d61aa00e855
fixed bugs when putting empty or unknown changesets into diff
Marcin Kuzminski <marcin@python-works.com>
parents:
272
diff
changeset
|
203 c.changeset_2 = c.repo.get_changeset(diff2) |
2d61aa00e855
fixed bugs when putting empty or unknown changesets into diff
Marcin Kuzminski <marcin@python-works.com>
parents:
272
diff
changeset
|
204 node2 = c.changeset_2.get_node(f_path) |
2d61aa00e855
fixed bugs when putting empty or unknown changesets into diff
Marcin Kuzminski <marcin@python-works.com>
parents:
272
diff
changeset
|
205 else: |
2d61aa00e855
fixed bugs when putting empty or unknown changesets into diff
Marcin Kuzminski <marcin@python-works.com>
parents:
272
diff
changeset
|
206 c.changeset_2 = EmptyChangeset() |
544
d8778cde98f0
added limits to single file diffs
Marcin Kuzminski <marcin@python-works.com>
parents:
512
diff
changeset
|
207 node2 = FileNode('.', '', changeset=c.changeset_2) |
275
2d61aa00e855
fixed bugs when putting empty or unknown changesets into diff
Marcin Kuzminski <marcin@python-works.com>
parents:
272
diff
changeset
|
208 except RepositoryError: |
2d61aa00e855
fixed bugs when putting empty or unknown changesets into diff
Marcin Kuzminski <marcin@python-works.com>
parents:
272
diff
changeset
|
209 return redirect(url('files_home', |
2d61aa00e855
fixed bugs when putting empty or unknown changesets into diff
Marcin Kuzminski <marcin@python-works.com>
parents:
272
diff
changeset
|
210 repo_name=c.repo_name, f_path=f_path)) |
2d61aa00e855
fixed bugs when putting empty or unknown changesets into diff
Marcin Kuzminski <marcin@python-works.com>
parents:
272
diff
changeset
|
211 |
2d61aa00e855
fixed bugs when putting empty or unknown changesets into diff
Marcin Kuzminski <marcin@python-works.com>
parents:
272
diff
changeset
|
212 f_udiff = differ.get_udiff(node1, node2) |
160
0f7f93df5802
implemented rawdiff and diff download into diff view.
Marcin Kuzminski <marcin@python-works.com>
parents:
158
diff
changeset
|
213 diff = differ.DiffProcessor(f_udiff) |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
214 |
337
fa3835d34fc1
fixed bug when diff command was different than available options
Marcin Kuzminski <marcin@python-works.com>
parents:
335
diff
changeset
|
215 if c.action == 'download': |
160
0f7f93df5802
implemented rawdiff and diff download into diff view.
Marcin Kuzminski <marcin@python-works.com>
parents:
158
diff
changeset
|
216 diff_name = '%s_vs_%s.diff' % (diff1, diff2) |
0f7f93df5802
implemented rawdiff and diff download into diff view.
Marcin Kuzminski <marcin@python-works.com>
parents:
158
diff
changeset
|
217 response.content_type = 'text/plain' |
0f7f93df5802
implemented rawdiff and diff download into diff view.
Marcin Kuzminski <marcin@python-works.com>
parents:
158
diff
changeset
|
218 response.content_disposition = 'attachment; filename=%s' \ |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
219 % diff_name |
1136
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
220 if node1.is_binary or node2.is_binary: |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
221 return _('binary file changed') |
160
0f7f93df5802
implemented rawdiff and diff download into diff view.
Marcin Kuzminski <marcin@python-works.com>
parents:
158
diff
changeset
|
222 return diff.raw_diff() |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
223 |
337
fa3835d34fc1
fixed bug when diff command was different than available options
Marcin Kuzminski <marcin@python-works.com>
parents:
335
diff
changeset
|
224 elif c.action == 'raw': |
649
3765f0f479a2
fixed raw diff as purly raw without html
Marcin Kuzminski <marcin@python-works.com>
parents:
644
diff
changeset
|
225 response.content_type = 'text/plain' |
1136
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
226 if node1.is_binary or node2.is_binary: |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
227 return _('binary file changed') |
649
3765f0f479a2
fixed raw diff as purly raw without html
Marcin Kuzminski <marcin@python-works.com>
parents:
644
diff
changeset
|
228 return diff.raw_diff() |
662
373ee7031003
fixed annotation bug, added history to annotation.
Marcin Kuzminski <marcin@python-works.com>
parents:
649
diff
changeset
|
229 |
337
fa3835d34fc1
fixed bug when diff command was different than available options
Marcin Kuzminski <marcin@python-works.com>
parents:
335
diff
changeset
|
230 elif c.action == 'diff': |
812
30ad41c76fae
fixes #79 cut off limit was added into .ini config files
Marcin Kuzminski <marcin@python-works.com>
parents:
774
diff
changeset
|
231 if node1.size > self.cut_off_limit or node2.size > self.cut_off_limit: |
544
d8778cde98f0
added limits to single file diffs
Marcin Kuzminski <marcin@python-works.com>
parents:
512
diff
changeset
|
232 c.cur_diff = _('Diff is to big to display') |
1136
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
233 elif node1.is_binary or node2.is_binary: |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
234 c.cur_diff = _('Binary file') |
544
d8778cde98f0
added limits to single file diffs
Marcin Kuzminski <marcin@python-works.com>
parents:
512
diff
changeset
|
235 else: |
d8778cde98f0
added limits to single file diffs
Marcin Kuzminski <marcin@python-works.com>
parents:
512
diff
changeset
|
236 c.cur_diff = diff.as_html() |
337
fa3835d34fc1
fixed bug when diff command was different than available options
Marcin Kuzminski <marcin@python-works.com>
parents:
335
diff
changeset
|
237 else: |
fa3835d34fc1
fixed bug when diff command was different than available options
Marcin Kuzminski <marcin@python-works.com>
parents:
335
diff
changeset
|
238 #default option |
812
30ad41c76fae
fixes #79 cut off limit was added into .ini config files
Marcin Kuzminski <marcin@python-works.com>
parents:
774
diff
changeset
|
239 if node1.size > self.cut_off_limit or node2.size > self.cut_off_limit: |
544
d8778cde98f0
added limits to single file diffs
Marcin Kuzminski <marcin@python-works.com>
parents:
512
diff
changeset
|
240 c.cur_diff = _('Diff is to big to display') |
1136
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
241 elif node1.is_binary or node2.is_binary: |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
242 c.cur_diff = _('Binary file') |
544
d8778cde98f0
added limits to single file diffs
Marcin Kuzminski <marcin@python-works.com>
parents:
512
diff
changeset
|
243 else: |
d8778cde98f0
added limits to single file diffs
Marcin Kuzminski <marcin@python-works.com>
parents:
512
diff
changeset
|
244 c.cur_diff = diff.as_html() |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
245 |
1136
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
246 if not c.cur_diff: |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
921
diff
changeset
|
247 c.no_changes = True |
129
42d46deb124d
implemented simple diffs for history of files.
Marcin Kuzminski <marcin@python-works.com>
parents:
128
diff
changeset
|
248 return render('files/file_diff.html') |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
249 |
128
9deb6f1d5b90
Implemented file history.
Marcin Kuzminski <marcin@python-works.com>
parents:
106
diff
changeset
|
250 def _get_history(self, repo, node, f_path): |
9deb6f1d5b90
Implemented file history.
Marcin Kuzminski <marcin@python-works.com>
parents:
106
diff
changeset
|
251 from vcs.nodes import NodeKind |
9deb6f1d5b90
Implemented file history.
Marcin Kuzminski <marcin@python-works.com>
parents:
106
diff
changeset
|
252 if not node.kind is NodeKind.FILE: |
9deb6f1d5b90
Implemented file history.
Marcin Kuzminski <marcin@python-works.com>
parents:
106
diff
changeset
|
253 return [] |
129
42d46deb124d
implemented simple diffs for history of files.
Marcin Kuzminski <marcin@python-works.com>
parents:
128
diff
changeset
|
254 changesets = node.history |
128
9deb6f1d5b90
Implemented file history.
Marcin Kuzminski <marcin@python-works.com>
parents:
106
diff
changeset
|
255 hist_l = [] |
774
c47152c5fe01
added tags, and branches to file history select box, fixed annotation changeset errors crash on wrongly given revions
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
256 |
c47152c5fe01
added tags, and branches to file history select box, fixed annotation changeset errors crash on wrongly given revions
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
257 changesets_group = ([], _("Changesets")) |
c47152c5fe01
added tags, and branches to file history select box, fixed annotation changeset errors crash on wrongly given revions
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
258 branches_group = ([], _("Branches")) |
c47152c5fe01
added tags, and branches to file history select box, fixed annotation changeset errors crash on wrongly given revions
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
259 tags_group = ([], _("Tags")) |
c47152c5fe01
added tags, and branches to file history select box, fixed annotation changeset errors crash on wrongly given revions
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
260 |
128
9deb6f1d5b90
Implemented file history.
Marcin Kuzminski <marcin@python-works.com>
parents:
106
diff
changeset
|
261 for chs in changesets: |
512
d945c95ba4ac
refactoring for new vcs implementation
Marcin Kuzminski <marcin@python-works.com>
parents:
485
diff
changeset
|
262 n_desc = 'r%s:%s' % (chs.revision, chs.short_id) |
774
c47152c5fe01
added tags, and branches to file history select box, fixed annotation changeset errors crash on wrongly given revions
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
263 changesets_group[0].append((chs.raw_id, n_desc,)) |
c47152c5fe01
added tags, and branches to file history select box, fixed annotation changeset errors crash on wrongly given revions
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
264 |
c47152c5fe01
added tags, and branches to file history select box, fixed annotation changeset errors crash on wrongly given revions
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
265 hist_l.append(changesets_group) |
c47152c5fe01
added tags, and branches to file history select box, fixed annotation changeset errors crash on wrongly given revions
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
266 |
c47152c5fe01
added tags, and branches to file history select box, fixed annotation changeset errors crash on wrongly given revions
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
267 for name, chs in c.repository_branches.items(): |
c47152c5fe01
added tags, and branches to file history select box, fixed annotation changeset errors crash on wrongly given revions
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
268 #chs = chs.split(':')[-1] |
c47152c5fe01
added tags, and branches to file history select box, fixed annotation changeset errors crash on wrongly given revions
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
269 branches_group[0].append((chs, name),) |
c47152c5fe01
added tags, and branches to file history select box, fixed annotation changeset errors crash on wrongly given revions
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
270 hist_l.append(branches_group) |
c47152c5fe01
added tags, and branches to file history select box, fixed annotation changeset errors crash on wrongly given revions
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
271 |
c47152c5fe01
added tags, and branches to file history select box, fixed annotation changeset errors crash on wrongly given revions
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
272 for name, chs in c.repository_tags.items(): |
c47152c5fe01
added tags, and branches to file history select box, fixed annotation changeset errors crash on wrongly given revions
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
273 #chs = chs.split(':')[-1] |
c47152c5fe01
added tags, and branches to file history select box, fixed annotation changeset errors crash on wrongly given revions
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
274 tags_group[0].append((chs, name),) |
c47152c5fe01
added tags, and branches to file history select box, fixed annotation changeset errors crash on wrongly given revions
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
275 hist_l.append(tags_group) |
c47152c5fe01
added tags, and branches to file history select box, fixed annotation changeset errors crash on wrongly given revions
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
276 |
128
9deb6f1d5b90
Implemented file history.
Marcin Kuzminski <marcin@python-works.com>
parents:
106
diff
changeset
|
277 return hist_l |