##// END OF EJS Templates
hgweb: add mdiff / fix sorting of archives
mpm@selenic.com -
r1112:87cbfaf7 default
parent child Browse files
Show More
@@ -7,6 +7,7 b''
7 # of the GNU General Public License, incorporated herein by reference.
7 # of the GNU General Public License, incorporated herein by reference.
8
8
9 import os, cgi, time, re, socket, sys, zlib
9 import os, cgi, time, re, socket, sys, zlib
10 import mdiff
10 from hg import *
11 from hg import *
11 from ui import *
12 from ui import *
12
13
@@ -649,6 +650,9 b' class hgweb:'
649 reponame = re.sub(r"\W+", "-", self.reponame)
650 reponame = re.sub(r"\W+", "-", self.reponame)
650 name = "%s-%s/" % (reponame, short(cnode))
651 name = "%s-%s/" % (reponame, short(cnode))
651
652
653 files = mf.keys()
654 files.sort()
655
652 if type == 'zip':
656 if type == 'zip':
653 import zipfile
657 import zipfile
654
658
@@ -656,7 +660,7 b' class hgweb:'
656 tmp = tempfile.mkstemp()[1]
660 tmp = tempfile.mkstemp()[1]
657 zf = zipfile.ZipFile(tmp, "w", zipfile.ZIP_DEFLATED)
661 zf = zipfile.ZipFile(tmp, "w", zipfile.ZIP_DEFLATED)
658
662
659 for f in mf.keys():
663 for f in files:
660 zf.writestr(name + f, self.repo.file(f).read(mf[f]))
664 zf.writestr(name + f, self.repo.file(f).read(mf[f]))
661 zf.close()
665 zf.close()
662
666
@@ -678,7 +682,7 b' class hgweb:'
678 mtime = int(time.time())
682 mtime = int(time.time())
679
683
680 httphdr('application/octet-stream', name[:-1] + '.tar.' + type)
684 httphdr('application/octet-stream', name[:-1] + '.tar.' + type)
681 for fname in mf.keys():
685 for fname in files:
682 rcont = self.repo.file(fname).read(mf[fname])
686 rcont = self.repo.file(fname).read(mf[fname])
683 finfo = tarfile.TarInfo(name + fname)
687 finfo = tarfile.TarInfo(name + fname)
684 finfo.mtime = mtime
688 finfo.mtime = mtime
General Comments 0
You need to be logged in to leave comments. Login now