Mercurial > hg
comparison mercurial/changegroup.py @ 3706:0d810798acb1
Use 'bundletype' instead of 'type' to not shadow built-in function.
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Wed, 22 Nov 2006 22:33:57 +0100 |
parents | e9d339d5d2d7 |
children | b9d3e12da485 |
comparison
equal
deleted
inserted
replaced
3705:e9d339d5d2d7 | 3706:0d810798acb1 |
---|---|
52 "HG10UN": ("HG10UN", nocompress), | 52 "HG10UN": ("HG10UN", nocompress), |
53 "HG10BZ": ("HG10", bz2.BZ2Compressor), | 53 "HG10BZ": ("HG10", bz2.BZ2Compressor), |
54 "HG10GZ": ("HG10GZ", zlib.compressobj), | 54 "HG10GZ": ("HG10GZ", zlib.compressobj), |
55 } | 55 } |
56 | 56 |
57 def writebundle(cg, filename, type): | 57 def writebundle(cg, filename, bundletype): |
58 """Write a bundle file and return its filename. | 58 """Write a bundle file and return its filename. |
59 | 59 |
60 Existing files will not be overwritten. | 60 Existing files will not be overwritten. |
61 If no filename is specified, a temporary file is created. | 61 If no filename is specified, a temporary file is created. |
62 bz2 compression can be turned off. | 62 bz2 compression can be turned off. |
73 else: | 73 else: |
74 fd, filename = tempfile.mkstemp(prefix="hg-bundle-", suffix=".hg") | 74 fd, filename = tempfile.mkstemp(prefix="hg-bundle-", suffix=".hg") |
75 fh = os.fdopen(fd, "wb") | 75 fh = os.fdopen(fd, "wb") |
76 cleanup = filename | 76 cleanup = filename |
77 | 77 |
78 header, compressor = bundletypes[type] | 78 header, compressor = bundletypes[bundletype] |
79 fh.write(header) | 79 fh.write(header) |
80 z = compressor() | 80 z = compressor() |
81 | 81 |
82 # parse the changegroup data, otherwise we will block | 82 # parse the changegroup data, otherwise we will block |
83 # in case of sshrepo because we don't know the end of the stream | 83 # in case of sshrepo because we don't know the end of the stream |