Patchwork [4,of,6] largefiles: always use filechunkitersize when using filechunkiter

login
register
mail settings
Submitter Mads Kiilerich
Date Oct. 7, 2016, 11:26 p.m.
Message ID <8838011d6452cbe31608.1475882768@localhost.localdomain>
Download mbox | patch
Permalink /patch/16904/
State Accepted
Headers show

Comments

Mads Kiilerich - Oct. 7, 2016, 11:26 p.m.
# HG changeset patch
# User Mads Kiilerich <madski@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 ...)

Patch

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()