Mercurial > hg
comparison hgext/largefiles/lfcommands.py @ 19089:0509ae083ec1 stable
largefiles: use repo.wwrite for writing standins (issue3909)
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Sat, 27 Apr 2013 00:41:42 +0200 |
parents | 6734951e2d24 |
children | 0848be1f1aad |
comparison
equal
deleted
inserted
replaced
19088:ce4472b2edb2 | 19089:0509ae083ec1 |
---|---|
213 renamed = fctx.renamed() | 213 renamed = fctx.renamed() |
214 if renamed and renamed[0] in lfiles: | 214 if renamed and renamed[0] in lfiles: |
215 raise util.Abort(_('largefile %s becomes symlink') % f) | 215 raise util.Abort(_('largefile %s becomes symlink') % f) |
216 | 216 |
217 # largefile was modified, update standins | 217 # largefile was modified, update standins |
218 fullpath = rdst.wjoin(f) | |
219 util.makedirs(os.path.dirname(fullpath)) | |
220 m = util.sha1('') | 218 m = util.sha1('') |
221 m.update(ctx[f].data()) | 219 m.update(ctx[f].data()) |
222 hash = m.hexdigest() | 220 hash = m.hexdigest() |
223 if f not in lfiletohash or lfiletohash[f] != hash: | 221 if f not in lfiletohash or lfiletohash[f] != hash: |
224 try: | 222 rdst.wwrite(f, ctx[f].data(), ctx[f].flags()) |
225 fd = open(fullpath, 'wb') | |
226 fd.write(ctx[f].data()) | |
227 finally: | |
228 if fd: | |
229 fd.close() | |
230 executable = 'x' in ctx[f].flags() | 223 executable = 'x' in ctx[f].flags() |
231 os.chmod(fullpath, lfutil.getmode(executable)) | |
232 lfutil.writestandin(rdst, lfutil.standin(f), hash, | 224 lfutil.writestandin(rdst, lfutil.standin(f), hash, |
233 executable) | 225 executable) |
234 lfiletohash[f] = hash | 226 lfiletohash[f] = hash |
235 else: | 227 else: |
236 # normal file | 228 # normal file |