diff hgext/largefiles/lfutil.py @ 31613:5c1d3f1b8f44

largefiles: omit redundant isstandin() before splitstandin() There are many isstandin() invocations before splitstandin(). The former examines whether specified path starts with ".hglf/". The latter returns after ".hglf/" of specified path if it starts with that prefix, or returns None otherwise. Therefore, value returned by splitstandin() can be used for replacement of preceding isstandin(), and this replacement can omit redundant string comparison after isstandin().
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Fri, 24 Mar 2017 22:24:58 +0900
parents a5ae1d79e271
children f0f316cb8259
line wrap: on
line diff
--- a/hgext/largefiles/lfutil.py	Fri Mar 24 22:13:23 2017 +0900
+++ b/hgext/largefiles/lfutil.py	Fri Mar 24 22:24:58 2017 +0900
@@ -261,8 +261,8 @@
 
     ctx = repo[node]
     for filename in ctx.files():
-        if isstandin(filename) and filename in ctx.manifest():
-            realfile = splitstandin(filename)
+        realfile = splitstandin(filename)
+        if realfile is not None and filename in ctx.manifest():
             copytostore(repo, ctx.node(), realfile)
 
 def copytostoreabsolute(repo, file, hash):
@@ -478,8 +478,8 @@
 
     lfdirstate = openlfdirstate(repo.ui, repo)
     for f in ctx.files():
-        if isstandin(f):
-            lfile = splitstandin(f)
+        lfile = splitstandin(f)
+        if lfile is not None:
             synclfdirstate(repo, lfdirstate, lfile, False)
     lfdirstate.write()