Mercurial > hg
comparison hgext/largefiles/lfcommands.py @ 31618: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 | 5c1d3f1b8f44 |
children | 1af4a1641bdb |
comparison
equal
deleted
inserted
replaced
31617:1f6c932862e5 | 31618:8228bc8fed8c |
---|---|
218 lfiles.add(f) | 218 lfiles.add(f) |
219 else: | 219 else: |
220 normalfiles.add(f) | 220 normalfiles.add(f) |
221 | 221 |
222 if f in lfiles: | 222 if f in lfiles: |
223 dstfiles.append(lfutil.standin(f)) | 223 fstandin = lfutil.standin(f) |
224 dstfiles.append(fstandin) | |
224 # largefile in manifest if it has not been removed/renamed | 225 # largefile in manifest if it has not been removed/renamed |
225 if f in ctx.manifest(): | 226 if f in ctx.manifest(): |
226 fctx = ctx.filectx(f) | 227 fctx = ctx.filectx(f) |
227 if 'l' in fctx.flags(): | 228 if 'l' in fctx.flags(): |
228 renamed = fctx.renamed() | 229 renamed = fctx.renamed() |
234 m.update(ctx[f].data()) | 235 m.update(ctx[f].data()) |
235 hash = m.hexdigest() | 236 hash = m.hexdigest() |
236 if f not in lfiletohash or lfiletohash[f] != hash: | 237 if f not in lfiletohash or lfiletohash[f] != hash: |
237 rdst.wwrite(f, ctx[f].data(), ctx[f].flags()) | 238 rdst.wwrite(f, ctx[f].data(), ctx[f].flags()) |
238 executable = 'x' in ctx[f].flags() | 239 executable = 'x' in ctx[f].flags() |
239 lfutil.writestandin(rdst, lfutil.standin(f), hash, | 240 lfutil.writestandin(rdst, fstandin, hash, |
240 executable) | 241 executable) |
241 lfiletohash[f] = hash | 242 lfiletohash[f] = hash |
242 else: | 243 else: |
243 # normal file | 244 # normal file |
244 dstfiles.append(f) | 245 dstfiles.append(f) |