# HG changeset patch # User FUJIWARA Katsunori # Date 1490981551 -32400 # 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 -r ae6bab095c66 -r 44ff5e4ffc8c hgext/largefiles/lfutil.py --- 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 /'''