Show More
@@ -215,20 +215,12 b' def _lfconvert_addchangeset(rsrc, rdst, ' | |||||
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 |
@@ -277,7 +277,7 b' def readstandin(repo, filename, node=Non' | |||||
277 |
|
277 | |||
278 | def writestandin(repo, standin, hash, executable): |
|
278 | def writestandin(repo, standin, hash, executable): | |
279 | '''write hash to <repo.root>/<standin>''' |
|
279 | '''write hash to <repo.root>/<standin>''' | |
280 | writehash(hash, repo.wjoin(standin), executable) |
|
280 | repo.wwrite(standin, hash + '\n', executable and 'x' or '') | |
281 |
|
281 | |||
282 | def copyandhash(instream, outfile): |
|
282 | def copyandhash(instream, outfile): | |
283 | '''Read bytes from instream (iterable) and write them to outfile, |
|
283 | '''Read bytes from instream (iterable) and write them to outfile, | |
@@ -301,23 +301,12 b' def hashfile(file):' | |||||
301 | fd.close() |
|
301 | fd.close() | |
302 | return hasher.hexdigest() |
|
302 | return hasher.hexdigest() | |
303 |
|
303 | |||
304 | def writehash(hash, filename, executable): |
|
|||
305 | util.makedirs(os.path.dirname(filename)) |
|
|||
306 | util.writefile(filename, hash + '\n') |
|
|||
307 | os.chmod(filename, getmode(executable)) |
|
|||
308 |
|
||||
309 | def getexecutable(filename): |
|
304 | def getexecutable(filename): | |
310 | mode = os.stat(filename).st_mode |
|
305 | mode = os.stat(filename).st_mode | |
311 | return ((mode & stat.S_IXUSR) and |
|
306 | return ((mode & stat.S_IXUSR) and | |
312 | (mode & stat.S_IXGRP) and |
|
307 | (mode & stat.S_IXGRP) and | |
313 | (mode & stat.S_IXOTH)) |
|
308 | (mode & stat.S_IXOTH)) | |
314 |
|
309 | |||
315 | def getmode(executable): |
|
|||
316 | if executable: |
|
|||
317 | return 0755 |
|
|||
318 | else: |
|
|||
319 | return 0644 |
|
|||
320 |
|
||||
321 | def urljoin(first, second, *arg): |
|
310 | def urljoin(first, second, *arg): | |
322 | def join(left, right): |
|
311 | def join(left, right): | |
323 | if not left.endswith('/'): |
|
312 | if not left.endswith('/'): |
General Comments 0
You need to be logged in to leave comments.
Login now