move contentstore pending from localrepo to shallow

Summary: Not all of the repos are remotefilellog, so I moved some invocagions of the content store to shallowrepo and added requirements check where the transaction is processsed in localrepo

Reviewed By: quark-zju

Differential Revision: D12881916

fbshipit-source-id: 1119debd1e3d42cdf9513a6cae4bad4c000cc046
This commit is contained in:
Aida Getoeva 2018-11-05 07:51:26 -08:00 committed by Facebook Github Bot
parent d15af3f239
commit dc09d0c75c
3 changed files with 28 additions and 9 deletions

View File

@ -227,6 +227,12 @@ def wraprepo(repo):
self.fileservice.prefetch(files)
return super(shallowrepository, self).commitctx(ctx, error=error)
@localrepo.unfilteredmethod
def close(self):
if self.ui.configbool("remotefilelog", "packlocaldata"):
self.contentstore.commitpending()
return super(shallowrepository, self).close()
def backgroundprefetch(
self, revs, base=None, repack=False, pats=None, opts=None
):
@ -333,6 +339,10 @@ def wraprepo(repo):
self.fileservice.prefetch(results)
def invalidate(self, **kwargs):
if self.ui.configbool("remotefilelog", "packlocaldata"):
# Flush local data which might be uncommitted to disc
self.contentstore.commitpending()
super(shallowrepository, self).invalidate(**kwargs)
makeunionstores(self)

View File

@ -673,9 +673,6 @@ class localrepository(object):
if "manifestlog" in self.__dict__:
self.manifestlog.commitpending()
if self.ui.configbool("remotefilelog", "packlocaldata"):
self.contentstore.commitpending()
def _loadextensions(self):
extensions.loadall(self.ui)
@ -1447,18 +1444,24 @@ class localrepository(object):
# standard transaction mechanism.
unfi = self.unfiltered()
isremotefilelogrepo = "remotefilelog" in self.requirements
def commitnotransaction(tr):
if "manifestlog" in unfi.__dict__:
self.manifestlog.commitpending()
if self.ui.configbool("remotefilelog", "packlocaldata"):
if isremotefilelogrepo and self.ui.configbool(
"remotefilelog", "packlocaldata"
):
self.contentstore.commitpending()
def abortnotransaction(tr):
if "manifestlog" in unfi.__dict__:
self.manifestlog.abortpending()
if self.ui.configbool("remotefilelog", "packlocaldata"):
if isremotefilelogrepo and self.ui.configbool(
"remotefilelog", "packlocaldata"
):
self.contentstore.abortpending()
def writependingnotransaction(tr):
@ -1789,10 +1792,6 @@ class localrepository(object):
except AttributeError:
pass
if self.ui.configbool("remotefilelog", "packlocaldata"):
# Flush local data which might be uncommitted to disc
self.contentstore.commitpending()
self.invalidatecaches()
if not self.currenttransaction():
# TODO: Changing contents of store outside transaction

View File

@ -149,3 +149,13 @@
committed changeset 6:3462713eae99
calling hook commit.prefetch: hgext.remotefilelog.wcpprefetch
$ findfilessorted $CACHEDIR
# Test that it doesn't break non-remotefilelog repos
$ cd ..
$ newrepo
$ setconfig remotefilelog.packlocaldata=True
$ echo 1 >> a
$ hg commit -Am "commit"
adding a