Changeset - 05b59c48556f
[Not reviewed]
beta
0 3 0
Marcin Kuzminski - 15 years ago 2011-01-16 12:27:44
marcin@python-works.com
fixed error when trying to make download on empty repository
3 files changed with 7 insertions and 3 deletions:
0 comments (0 inline, 0 general)
docs/changelog.rst
Show inline comments
 
@@ -6,49 +6,49 @@ Changelog
 
1.2.0 (**2011-XX-XX**)
 
======================
 

	
 
:status: in-progress
 
:branch: beta
 

	
 
news
 
----
 

	
 
- implemented #89 Can setup google analytics code from settings menu
 
- implemented #91 added nicer looking archive urls
 
- implemented #44 into file browsing, and added follow branch option
 
- anonymous repository can be cloned without having to pass default:default
 
  into clone url
 
- fixed #90 whoosh indexer can index chooses repositories passed in command 
 
  line
 
- added dynamic download links in summary. With quick branch/tag selection
 

	
 
fixes
 
-----
 

	
 
- fixed file browser bug, when switching into given form revision the url was 
 
  not changing
 
- fixed propagation to error controller on simplehg and simplegit middlewares
 

	
 
- fixed error when trying to make a download on empty repository
 

	
 

	
 
1.1.2 (**2011-01-12**)
 
======================
 

	
 
news
 
----
 

	
 

	
 
fixes
 
-----
 

	
 
- fixes #98 protection against float division of percentage stats
 
- fixed graph bug
 
- forced webhelpers version since it was making troubles during installation 
 

	
 

	
 
1.1.1 (**2011-01-06**)
 
======================
 
 
 
news
 
----
 

	
 
- added force https option into ini files for easier https usage (no need to
rhodecode/controllers/files.py
Show inline comments
 
@@ -152,48 +152,50 @@ class FilesController(BaseController):
 
        archive_specs = {
 
          '.tar.bz2': ('application/x-tar', 'tbz2'),
 
          '.tar.gz': ('application/x-tar', 'tgz'),
 
          '.zip': ('application/zip', 'zip'),
 
        }
 
        
 
        fileformat = None
 
        revision = None
 
        
 
        for ext in archive_specs.keys():
 
            archive_spec = fname.split(ext)
 
            if len(archive_spec) == 2:
 
                fileformat = archive_spec[1] or ext
 
                revision = archive_spec[0]
 
        
 
        if not archive_specs.has_key(fileformat):
 
            return _('Unknown archive type')
 

	
 
        repo = ScmModel().get_repo(repo_name)
 

	
 
        try:
 
            repo.get_changeset(revision)
 
        except ChangesetDoesNotExistError:
 
            return _('Unknown revision %s') % revision
 
        except EmptyRepositoryError:
 
            return _('Empty repository')
 

	
 
        archive = tempfile.TemporaryFile()
 
        localrepo = repo.repo
 
        fname = '%s-%s%s' % (repo_name, revision, fileformat)
 
        archival.archive(localrepo, archive, revision, archive_specs[fileformat][1],
 
                         prefix='%s-%s' % (repo_name, revision))
 
        response.content_type = archive_specs[fileformat][0]
 
        response.content_disposition = 'attachment; filename=%s' % fname
 
        archive.seek(0)
 

	
 
        def read_in_chunks(file_object, chunk_size=1024 * 40):
 
            """Lazy function (generator) to read a file piece by piece.
 
            Default chunk size: 40k."""
 
            while True:
 
                data = file_object.read(chunk_size)
 
                if not data:
 
                    break
 
                yield data
 

	
 
        return read_in_chunks(archive)
 

	
 
    def diff(self, repo_name, f_path):
 
        hg_model = ScmModel()
 
        diff1 = request.GET.get('diff1')
rhodecode/templates/summary/summary.html
Show inline comments
 
@@ -107,59 +107,62 @@
 
			
 
			 <div class="field">
 
			  <div class="label">
 
			      <label>${_('Clone url')}:</label>
 
			  </div>
 
			  <div class="input-short">
 
			      <input type="text" id="clone_url" readonly="readonly" value="hg clone ${c.clone_repo_url}" size="70"/>
 
			  </div>
 
			 </div>
 
			 
 
			 <div class="field">
 
			  <div class="label">
 
			      <label>${_('Trending source files')}:</label>
 
			  </div>
 
			  <div class="input-short">
 
			    <div id="lang_stats"></div> 			   
 
			  </div>
 
			 </div>
 
			 			
 
			 <div class="field">
 
			  <div class="label">
 
			      <label>${_('Download')}:</label>
 
			  </div>
 
			  <div class="input-short">
 
		        
 
		        %if len(c.repo_info.revisions) == 0:
 
		          ${_('There are no downloads yet')}
 
		        %else:
 
		        ${h.select('download_options',c.repo_info.get_changeset().raw_id,c.download_options)}
 
		        %for cnt,archive in enumerate(c.repo_info._get_archives()):
 
		             %if cnt >=1:
 
		             |
 
		             %endif
 
		             <span class="tooltip" title="${_('Download %s as %s') %('tip',archive['type'])}" 
 
		                  id="${archive['type']+'_link'}">${h.link_to(archive['type'],
 
		                h.url('files_archive_home',repo_name=c.repo_info.name,
 
		                fname='tip'+archive['extension']),class_="archive_icon")}</span>
 
		        %endfor
 
			    %endif
 
			  </div>
 
			 </div>
 
			 
 
			 <div class="field">
 
			  <div class="label">
 
			      <label>${_('Feeds')}:</label>
 
			  </div>
 
			  <div class="input-short">
 
	            ${h.link_to(_('RSS'),h.url('rss_feed_home',repo_name=c.repo_info.name),class_='rss_icon')}
 
	            ${h.link_to(_('Atom'),h.url('atom_feed_home',repo_name=c.repo_info.name),class_='atom_icon')}
 
			  </div>
 
			 </div>				 			 			 
 
	  </div>		 
 
	</div>
 
  	<script type="text/javascript">
 
	  	YUE.onDOMReady(function(e){
 
	  	    id = 'clone_url';
 
	  	    YUE.on(id,'click',function(e){
 
	  	        YUD.get('clone_url').select();
 
	  	    })
 
	  	})
 
  		var data = ${c.trending_languages|n};
 
  		var total = 0;
 
  		var no_data = true;
 
@@ -247,49 +250,48 @@
 
                        h.url('files_archive_home',repo_name=c.repo_info.name,
 
                        fname='__CS__'+archive['extension']),class_="archive_icon")}';
 
                 %endfor
 
                
 
                 
 
                 for(k in tmpl_links){
 
                	 var s = YUD.get(k+'_link')
 
                	 title_tmpl = "${_('Download %s as %s') % ('__CS_NAME__',archive['type'])}";
 
                	 s.title = title_tmpl.replace('__CS_NAME__',new_cs.text)
 
                	 s.innerHTML = tmpl_links[k].replace('__CS__',new_cs.value);
 
                 }
 
                 
 
             })
 
             	
 
  	</script>    				
 
</div>
 
        
 
<div class="box box-right"  style="min-height:455px">
 
    <!-- box / title -->
 
    <div class="title">
 
        <h5>${_('Commit activity by day / author')}</h5>
 
    </div>
 
    
 
    <div class="table">
 
        
 
         %if c.no_data:
 
           <div style="padding:0 10px 10px 15px;font-size: 1.2em;">${c.no_data_msg}
 
           %if h.HasPermissionAll('hg.admin')('enable stats on from summary'):
 
                [${h.link_to(_('enable'),h.url('edit_repo',repo_name=c.repo_name))}]
 
           %endif
 
           </div>
 
        %endif:  
 
        <div id="commit_history" style="width:460px;height:300px;float:left"></div>
 
        <div style="clear: both;height: 10px"></div>
 
        <div id="overview" style="width:460px;height:100px;float:left"></div>
 
        
 
    	<div id="legend_data" style="clear:both;margin-top:10px;">
 
	    	<div id="legend_container"></div>
 
	    	<div id="legend_choices">
 
				<table id="legend_choices_tables" style="font-size:smaller;color:#545454"></table>
 
	    	</div>
 
    	</div>
 
		<script type="text/javascript">
 
		/**
 
		 * Plots summary graph
 
		 *
 
		 * @class SummaryPlot
 
		 * @param {from} initial from for detailed graph
 
		 * @param {to} initial to for detailed graph
0 comments (0 inline, 0 general)