largefiles: replace readstandin() by readasstandin()
authorFUJIWARA Katsunori <foozy@lares.dti.ne.jp>
Sat, 01 Apr 2017 02:32:47 +0900
changeset 31735 3e37b479ce2f
parent 31734 44ff5e4ffc8c
child 31736 dd2079fae003
largefiles: replace readstandin() by readasstandin() These code paths already (or should, for efficiency at repetition) know the target changectx and path of standin file.
hgext/largefiles/lfcommands.py
hgext/largefiles/lfutil.py
hgext/largefiles/overrides.py
--- a/hgext/largefiles/lfcommands.py	Sat Apr 01 02:32:31 2017 +0900
+++ b/hgext/largefiles/lfcommands.py	Sat Apr 01 02:32:47 2017 +0900
@@ -474,7 +474,7 @@
                     shutil.copyfile(wvfs.join(rellfile),
                                     wvfs.join(rellfileorig))
                     wvfs.unlinkpath(relstandinorig)
-                expecthash = lfutil.readstandin(repo, lfile)
+                expecthash = lfutil.readasstandin(wctx[relstandin])
                 if expecthash != '':
                     if lfile not in wctx: # not switched to normal file
                         wvfs.unlinkpath(rellfile, ignoremissing=True)
--- a/hgext/largefiles/lfutil.py	Sat Apr 01 02:32:31 2017 +0900
+++ b/hgext/largefiles/lfutil.py	Sat Apr 01 02:32:47 2017 +0900
@@ -434,10 +434,11 @@
 def getstandinsstate(repo):
     standins = []
     matcher = getstandinmatcher(repo)
+    wctx = repo[None]
     for standin in repo.dirstate.walk(matcher, [], False, False):
         lfile = splitstandin(standin)
         try:
-            hash = readstandin(repo, lfile)
+            hash = readasstandin(wctx[standin])
         except IOError:
             hash = None
         standins.append((lfile, hash))
--- a/hgext/largefiles/overrides.py	Sat Apr 01 02:32:31 2017 +0900
+++ b/hgext/largefiles/overrides.py	Sat Apr 01 02:32:47 2017 +0900
@@ -1357,7 +1357,7 @@
                     data = repo.wwritedata(f, data)
                 fp.write(data)
             else:
-                hash = lfutil.readstandin(repo, lf, ctx)
+                hash = lfutil.readasstandin(ctx[f])
                 if not lfutil.inusercache(repo.ui, hash):
                     store = storefactory.openstore(repo)
                     success, missing = store.get([(lf, hash)])
@@ -1409,7 +1409,7 @@
             lfutil.writestandin(repo, standin, lfhash,
                                 lfutil.getexecutable(lfileabs))
             if (standin in pctx and
-                lfhash == lfutil.readstandin(repo, lfile, pctx)):
+                lfhash == lfutil.readasstandin(pctx[standin])):
                 oldclean.add(lfile)
         for lfile in s.added:
             fstandin = lfutil.standin(lfile)