Patchwork [3,of,7] largefiles: add copytostore() fstandin argument to replace readstandin() (API)

login
register
mail settings
Submitter Katsunori FUJIWARA
Date March 31, 2017, 5:41 p.m.
Message ID <30fde597a072c6bc6419.1490982108@speaknoevil>
Download mbox | patch
Permalink /patch/19875/
State Accepted
Headers show

Comments

Katsunori FUJIWARA - March 31, 2017, 5:41 p.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
# Date 1490981568 -32400
#      Sat Apr 01 02:32:48 2017 +0900
# Node ID 30fde597a072c6bc6419fcbdfab4889cb1c72914
# Parent  a99b27d2fdfb148aa44d1fec88b6b7accadd8084
largefiles: add copytostore() fstandin argument to replace readstandin() (API)

copyalltostore(), only one caller of copytostore(), already knows
standin file name of the target largefile. Therefore, passing it to
copytostore() is more efficient than calculating it in copytostore()
or readstandin().

Patch

diff --git a/hgext/largefiles/lfutil.py b/hgext/largefiles/lfutil.py
--- a/hgext/largefiles/lfutil.py
+++ b/hgext/largefiles/lfutil.py
@@ -245,9 +245,9 @@  def copyfromcache(repo, hash, filename):
         return False
     return True
 
-def copytostore(repo, revorctx, file, uploaded=False):
+def copytostore(repo, revorctx, file, fstandin, uploaded=False):
     wvfs = repo.wvfs
-    hash = readstandin(repo, file, revorctx)
+    hash = readasstandin(repo[revorctx][fstandin])
     if instore(repo, hash):
         return
     if wvfs.exists(file):
@@ -263,7 +263,7 @@  def copyalltostore(repo, node):
     for filename in ctx.files():
         realfile = splitstandin(filename)
         if realfile is not None and filename in ctx.manifest():
-            copytostore(repo, ctx, realfile)
+            copytostore(repo, ctx, realfile, filename)
 
 def copytostoreabsolute(repo, file, hash):
     if inusercache(repo.ui, hash):