##// END OF EJS Templates
changegroup: add "vfs" argument to "writebundle()" for relative access via vfs...
FUJIWARA Katsunori -
r20976:c20f4898 default
parent child Browse files
Show More
@@ -59,7 +59,7 b' bundletypes = {'
59 59 # hgweb uses this list to communicate its preferred type
60 60 bundlepriority = ['HG10GZ', 'HG10BZ', 'HG10UN']
61 61
62 def writebundle(cg, filename, bundletype):
62 def writebundle(cg, filename, bundletype, vfs=None):
63 63 """Write a bundle file and return its filename.
64 64
65 65 Existing files will not be overwritten.
@@ -72,7 +72,10 b' def writebundle(cg, filename, bundletype'
72 72 cleanup = None
73 73 try:
74 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 79 else:
77 80 fd, filename = tempfile.mkstemp(prefix="hg-bundle-", suffix=".hg")
78 81 fh = os.fdopen(fd, "wb")
@@ -112,7 +115,10 b' def writebundle(cg, filename, bundletype'
112 115 if fh is not None:
113 116 fh.close()
114 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 123 def decompressor(fh, alg):
118 124 if alg == 'UN':
General Comments 0
You need to be logged in to leave comments. Login now