# HG changeset patch # User FUJIWARA Katsunori # Date 1490362162 -32400 # Node ID 8228bc8fed8c709a43baa6c3af418d37c8ccd55c # Parent 1f6c932862e5f9e6e5e03fe808e7028197a159c7 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()". diff -r 1f6c932862e5 -r 8228bc8fed8c hgext/largefiles/lfcommands.py --- a/hgext/largefiles/lfcommands.py Fri Mar 24 22:29:22 2017 +0900 +++ b/hgext/largefiles/lfcommands.py Fri Mar 24 22:29:22 2017 +0900 @@ -220,7 +220,8 @@ normalfiles.add(f) if f in lfiles: - dstfiles.append(lfutil.standin(f)) + fstandin = lfutil.standin(f) + dstfiles.append(fstandin) # largefile in manifest if it has not been removed/renamed if f in ctx.manifest(): fctx = ctx.filectx(f) @@ -236,7 +237,7 @@ if f not in lfiletohash or lfiletohash[f] != hash: rdst.wwrite(f, ctx[f].data(), ctx[f].flags()) executable = 'x' in ctx[f].flags() - lfutil.writestandin(rdst, lfutil.standin(f), hash, + lfutil.writestandin(rdst, fstandin, hash, executable) lfiletohash[f] = hash else: diff -r 1f6c932862e5 -r 8228bc8fed8c hgext/largefiles/lfutil.py --- a/hgext/largefiles/lfutil.py Fri Mar 24 22:29:22 2017 +0900 +++ b/hgext/largefiles/lfutil.py Fri Mar 24 22:29:22 2017 +0900 @@ -557,13 +557,13 @@ # removed/renamed) for lfile in lfiles: if lfile in modifiedfiles: - if repo.wvfs.exists(standin(lfile)): + fstandin = standin(lfile) + if repo.wvfs.exists(fstandin): # this handles the case where a rebase is being # performed and the working copy is not updated # yet. if repo.wvfs.exists(lfile): - updatestandin(repo, - standin(lfile)) + updatestandin(repo, fstandin) return match diff -r 1f6c932862e5 -r 8228bc8fed8c hgext/largefiles/overrides.py --- 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)