Mercurial > hg-stable
comparison mercurial/bundlerepo.py @ 13274:57d433f632b7
bundlerepo: use less intrusive util.posixfile to open bundle
author | Adrian Buehlmann <adrian@cadifra.com> |
---|---|
date | Fri, 07 Jan 2011 10:48:30 +0100 |
parents | ff083040a555 |
children | d747774ca9da |
comparison
equal
deleted
inserted
replaced
13273:764441ecbf2e | 13274:57d433f632b7 |
---|---|
172 self._url = 'bundle:' + util.expandpath(path) + '+' + bundlename | 172 self._url = 'bundle:' + util.expandpath(path) + '+' + bundlename |
173 else: | 173 else: |
174 self._url = 'bundle:' + bundlename | 174 self._url = 'bundle:' + bundlename |
175 | 175 |
176 self.tempfile = None | 176 self.tempfile = None |
177 f = open(bundlename, "rb") | 177 f = util.posixfile(bundlename, "rb") |
178 self.bundle = changegroup.readbundle(f, bundlename) | 178 self.bundle = changegroup.readbundle(f, bundlename) |
179 if self.bundle.compressed(): | 179 if self.bundle.compressed(): |
180 fdtemp, temp = tempfile.mkstemp(prefix="hg-bundle-", | 180 fdtemp, temp = tempfile.mkstemp(prefix="hg-bundle-", |
181 suffix=".hg10un", dir=self.path) | 181 suffix=".hg10un", dir=self.path) |
182 self.tempfile = temp | 182 self.tempfile = temp |
190 break | 190 break |
191 fptemp.write(chunk) | 191 fptemp.write(chunk) |
192 finally: | 192 finally: |
193 fptemp.close() | 193 fptemp.close() |
194 | 194 |
195 f = open(self.tempfile, "rb") | 195 f = util.posixfile(self.tempfile, "rb") |
196 self.bundle = changegroup.readbundle(f, bundlename) | 196 self.bundle = changegroup.readbundle(f, bundlename) |
197 | 197 |
198 # dict with the mapping 'filename' -> position in the bundle | 198 # dict with the mapping 'filename' -> position in the bundle |
199 self.bundlefilespos = {} | 199 self.bundlefilespos = {} |
200 | 200 |