annotate pylons_app/controllers/changeset.py @ 512:d945c95ba4ac

refactoring for new vcs implementation renamed all ._short and .raw_id into .short_id updated dependency for vcs to 0.1.6
author Marcin Kuzminski <marcin@python-works.com>
date Tue, 28 Sep 2010 20:25:58 +0000
parents 9dd372c7166c
children a99e23e6c1e8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
252
3782a6d698af licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents: 245
diff changeset
1 #!/usr/bin/env python
3782a6d698af licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents: 245
diff changeset
2 # encoding: utf-8
3782a6d698af licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents: 245
diff changeset
3 # changeset controller for pylons
3782a6d698af licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents: 245
diff changeset
4 # Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>
3782a6d698af licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents: 245
diff changeset
5 # This program is free software; you can redistribute it and/or
3782a6d698af licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents: 245
diff changeset
6 # modify it under the terms of the GNU General Public License
3782a6d698af licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents: 245
diff changeset
7 # as published by the Free Software Foundation; version 2
3782a6d698af licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents: 245
diff changeset
8 # of the License or (at your opinion) any later version of the license.
3782a6d698af licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents: 245
diff changeset
9 #
3782a6d698af licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents: 245
diff changeset
10 # 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
11 # 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
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3782a6d698af licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents: 245
diff changeset
13 # GNU General Public License for more details.
3782a6d698af licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents: 245
diff changeset
14 #
3782a6d698af licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents: 245
diff changeset
15 # You should have received a copy of the GNU General Public License
3782a6d698af licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents: 245
diff changeset
16 # along with this program; if not, write to the Free Software
3782a6d698af licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents: 245
diff changeset
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
3782a6d698af licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents: 245
diff changeset
18 # MA 02110-1301, USA.
3782a6d698af licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents: 245
diff changeset
19 """
3782a6d698af licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents: 245
diff changeset
20 Created on April 25, 2010
3782a6d698af licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents: 245
diff changeset
21 changeset controller for pylons
3782a6d698af licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents: 245
diff changeset
22 @author: marcink
3782a6d698af licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents: 245
diff changeset
23 """
466
183cee110578 first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents: 318
diff changeset
24 from pylons import tmpl_context as c, url, request, response
318
fdf9f6ee5217 Implemented permissions into hg app, secured admin controllers, templates and repository specific controllers
Marcin Kuzminski <marcin@python-works.com>
parents: 285
diff changeset
25 from pylons.controllers.util import redirect
fdf9f6ee5217 Implemented permissions into hg app, secured admin controllers, templates and repository specific controllers
Marcin Kuzminski <marcin@python-works.com>
parents: 285
diff changeset
26 from pylons_app.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator
fdf9f6ee5217 Implemented permissions into hg app, secured admin controllers, templates and repository specific controllers
Marcin Kuzminski <marcin@python-works.com>
parents: 285
diff changeset
27 from pylons_app.lib.base import BaseController, render
fdf9f6ee5217 Implemented permissions into hg app, secured admin controllers, templates and repository specific controllers
Marcin Kuzminski <marcin@python-works.com>
parents: 285
diff changeset
28 from pylons_app.model.hg_model import HgModel
fdf9f6ee5217 Implemented permissions into hg app, secured admin controllers, templates and repository specific controllers
Marcin Kuzminski <marcin@python-works.com>
parents: 285
diff changeset
29 from vcs.exceptions import RepositoryError
fdf9f6ee5217 Implemented permissions into hg app, secured admin controllers, templates and repository specific controllers
Marcin Kuzminski <marcin@python-works.com>
parents: 285
diff changeset
30 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: 285
diff changeset
31 from vcs.utils import diffs as differ
fdf9f6ee5217 Implemented permissions into hg app, secured admin controllers, templates and repository specific controllers
Marcin Kuzminski <marcin@python-works.com>
parents: 285
diff changeset
32 import logging
fdf9f6ee5217 Implemented permissions into hg app, secured admin controllers, templates and repository specific controllers
Marcin Kuzminski <marcin@python-works.com>
parents: 285
diff changeset
33 import traceback
193
50a39f923f31 Added file annotation template. Bumped version to 0.6.8. Changelog and changeset are now cleaned with js, it's still very beta.
Marcin Kuzminski <marcin@python-works.com>
parents: 103
diff changeset
34
103
665b344927f4 Added changeset controllers
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
35 log = logging.getLogger(__name__)
665b344927f4 Added changeset controllers
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
36
665b344927f4 Added changeset controllers
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
37 class ChangesetController(BaseController):
193
50a39f923f31 Added file annotation template. Bumped version to 0.6.8. Changelog and changeset are now cleaned with js, it's still very beta.
Marcin Kuzminski <marcin@python-works.com>
parents: 103
diff changeset
38
50a39f923f31 Added file annotation template. Bumped version to 0.6.8. Changelog and changeset are now cleaned with js, it's still very beta.
Marcin Kuzminski <marcin@python-works.com>
parents: 103
diff changeset
39 @LoginRequired()
318
fdf9f6ee5217 Implemented permissions into hg app, secured admin controllers, templates and repository specific controllers
Marcin Kuzminski <marcin@python-works.com>
parents: 285
diff changeset
40 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
fdf9f6ee5217 Implemented permissions into hg app, secured admin controllers, templates and repository specific controllers
Marcin Kuzminski <marcin@python-works.com>
parents: 285
diff changeset
41 'repository.admin')
103
665b344927f4 Added changeset controllers
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
42 def __before__(self):
193
50a39f923f31 Added file annotation template. Bumped version to 0.6.8. Changelog and changeset are now cleaned with js, it's still very beta.
Marcin Kuzminski <marcin@python-works.com>
parents: 103
diff changeset
43 super(ChangesetController, self).__before__()
103
665b344927f4 Added changeset controllers
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
44
193
50a39f923f31 Added file annotation template. Bumped version to 0.6.8. Changelog and changeset are now cleaned with js, it's still very beta.
Marcin Kuzminski <marcin@python-works.com>
parents: 103
diff changeset
45 def index(self, revision):
50a39f923f31 Added file annotation template. Bumped version to 0.6.8. Changelog and changeset are now cleaned with js, it's still very beta.
Marcin Kuzminski <marcin@python-works.com>
parents: 103
diff changeset
46 hg_model = HgModel()
285
42f5c36820ef few validation bugfixes/ new repo changesets, first commit changesets
Marcin Kuzminski <marcin@python-works.com>
parents: 273
diff changeset
47 try:
42f5c36820ef few validation bugfixes/ new repo changesets, first commit changesets
Marcin Kuzminski <marcin@python-works.com>
parents: 273
diff changeset
48 c.changeset = hg_model.get_repo(c.repo_name).get_changeset(revision)
42f5c36820ef few validation bugfixes/ new repo changesets, first commit changesets
Marcin Kuzminski <marcin@python-works.com>
parents: 273
diff changeset
49 except RepositoryError:
42f5c36820ef few validation bugfixes/ new repo changesets, first commit changesets
Marcin Kuzminski <marcin@python-works.com>
parents: 273
diff changeset
50 log.error(traceback.format_exc())
42f5c36820ef few validation bugfixes/ new repo changesets, first commit changesets
Marcin Kuzminski <marcin@python-works.com>
parents: 273
diff changeset
51 return redirect(url('hg_home'))
42f5c36820ef few validation bugfixes/ new repo changesets, first commit changesets
Marcin Kuzminski <marcin@python-works.com>
parents: 273
diff changeset
52 else:
42f5c36820ef few validation bugfixes/ new repo changesets, first commit changesets
Marcin Kuzminski <marcin@python-works.com>
parents: 273
diff changeset
53 try:
42f5c36820ef few validation bugfixes/ new repo changesets, first commit changesets
Marcin Kuzminski <marcin@python-works.com>
parents: 273
diff changeset
54 c.changeset_old = c.changeset.parents[0]
42f5c36820ef few validation bugfixes/ new repo changesets, first commit changesets
Marcin Kuzminski <marcin@python-works.com>
parents: 273
diff changeset
55 except IndexError:
42f5c36820ef few validation bugfixes/ new repo changesets, first commit changesets
Marcin Kuzminski <marcin@python-works.com>
parents: 273
diff changeset
56 c.changeset_old = None
42f5c36820ef few validation bugfixes/ new repo changesets, first commit changesets
Marcin Kuzminski <marcin@python-works.com>
parents: 273
diff changeset
57 c.changes = []
42f5c36820ef few validation bugfixes/ new repo changesets, first commit changesets
Marcin Kuzminski <marcin@python-works.com>
parents: 273
diff changeset
58
42f5c36820ef few validation bugfixes/ new repo changesets, first commit changesets
Marcin Kuzminski <marcin@python-works.com>
parents: 273
diff changeset
59 for node in c.changeset.added:
42f5c36820ef few validation bugfixes/ new repo changesets, first commit changesets
Marcin Kuzminski <marcin@python-works.com>
parents: 273
diff changeset
60 filenode_old = FileNode(node.path, '')
42f5c36820ef few validation bugfixes/ new repo changesets, first commit changesets
Marcin Kuzminski <marcin@python-works.com>
parents: 273
diff changeset
61 if filenode_old.is_binary or node.is_binary:
42f5c36820ef few validation bugfixes/ new repo changesets, first commit changesets
Marcin Kuzminski <marcin@python-works.com>
parents: 273
diff changeset
62 diff = 'binary file'
42f5c36820ef few validation bugfixes/ new repo changesets, first commit changesets
Marcin Kuzminski <marcin@python-works.com>
parents: 273
diff changeset
63 else:
42f5c36820ef few validation bugfixes/ new repo changesets, first commit changesets
Marcin Kuzminski <marcin@python-works.com>
parents: 273
diff changeset
64 f_udiff = differ.get_udiff(filenode_old, node)
42f5c36820ef few validation bugfixes/ new repo changesets, first commit changesets
Marcin Kuzminski <marcin@python-works.com>
parents: 273
diff changeset
65 diff = differ.DiffProcessor(f_udiff).as_html()
466
183cee110578 first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents: 318
diff changeset
66
285
42f5c36820ef few validation bugfixes/ new repo changesets, first commit changesets
Marcin Kuzminski <marcin@python-works.com>
parents: 273
diff changeset
67 cs1 = None
512
d945c95ba4ac refactoring for new vcs implementation
Marcin Kuzminski <marcin@python-works.com>
parents: 468
diff changeset
68 cs2 = node.last_changeset.short_id
285
42f5c36820ef few validation bugfixes/ new repo changesets, first commit changesets
Marcin Kuzminski <marcin@python-works.com>
parents: 273
diff changeset
69 c.changes.append(('added', node, diff, cs1, cs2))
218
58b46f9194c3 version bump. Made changesets work as should, but vcs had to be fixed for that.
Marcin Kuzminski <marcin@python-works.com>
parents: 193
diff changeset
70
285
42f5c36820ef few validation bugfixes/ new repo changesets, first commit changesets
Marcin Kuzminski <marcin@python-works.com>
parents: 273
diff changeset
71 for node in c.changeset.changed:
42f5c36820ef few validation bugfixes/ new repo changesets, first commit changesets
Marcin Kuzminski <marcin@python-works.com>
parents: 273
diff changeset
72 filenode_old = c.changeset_old.get_node(node.path)
42f5c36820ef few validation bugfixes/ new repo changesets, first commit changesets
Marcin Kuzminski <marcin@python-works.com>
parents: 273
diff changeset
73 if filenode_old.is_binary or node.is_binary:
42f5c36820ef few validation bugfixes/ new repo changesets, first commit changesets
Marcin Kuzminski <marcin@python-works.com>
parents: 273
diff changeset
74 diff = 'binary file'
42f5c36820ef few validation bugfixes/ new repo changesets, first commit changesets
Marcin Kuzminski <marcin@python-works.com>
parents: 273
diff changeset
75 else:
42f5c36820ef few validation bugfixes/ new repo changesets, first commit changesets
Marcin Kuzminski <marcin@python-works.com>
parents: 273
diff changeset
76 f_udiff = differ.get_udiff(filenode_old, node)
42f5c36820ef few validation bugfixes/ new repo changesets, first commit changesets
Marcin Kuzminski <marcin@python-works.com>
parents: 273
diff changeset
77 diff = differ.DiffProcessor(f_udiff).as_html()
466
183cee110578 first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents: 318
diff changeset
78
512
d945c95ba4ac refactoring for new vcs implementation
Marcin Kuzminski <marcin@python-works.com>
parents: 468
diff changeset
79 cs1 = filenode_old.last_changeset.short_id
d945c95ba4ac refactoring for new vcs implementation
Marcin Kuzminski <marcin@python-works.com>
parents: 468
diff changeset
80 cs2 = node.last_changeset.short_id
285
42f5c36820ef few validation bugfixes/ new repo changesets, first commit changesets
Marcin Kuzminski <marcin@python-works.com>
parents: 273
diff changeset
81 c.changes.append(('changed', node, diff, cs1, cs2))
42f5c36820ef few validation bugfixes/ new repo changesets, first commit changesets
Marcin Kuzminski <marcin@python-works.com>
parents: 273
diff changeset
82
42f5c36820ef few validation bugfixes/ new repo changesets, first commit changesets
Marcin Kuzminski <marcin@python-works.com>
parents: 273
diff changeset
83 for node in c.changeset.removed:
42f5c36820ef few validation bugfixes/ new repo changesets, first commit changesets
Marcin Kuzminski <marcin@python-works.com>
parents: 273
diff changeset
84 c.changes.append(('removed', node, None, None, None))
218
58b46f9194c3 version bump. Made changesets work as should, but vcs had to be fixed for that.
Marcin Kuzminski <marcin@python-works.com>
parents: 193
diff changeset
85
193
50a39f923f31 Added file annotation template. Bumped version to 0.6.8. Changelog and changeset are now cleaned with js, it's still very beta.
Marcin Kuzminski <marcin@python-works.com>
parents: 103
diff changeset
86 return render('changeset/changeset.html')
466
183cee110578 first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents: 318
diff changeset
87
183cee110578 first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents: 318
diff changeset
88 def raw_changeset(self,revision):
183cee110578 first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents: 318
diff changeset
89
183cee110578 first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents: 318
diff changeset
90 hg_model = HgModel()
468
9dd372c7166c added menu for changeset raw diff and download diff
Marcin Kuzminski <marcin@python-works.com>
parents: 466
diff changeset
91 method = request.GET.get('diff','show')
466
183cee110578 first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents: 318
diff changeset
92 try:
183cee110578 first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents: 318
diff changeset
93 c.changeset = hg_model.get_repo(c.repo_name).get_changeset(revision)
183cee110578 first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents: 318
diff changeset
94 except RepositoryError:
183cee110578 first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents: 318
diff changeset
95 log.error(traceback.format_exc())
183cee110578 first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents: 318
diff changeset
96 return redirect(url('hg_home'))
183cee110578 first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents: 318
diff changeset
97 else:
183cee110578 first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents: 318
diff changeset
98 try:
183cee110578 first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents: 318
diff changeset
99 c.changeset_old = c.changeset.parents[0]
183cee110578 first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents: 318
diff changeset
100 except IndexError:
183cee110578 first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents: 318
diff changeset
101 c.changeset_old = None
183cee110578 first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents: 318
diff changeset
102 c.changes = []
183cee110578 first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents: 318
diff changeset
103
183cee110578 first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents: 318
diff changeset
104 for node in c.changeset.added:
183cee110578 first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents: 318
diff changeset
105 filenode_old = FileNode(node.path, '')
183cee110578 first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents: 318
diff changeset
106 if filenode_old.is_binary or node.is_binary:
183cee110578 first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents: 318
diff changeset
107 diff = 'binary file'
183cee110578 first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents: 318
diff changeset
108 else:
183cee110578 first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents: 318
diff changeset
109 f_udiff = differ.get_udiff(filenode_old, node)
183cee110578 first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents: 318
diff changeset
110 diff = differ.DiffProcessor(f_udiff).raw_diff()
183cee110578 first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents: 318
diff changeset
111
183cee110578 first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents: 318
diff changeset
112 cs1 = None
512
d945c95ba4ac refactoring for new vcs implementation
Marcin Kuzminski <marcin@python-works.com>
parents: 468
diff changeset
113 cs2 = node.last_changeset.short_id
466
183cee110578 first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents: 318
diff changeset
114 c.changes.append(('added', node, diff, cs1, cs2))
183cee110578 first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents: 318
diff changeset
115
183cee110578 first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents: 318
diff changeset
116 for node in c.changeset.changed:
183cee110578 first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents: 318
diff changeset
117 filenode_old = c.changeset_old.get_node(node.path)
183cee110578 first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents: 318
diff changeset
118 if filenode_old.is_binary or node.is_binary:
183cee110578 first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents: 318
diff changeset
119 diff = 'binary file'
183cee110578 first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents: 318
diff changeset
120 else:
183cee110578 first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents: 318
diff changeset
121 f_udiff = differ.get_udiff(filenode_old, node)
183cee110578 first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents: 318
diff changeset
122 diff = differ.DiffProcessor(f_udiff).raw_diff()
183cee110578 first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents: 318
diff changeset
123
512
d945c95ba4ac refactoring for new vcs implementation
Marcin Kuzminski <marcin@python-works.com>
parents: 468
diff changeset
124 cs1 = filenode_old.last_changeset.short_id
d945c95ba4ac refactoring for new vcs implementation
Marcin Kuzminski <marcin@python-works.com>
parents: 468
diff changeset
125 cs2 = node.last_changeset.short_id
466
183cee110578 first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents: 318
diff changeset
126 c.changes.append(('changed', node, diff, cs1, cs2))
183cee110578 first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents: 318
diff changeset
127
183cee110578 first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents: 318
diff changeset
128 response.content_type = 'text/plain'
468
9dd372c7166c added menu for changeset raw diff and download diff
Marcin Kuzminski <marcin@python-works.com>
parents: 466
diff changeset
129 if method == 'download':
9dd372c7166c added menu for changeset raw diff and download diff
Marcin Kuzminski <marcin@python-works.com>
parents: 466
diff changeset
130 response.content_disposition = 'attachment; filename=%s.patch' % revision
466
183cee110578 first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents: 318
diff changeset
131 parent = True if len(c.changeset.parents) > 0 else False
183cee110578 first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents: 318
diff changeset
132 c.parent_tmpl = 'Parent %s' % c.changeset.parents[0]._hex if parent else ''
183cee110578 first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents: 318
diff changeset
133
183cee110578 first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents: 318
diff changeset
134 c.diffs = ''
183cee110578 first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents: 318
diff changeset
135 for x in c.changes:
183cee110578 first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents: 318
diff changeset
136 c.diffs += x[2]
183cee110578 first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents: 318
diff changeset
137
183cee110578 first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents: 318
diff changeset
138 return render('changeset/raw_changeset.html')