Patchwork [01,of,22] vfs: use 'vfs' module directly in 'mercurial.localrepo'

login
register
mail settings
Submitter Pierre-Yves David
Date March 8, 2017, 9:18 p.m.
Message ID <c46a9910b10778bfa378.1489007892@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/18999/
State Accepted
Headers show

Comments

Pierre-Yves David - March 8, 2017, 9:18 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
# Date 1488457697 -3600
#      Thu Mar 02 13:28:17 2017 +0100
# Node ID c46a9910b10778bfa378ef4e37d66dfb270d23e6
# Parent  27f519148c6fb12dfd13c91f88f8485cc91fefcf
# EXP-Topic vfs.cleanup
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r c46a9910b107
vfs: use 'vfs' module directly in 'mercurial.localrepo'

Now that the 'vfs' classes moved in their own module, lets use the new module
directly. We update code iteratively to help with possible bisect needs in the
future.

Patch

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -59,6 +59,7 @@  from . import (
     transaction,
     txnutil,
     util,
+    vfs as vfsmod,
 )
 
 release = lockmod.release
@@ -255,7 +256,7 @@  class localrepository(object):
     def __init__(self, baseui, path, create=False):
         self.requirements = set()
         # vfs to access the working copy
-        self.wvfs = scmutil.vfs(path, expandpath=True, realpath=True)
+        self.wvfs = vfsmod.vfs(path, expandpath=True, realpath=True)
         # vfs to access the content of the repository
         self.vfs = None
         # vfs to access the store part of the repository
@@ -266,7 +267,7 @@  class localrepository(object):
         self.auditor = pathutil.pathauditor(self.root, self._checknested)
         self.nofsauditor = pathutil.pathauditor(self.root, self._checknested,
                                                 realfs=False)
-        self.vfs = scmutil.vfs(self.path)
+        self.vfs = vfsmod.vfs(self.path)
         self.baseui = baseui
         self.ui = baseui.copy()
         self.ui.copy = baseui.copy # prevent copying repo configuration
@@ -331,8 +332,7 @@  class localrepository(object):
             sharedpath = self.vfs.read("sharedpath").rstrip('\n')
             if 'relshared' in self.requirements:
                 sharedpath = self.vfs.join(sharedpath)
-            vfs = scmutil.vfs(sharedpath, realpath=True)
-
+            vfs = vfsmod.vfs(sharedpath, realpath=True)
             s = vfs.base
             if not vfs.exists():
                 raise error.RepoError(
@@ -343,7 +343,7 @@  class localrepository(object):
                 raise
 
         self.store = store.store(
-                self.requirements, self.sharedpath, scmutil.vfs)
+                self.requirements, self.sharedpath, vfsmod.vfs)
         self.spath = self.store.path
         self.svfs = self.store.vfs
         self.sjoin = self.store.join