Show More
@@ -59,7 +59,7 bundletypes = { | |||||
59 | # hgweb uses this list to communicate its preferred type |
|
59 | # hgweb uses this list to communicate its preferred type | |
60 | bundlepriority = ['HG10GZ', 'HG10BZ', 'HG10UN'] |
|
60 | bundlepriority = ['HG10GZ', 'HG10BZ', 'HG10UN'] | |
61 |
|
61 | |||
62 | def writebundle(cg, filename, bundletype): |
|
62 | def writebundle(cg, filename, bundletype, vfs=None): | |
63 | """Write a bundle file and return its filename. |
|
63 | """Write a bundle file and return its filename. | |
64 |
|
64 | |||
65 | Existing files will not be overwritten. |
|
65 | Existing files will not be overwritten. | |
@@ -72,6 +72,9 def writebundle(cg, filename, bundletype | |||||
72 | cleanup = None |
|
72 | cleanup = None | |
73 | try: |
|
73 | try: | |
74 | if filename: |
|
74 | if filename: | |
|
75 | if vfs: | |||
|
76 | fh = vfs.open(filename, "wb") | |||
|
77 | else: | |||
75 | fh = open(filename, "wb") |
|
78 | fh = open(filename, "wb") | |
76 | else: |
|
79 | else: | |
77 | fd, filename = tempfile.mkstemp(prefix="hg-bundle-", suffix=".hg") |
|
80 | fd, filename = tempfile.mkstemp(prefix="hg-bundle-", suffix=".hg") | |
@@ -112,6 +115,9 def writebundle(cg, filename, bundletype | |||||
112 | if fh is not None: |
|
115 | if fh is not None: | |
113 | fh.close() |
|
116 | fh.close() | |
114 | if cleanup is not None: |
|
117 | if cleanup is not None: | |
|
118 | if filename and vfs: | |||
|
119 | vfs.unlink(cleanup) | |||
|
120 | else: | |||
115 | os.unlink(cleanup) |
|
121 | os.unlink(cleanup) | |
116 |
|
122 | |||
117 | def decompressor(fh, alg): |
|
123 | def decompressor(fh, alg): |
General Comments 0
You need to be logged in to leave comments.
Login now