Show More
@@ -59,7 +59,7 b' 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,7 +72,10 b' def writebundle(cg, filename, bundletype' | |||||
72 | cleanup = None |
|
72 | cleanup = None | |
73 | try: |
|
73 | try: | |
74 | if filename: |
|
74 | if filename: | |
75 | fh = open(filename, "wb") |
|
75 | if vfs: | |
|
76 | fh = vfs.open(filename, "wb") | |||
|
77 | else: | |||
|
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") | |
78 | fh = os.fdopen(fd, "wb") |
|
81 | fh = os.fdopen(fd, "wb") | |
@@ -112,7 +115,10 b' 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: | |
115 | os.unlink(cleanup) |
|
118 | if filename and vfs: | |
|
119 | vfs.unlink(cleanup) | |||
|
120 | else: | |||
|
121 | os.unlink(cleanup) | |||
116 |
|
122 | |||
117 | def decompressor(fh, alg): |
|
123 | def decompressor(fh, alg): | |
118 | if alg == 'UN': |
|
124 | if alg == 'UN': |
General Comments 0
You need to be logged in to leave comments.
Login now