changeset 31734:44ff5e4ffc8c

largefiles: introduce readasstandin() to read hex hash from given filectx This will be used to centralize and encapsulate the logic to read hash from given (filectx of) standin file. readstandin() isn't suitable for this purpose, because there are some code paths, which want to read hex hash directly from filectx.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Sat, 01 Apr 2017 02:32:31 +0900
parents ae6bab095c66
children 3e37b479ce2f
files hgext/largefiles/lfutil.py
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/largefiles/lfutil.py	Thu Mar 30 03:50:10 2017 -0700
+++ b/hgext/largefiles/lfutil.py	Sat Apr 01 02:32:31 2017 +0900
@@ -355,10 +355,16 @@
     else:
         raise error.Abort(_('%s: file not found!') % lfile)
 
+def readasstandin(fctx):
+    '''read hex hash from given filectx of standin file
+
+    This encapsulates how "standin" data is stored into storage layer.'''
+    return fctx.data().strip()
+
 def readstandin(repo, filename, node=None):
     '''read hex hash from standin for filename at given node, or working
     directory if no node is given'''
-    return repo[node][standin(filename)].data().strip()
+    return readasstandin(repo[node][standin(filename)])
 
 def writestandin(repo, standin, hash, executable):
     '''write hash to <repo.root>/<standin>'''