mercurial/hgweb.py
changeset 1185 2ae9c319e6fe
parent 1182 24d553b598e8
child 1210 27f2ec705332
equal deleted inserted replaced
1182:24d553b598e8 1185:2ae9c319e6fe
   687 
   687 
   688             tf = tarfile.TarFile.open(mode='w|' + type, fileobj=req.out)
   688             tf = tarfile.TarFile.open(mode='w|' + type, fileobj=req.out)
   689             mff = self.repo.manifest.readflags(mnode)
   689             mff = self.repo.manifest.readflags(mnode)
   690             mtime = int(time.time())
   690             mtime = int(time.time())
   691 
   691 
   692             req.httphdr('application/octet-stream', name[:-1] + '.tar.' + type)
   692             if type == "gz":
       
   693                 encoding = "gzip"
       
   694             else:
       
   695                 encoding = "x-bzip2"
       
   696             req.header([('Content-type', 'application/x-tar'), 
       
   697                     ('Content-disposition', 'attachment; filename=%s%s%s' %
       
   698                         (name[:-1], '.tar.', type)),
       
   699                     ('Content-encoding', encoding)])
   693             for fname in files:
   700             for fname in files:
   694                 rcont = self.repo.file(fname).read(mf[fname])
   701                 rcont = self.repo.file(fname).read(mf[fname])
   695                 finfo = tarfile.TarInfo(name + fname)
   702                 finfo = tarfile.TarInfo(name + fname)
   696                 finfo.mtime = mtime
   703                 finfo.mtime = mtime
   697                 finfo.size = len(rcont)
   704                 finfo.size = len(rcont)