Mercurial > hg-stable
changeset 50281:f34887316f1f stable
undo-files: factor the vfs map in a repository property
We define it in multiple locations and inconsistencies are appearing. So we now
have a single definition point.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 06 Mar 2023 13:30:41 +0100 |
parents | 5e568d70f54d |
children | 4bcb91c8b9d8 |
files | mercurial/interfaces/repository.py mercurial/localrepo.py |
diffstat | 2 files changed, 15 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/interfaces/repository.py Mon Mar 06 13:22:47 2023 +0100 +++ b/mercurial/interfaces/repository.py Mon Mar 06 13:30:41 2023 +0100 @@ -1524,6 +1524,10 @@ """Name of the repoview that is active on this repo.""" ) + vfs_map = interfaceutil.Attribute( + """a bytes-key → vfs mapping used by transaction and others""" + ) + wvfs = interfaceutil.Attribute( """VFS used to access the working directory.""" )
--- a/mercurial/localrepo.py Mon Mar 06 13:22:47 2023 +0100 +++ b/mercurial/localrepo.py Mon Mar 06 13:30:41 2023 +0100 @@ -1565,6 +1565,14 @@ return checksvfs + @property + def vfs_map(self): + return { + b'': self.svfs, + b'plain': self.vfs, + b'store': self.svfs, + } + def close(self): self._writecaches() @@ -2415,7 +2423,7 @@ rp = report else: rp = self.ui.warn - vfsmap = {b'plain': self.vfs, b'store': self.svfs} # root of .hg/ + vfsmap = self.vfs_map # we must avoid cyclic reference between repo and transaction. reporef = weakref.ref(self) # Code to track tag movement @@ -2704,10 +2712,7 @@ with self.lock(): if self.svfs.exists(b"journal"): self.ui.status(_(b"rolling back interrupted transaction\n")) - vfsmap = { - b'': self.svfs, - b'plain': self.vfs, - } + vfsmap = self.vfs_map transaction.rollback( self.svfs, vfsmap, @@ -2775,7 +2780,7 @@ return 0 self.destroying() - vfsmap = {b'plain': self.vfs, b'': self.svfs} + vfsmap = self.vfs_map skip_journal_pattern = None if not parentgone: skip_journal_pattern = RE_SKIP_DIRSTATE_ROLLBACK