Mercurial > public > src > rhodecode
comparison pylons_app/controllers/files.py @ 359:fa3835d34fc1
fixed bug when diff command was different than available options
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Tue, 06 Jul 2010 23:47:28 +0200 |
parents | 588c6147efc7 |
children | 031152a540c5 |
comparison
equal
deleted
inserted
replaced
358:871c0dd1301c | 359:fa3835d34fc1 |
---|---|
138 | 138 |
139 def diff(self, repo_name, f_path): | 139 def diff(self, repo_name, f_path): |
140 hg_model = HgModel() | 140 hg_model = HgModel() |
141 diff1 = request.GET.get('diff1') | 141 diff1 = request.GET.get('diff1') |
142 diff2 = request.GET.get('diff2') | 142 diff2 = request.GET.get('diff2') |
143 c.action = action = request.GET.get('diff') | 143 c.action = request.GET.get('diff') |
144 c.no_changes = diff1 == diff2 | 144 c.no_changes = diff1 == diff2 |
145 c.f_path = f_path | 145 c.f_path = f_path |
146 c.repo = hg_model.get_repo(c.repo_name) | 146 c.repo = hg_model.get_repo(c.repo_name) |
147 | 147 |
148 try: | 148 try: |
166 c.diff2 = 'r%s:%s' % (c.changeset_2.revision, c.changeset_2.raw_id) | 166 c.diff2 = 'r%s:%s' % (c.changeset_2.revision, c.changeset_2.raw_id) |
167 f_udiff = differ.get_udiff(node1, node2) | 167 f_udiff = differ.get_udiff(node1, node2) |
168 | 168 |
169 diff = differ.DiffProcessor(f_udiff) | 169 diff = differ.DiffProcessor(f_udiff) |
170 | 170 |
171 if action == 'download': | 171 if c.action == 'download': |
172 diff_name = '%s_vs_%s.diff' % (diff1, diff2) | 172 diff_name = '%s_vs_%s.diff' % (diff1, diff2) |
173 response.content_type = 'text/plain' | 173 response.content_type = 'text/plain' |
174 response.content_disposition = 'attachment; filename=%s' \ | 174 response.content_disposition = 'attachment; filename=%s' \ |
175 % diff_name | 175 % diff_name |
176 return diff.raw_diff() | 176 return diff.raw_diff() |
177 | 177 |
178 elif action == 'raw': | 178 elif c.action == 'raw': |
179 c.cur_diff = '<pre class="raw">%s</pre>' % h.escape(diff.raw_diff()) | 179 c.cur_diff = '<pre class="raw">%s</pre>' % h.escape(diff.raw_diff()) |
180 elif action == 'diff': | 180 elif c.action == 'diff': |
181 c.cur_diff = diff.as_html() | 181 c.cur_diff = diff.as_html() |
182 | 182 else: |
183 #default option | |
184 c.cur_diff = diff.as_html() | |
183 return render('files/file_diff.html') | 185 return render('files/file_diff.html') |
184 | 186 |
185 def _get_history(self, repo, node, f_path): | 187 def _get_history(self, repo, node, f_path): |
186 from vcs.nodes import NodeKind | 188 from vcs.nodes import NodeKind |
187 if not node.kind is NodeKind.FILE: | 189 if not node.kind is NodeKind.FILE: |