diff --git a/pylons_app/config/routing.py b/pylons_app/config/routing.py --- a/pylons_app/config/routing.py +++ b/pylons_app/config/routing.py @@ -130,7 +130,7 @@ def make_map(config): controller='changeset', revision='tip', conditions=dict(function=check_repo)) map.connect('raw_changeset_home', '/{repo_name:.*}/raw-changeset/{revision}', - controller='changeset',action='raw_changeset', revision='tip', + controller='changeset', action='raw_changeset', revision='tip', conditions=dict(function=check_repo)) map.connect('summary_home', '/{repo_name:.*}/summary', controller='summary', conditions=dict(function=check_repo)) @@ -148,9 +148,12 @@ def make_map(config): map.connect('files_diff_home', '/{repo_name:.*}/diff/{f_path:.*}', controller='files', action='diff', revision='tip', f_path='', conditions=dict(function=check_repo)) - map.connect('files_raw_home', '/{repo_name:.*}/rawfile/{revision}/{f_path:.*}', + map.connect('files_rawfile_home', '/{repo_name:.*}/rawfile/{revision}/{f_path:.*}', controller='files', action='rawfile', revision='tip', f_path='', conditions=dict(function=check_repo)) + map.connect('files_raw_home', '/{repo_name:.*}/raw/{revision}/{f_path:.*}', + controller='files', action='raw', revision='tip', f_path='', + conditions=dict(function=check_repo)) map.connect('files_annotate_home', '/{repo_name:.*}/annotate/{revision}/{f_path:.*}', controller='files', action='annotate', revision='tip', f_path='', conditions=dict(function=check_repo)) diff --git a/pylons_app/controllers/files.py b/pylons_app/controllers/files.py --- a/pylons_app/controllers/files.py +++ b/pylons_app/controllers/files.py @@ -45,6 +45,7 @@ class FilesController(BaseController): 'repository.admin') def __before__(self): super(FilesController, self).__before__() + c.file_size_limit = 250 * 1024 #limit of file size to display def index(self, repo_name, revision, f_path): hg_model = HgModel() @@ -76,7 +77,6 @@ class FilesController(BaseController): revision=next_rev, f_path=f_path) c.changeset = repo.get_changeset(revision) - c.cur_rev = c.changeset.raw_id c.rev_nr = c.changeset.revision @@ -96,6 +96,14 @@ class FilesController(BaseController): response.content_disposition = 'attachment; filename=%s' \ % f_path.split('/')[-1] return file_node.content + + def raw(self, repo_name, revision, f_path): + hg_model = HgModel() + c.repo = hg_model.get_repo(c.repo_name) + file_node = c.repo.get_changeset(revision).get_node(f_path) + response.content_type = 'text/plain' + + return file_node.content def annotate(self, repo_name, revision, f_path): hg_model = HgModel() diff --git a/pylons_app/templates/files/files_annotate.html b/pylons_app/templates/files/files_annotate.html --- a/pylons_app/templates/files/files_annotate.html +++ b/pylons_app/templates/files/files_annotate.html @@ -23,7 +23,7 @@