diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py --- a/hgext/largefiles/overrides.py +++ b/hgext/largefiles/overrides.py @@ -1636,13 +1636,14 @@ repo.wvfs.unlinkpath(standin, ignoremissing=True) lfdirstate = lfutil.openlfdirstate(ui, repo) - orphans = set(lfdirstate) - lfiles = lfutil.listlfiles(repo) - for file in lfiles: - lfutil.synclfdirstate(repo, lfdirstate, file, True) - orphans.discard(file) - for lfile in orphans: - lfdirstate.drop(lfile) + with lfdirstate.parentchange(): + orphans = set(lfdirstate) + lfiles = lfutil.listlfiles(repo) + for file in lfiles: + lfutil.synclfdirstate(repo, lfdirstate, file, True) + orphans.discard(file) + for lfile in orphans: + lfdirstate.drop(lfile) lfdirstate.write() return result