# HG changeset patch # User FUJIWARA Katsunori # Date 2017-03-31 17:32:31 # Node ID 44ff5e4ffc8c03e397ebfb093dc01a799402a2bf # Parent ae6bab095c669dce53b7d422a12870854e7f73f3 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. diff --git a/hgext/largefiles/lfutil.py b/hgext/largefiles/lfutil.py --- a/hgext/largefiles/lfutil.py +++ b/hgext/largefiles/lfutil.py @@ -355,10 +355,16 @@ def updatestandin(repo, lfile, standin): 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 /'''