# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 1626648068 -19800 # Node ID df3021c1f09338d2df0e4175cabb258936ab811a # Parent 1b0f8aafedea15712c0ebc4c95e1ca20cb026598 largefiles: pass current transaction to `lfdirstate.write()` Right now, the largefile dirstate is not included in transaction which makes things complex. Next patch will add code to do so, so let's make it mandatory to pass current transaction and pass from all existing callers. Differential Revision: https://phab.mercurial-scm.org/D11610 diff -r 1b0f8aafedea -r df3021c1f093 hgext/largefiles/lfcommands.py --- a/hgext/largefiles/lfcommands.py Thu Oct 07 10:23:57 2021 -0400 +++ b/hgext/largefiles/lfcommands.py Mon Jul 19 04:11:08 2021 +0530 @@ -569,7 +569,7 @@ removed += 1 # largefile processing might be slow and be interrupted - be prepared - lfdirstate.write() + lfdirstate.write(repo.currenttransaction()) if lfiles: lfiles = [f for f in lfiles if f not in dropped] @@ -619,7 +619,7 @@ lfutil.synclfdirstate(repo, lfdirstate, lfile, normallookup) - lfdirstate.write() + lfdirstate.write(repo.currenttransaction()) if lfiles: statuswriter( _(b'%d largefiles updated, %d removed\n') % (updated, removed) diff -r 1b0f8aafedea -r df3021c1f093 hgext/largefiles/lfutil.py --- a/hgext/largefiles/lfutil.py Thu Oct 07 10:23:57 2021 -0400 +++ b/hgext/largefiles/lfutil.py Mon Jul 19 04:11:08 2021 +0530 @@ -191,7 +191,7 @@ def _ignore(self, f): return False - def write(self, tr=False): + def write(self, tr): # (1) disable PENDING mode always # (lfdirstate isn't yet managed as a part of the transaction) # (2) avoid develwarn 'use dirstate.write with ....' @@ -588,7 +588,7 @@ lfile = splitstandin(f) if lfile is not None: synclfdirstate(repo, lfdirstate, lfile, False) - lfdirstate.write() + lfdirstate.write(repo.currenttransaction()) # As part of committing, copy all of the largefiles into the cache. # diff -r 1b0f8aafedea -r df3021c1f093 hgext/largefiles/overrides.py --- a/hgext/largefiles/overrides.py Thu Oct 07 10:23:57 2021 -0400 +++ b/hgext/largefiles/overrides.py Mon Jul 19 04:11:08 2021 +0530 @@ -151,7 +151,7 @@ ) standins.append(standinname) lfdirstate.set_tracked(f) - lfdirstate.write() + lfdirstate.write(repo.currenttransaction()) bad += [ lfutil.splitstandin(f) for f in repo[None].add(standins) @@ -229,7 +229,7 @@ for f in remove: lfdirstate.set_untracked(lfutil.splitstandin(f)) - lfdirstate.write() + lfdirstate.write(repo.currenttransaction()) return result @@ -659,7 +659,7 @@ ) # make sure lfile doesn't get synclfdirstate'd as normal lfdirstate.update_file(lfile, p1_tracked=False, wc_tracked=True) - lfdirstate.write() + lfdirstate.write(repo.currenttransaction()) return orig(repo, actions, branchmerge, getfiledata) @@ -864,7 +864,7 @@ util.copyfile(repo.wjoin(srclfile), repo.wjoin(destlfile)) lfdirstate.set_tracked(destlfile) - lfdirstate.write() + lfdirstate.write(repo.currenttransaction()) except error.Abort as e: if e.message != _(b'no files to copy'): raise e @@ -896,7 +896,7 @@ with repo.wlock(): lfdirstate = lfutil.openlfdirstate(ui, repo) s = lfutil.lfdirstatestatus(lfdirstate, repo) - lfdirstate.write() + lfdirstate.write(repo.currenttransaction()) for lfile in s.modified: lfutil.updatestandin(repo, lfile, lfutil.standin(lfile)) for lfile in s.deleted: @@ -1383,7 +1383,7 @@ lfdirstate = lfutil.openlfdirstate(ui, repo) for f in forget: lfdirstate.set_untracked(f) - lfdirstate.write() + lfdirstate.write(repo.currenttransaction()) standins = [lfutil.standin(f) for f in forget] for f in standins: repo.wvfs.unlinkpath(f, ignoremissing=True) @@ -1792,7 +1792,7 @@ # interrupted before largefiles and lfdirstate are synchronized for lfile in oldclean: lfdirstate.set_possibly_dirty(lfile) - lfdirstate.write() + lfdirstate.write(repo.currenttransaction()) oldstandins = lfutil.getstandinsstate(repo) wc = kwargs.get('wc') @@ -1812,7 +1812,7 @@ # all the ones that didn't change as clean for lfile in oldclean.difference(filelist): lfdirstate.update_file(lfile, p1_tracked=True, wc_tracked=True) - lfdirstate.write() + lfdirstate.write(repo.currenttransaction()) if branchmerge or force or partial: filelist.extend(s.deleted + s.removed) diff -r 1b0f8aafedea -r df3021c1f093 hgext/largefiles/reposetup.py --- a/hgext/largefiles/reposetup.py Thu Oct 07 10:23:57 2021 -0400 +++ b/hgext/largefiles/reposetup.py Mon Jul 19 04:11:08 2021 +0530 @@ -310,7 +310,7 @@ ] if gotlock: - lfdirstate.write() + lfdirstate.write(self.currenttransaction()) self.lfstatus = True return scmutil.status(*result)