diff --git a/hgext/largefiles/lfcommands.py b/hgext/largefiles/lfcommands.py --- a/hgext/largefiles/lfcommands.py +++ b/hgext/largefiles/lfcommands.py @@ -403,9 +403,10 @@ def cachelfiles(ui, repo, node, filelist lfiles = set(lfiles) & set(filelist) toget = [] + ctx = repo[node] for lfile in lfiles: try: - expectedhash = repo[node][lfutil.standin(lfile)].data().strip() + expectedhash = ctx[lfutil.standin(lfile)].data().strip() except IOError as err: if err.errno == errno.ENOENT: continue # node must be None and standin wasn't found in wctx @@ -457,6 +458,7 @@ def updatelfiles(ui, repo, filelist=None update = {} updated, removed = 0, 0 wvfs = repo.wvfs + wctx = repo[None] for lfile in lfiles: rellfile = lfile rellfileorig = os.path.relpath( @@ -474,7 +476,7 @@ def updatelfiles(ui, repo, filelist=None wvfs.unlinkpath(relstandinorig) expecthash = lfutil.readstandin(repo, lfile) if expecthash != '': - if lfile not in repo[None]: # not switched to normal file + if lfile not in wctx: # not switched to normal file wvfs.unlinkpath(rellfile, ignoremissing=True) # use normallookup() to allocate an entry in largefiles # dirstate to prevent lfilesrepo.status() from reporting @@ -487,7 +489,7 @@ def updatelfiles(ui, repo, filelist=None # largefile is converted back to a normal file: the standin # disappears, but a new (normal) file appears as the lfile. if (wvfs.exists(rellfile) and - repo.dirstate.normalize(lfile) not in repo[None]): + repo.dirstate.normalize(lfile) not in wctx): wvfs.unlinkpath(rellfile) removed += 1 diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py --- a/hgext/largefiles/overrides.py +++ b/hgext/largefiles/overrides.py @@ -759,11 +759,12 @@ def overriderevert(orig, ui, repo, ctx, lfdirstate = lfutil.openlfdirstate(mctx.repo().ui, mctx.repo(), False) + wctx = repo[None] def tostandin(f): standin = lfutil.standin(f) if standin in ctx or standin in mctx: return standin - elif standin in repo[None] or lfdirstate[f] == 'r': + elif standin in wctx or lfdirstate[f] == 'r': return None return f m._files = [tostandin(f) for f in m._files] @@ -1077,8 +1078,9 @@ def cmdutilforget(orig, ui, repo, match, s = repo.status(match=m, clean=True) finally: repo.lfstatus = False + manifest = repo[None].manifest() forget = sorted(s.modified + s.added + s.deleted + s.clean) - forget = [f for f in forget if lfutil.standin(f) in repo[None].manifest()] + forget = [f for f in forget if lfutil.standin(f) in manifest] for f in forget: fstandin = lfutil.standin(f)