##// END OF EJS Templates
largefiles: avoid redundant changectx looking up at each repetitions...
FUJIWARA Katsunori -
r31654:1af4a164 default
parent child Browse files
Show More
@@ -403,9 +403,10 def cachelfiles(ui, repo, node, filelist
403 lfiles = set(lfiles) & set(filelist)
403 lfiles = set(lfiles) & set(filelist)
404 toget = []
404 toget = []
405
405
406 ctx = repo[node]
406 for lfile in lfiles:
407 for lfile in lfiles:
407 try:
408 try:
408 expectedhash = repo[node][lfutil.standin(lfile)].data().strip()
409 expectedhash = ctx[lfutil.standin(lfile)].data().strip()
409 except IOError as err:
410 except IOError as err:
410 if err.errno == errno.ENOENT:
411 if err.errno == errno.ENOENT:
411 continue # node must be None and standin wasn't found in wctx
412 continue # node must be None and standin wasn't found in wctx
@@ -457,6 +458,7 def updatelfiles(ui, repo, filelist=None
457 update = {}
458 update = {}
458 updated, removed = 0, 0
459 updated, removed = 0, 0
459 wvfs = repo.wvfs
460 wvfs = repo.wvfs
461 wctx = repo[None]
460 for lfile in lfiles:
462 for lfile in lfiles:
461 rellfile = lfile
463 rellfile = lfile
462 rellfileorig = os.path.relpath(
464 rellfileorig = os.path.relpath(
@@ -474,7 +476,7 def updatelfiles(ui, repo, filelist=None
474 wvfs.unlinkpath(relstandinorig)
476 wvfs.unlinkpath(relstandinorig)
475 expecthash = lfutil.readstandin(repo, lfile)
477 expecthash = lfutil.readstandin(repo, lfile)
476 if expecthash != '':
478 if expecthash != '':
477 if lfile not in repo[None]: # not switched to normal file
479 if lfile not in wctx: # not switched to normal file
478 wvfs.unlinkpath(rellfile, ignoremissing=True)
480 wvfs.unlinkpath(rellfile, ignoremissing=True)
479 # use normallookup() to allocate an entry in largefiles
481 # use normallookup() to allocate an entry in largefiles
480 # dirstate to prevent lfilesrepo.status() from reporting
482 # dirstate to prevent lfilesrepo.status() from reporting
@@ -487,7 +489,7 def updatelfiles(ui, repo, filelist=None
487 # largefile is converted back to a normal file: the standin
489 # largefile is converted back to a normal file: the standin
488 # disappears, but a new (normal) file appears as the lfile.
490 # disappears, but a new (normal) file appears as the lfile.
489 if (wvfs.exists(rellfile) and
491 if (wvfs.exists(rellfile) and
490 repo.dirstate.normalize(lfile) not in repo[None]):
492 repo.dirstate.normalize(lfile) not in wctx):
491 wvfs.unlinkpath(rellfile)
493 wvfs.unlinkpath(rellfile)
492 removed += 1
494 removed += 1
493
495
@@ -759,11 +759,12 def overriderevert(orig, ui, repo, ctx,
759 lfdirstate = lfutil.openlfdirstate(mctx.repo().ui, mctx.repo(),
759 lfdirstate = lfutil.openlfdirstate(mctx.repo().ui, mctx.repo(),
760 False)
760 False)
761
761
762 wctx = repo[None]
762 def tostandin(f):
763 def tostandin(f):
763 standin = lfutil.standin(f)
764 standin = lfutil.standin(f)
764 if standin in ctx or standin in mctx:
765 if standin in ctx or standin in mctx:
765 return standin
766 return standin
766 elif standin in repo[None] or lfdirstate[f] == 'r':
767 elif standin in wctx or lfdirstate[f] == 'r':
767 return None
768 return None
768 return f
769 return f
769 m._files = [tostandin(f) for f in m._files]
770 m._files = [tostandin(f) for f in m._files]
@@ -1077,8 +1078,9 def cmdutilforget(orig, ui, repo, match,
1077 s = repo.status(match=m, clean=True)
1078 s = repo.status(match=m, clean=True)
1078 finally:
1079 finally:
1079 repo.lfstatus = False
1080 repo.lfstatus = False
1081 manifest = repo[None].manifest()
1080 forget = sorted(s.modified + s.added + s.deleted + s.clean)
1082 forget = sorted(s.modified + s.added + s.deleted + s.clean)
1081 forget = [f for f in forget if lfutil.standin(f) in repo[None].manifest()]
1083 forget = [f for f in forget if lfutil.standin(f) in manifest]
1082
1084
1083 for f in forget:
1085 for f in forget:
1084 fstandin = lfutil.standin(f)
1086 fstandin = lfutil.standin(f)
General Comments 0
You need to be logged in to leave comments. Login now