diff hgext/largefiles/overrides.py @ 31623:8228bc8fed8c

largefiles: avoid redundant standin() invocations There are some code paths, which apply standin() on same value multilpe times instead of using already standin()-ed value. "fstandin" is common name for "path to standin file" in lfutil.py, to avoid shadowing "standin()".
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Fri, 24 Mar 2017 22:29:22 +0900
parents 1f6c932862e5
children 32d998dc2a00
line wrap: on
line diff
--- a/hgext/largefiles/overrides.py	Fri Mar 24 22:29:22 2017 +0900
+++ b/hgext/largefiles/overrides.py	Fri Mar 24 22:29:22 2017 +0900
@@ -739,8 +739,9 @@
         for lfile in s.modified:
             lfutil.updatestandin(repo, lfutil.standin(lfile))
         for lfile in s.deleted:
-            if (repo.wvfs.exists(lfutil.standin(lfile))):
-                repo.wvfs.unlink(lfutil.standin(lfile))
+            fstandin = lfutil.standin(lfile)
+            if (repo.wvfs.exists(fstandin)):
+                repo.wvfs.unlink(fstandin)
 
         oldstandins = lfutil.getstandinsstate(repo)
 
@@ -1080,8 +1081,8 @@
     forget = [f for f in forget if lfutil.standin(f) in repo[None].manifest()]
 
     for f in forget:
-        if lfutil.standin(f) not in repo.dirstate and not \
-                repo.wvfs.isdir(lfutil.standin(f)):
+        fstandin = lfutil.standin(f)
+        if fstandin not in repo.dirstate and not repo.wvfs.isdir(fstandin):
             ui.warn(_('not removing %s: file is already untracked\n')
                     % m.rel(f))
             bad.append(f)