[PATCH 4 of 6] largefiles: always use filechunkitersize when using filechunkiter
Mads Kiilerich
mads at kiilerich.com
Fri Oct 7 19:26:08 EDT 2016
# HG changeset patch
# User Mads Kiilerich <madski at unity3d.com>
# Date 1475881182 -7200
# Sat Oct 08 00:59:42 2016 +0200
# Node ID 8838011d6452cbe31608482cc9f1b81e00fb1ca5
# Parent 5d63b84517ab6ecff8695aff0748bef9695c241c
largefiles: always use filechunkitersize when using filechunkiter
(Alternatively, we could change the filechunkiter default, use the existing
default, or have a custom largefiles filechunkiter wrapper ...)
diff --git a/hgext/largefiles/lfutil.py b/hgext/largefiles/lfutil.py
--- a/hgext/largefiles/lfutil.py
+++ b/hgext/largefiles/lfutil.py
@@ -57,7 +57,7 @@ def link(src, dest):
# if hardlinks fail, fallback on atomic copy
with open(src, 'rb') as srcf:
with util.atomictempfile(dest) as dstf:
- for chunk in util.filechunkiter(srcf):
+ for chunk in util.filechunkiter(srcf, filechunkitersize):
dstf.write(chunk)
os.chmod(dest, os.stat(src).st_mode)
@@ -268,7 +268,7 @@ def copytostoreabsolute(repo, file, hash
with open(file, 'rb') as srcf:
with util.atomictempfile(storepath(repo, hash),
createmode=repo.store.createmode) as dstf:
- for chunk in util.filechunkiter(srcf):
+ for chunk in util.filechunkiter(srcf, filechunkitersize):
dstf.write(chunk)
linktousercache(repo, hash)
@@ -399,7 +399,7 @@ def hexsha1(data):
"""hexsha1 returns the hex-encoded sha1 sum of the data in the file-like
object data"""
h = hashlib.sha1()
- for chunk in util.filechunkiter(data):
+ for chunk in util.filechunkiter(data, filechunkitersize):
h.update(chunk)
return h.hexdigest()
More information about the Mercurial-devel
mailing list