Patchwork [3,of,6,RFC] localrepo: remove all internal uses of localrepo.sopener

login
register
mail settings
Submitter Angel Ezquerra
Date Jan. 11, 2015, 1:20 a.m.
Message ID <30525cc442c282d27eb0.1420939252@Angels-MacBook-Pro.local>
Download mbox | patch
Permalink /patch/7430/
State Accepted
Commit 0cc663e44258f19418e36c6e45fef0f235021afd
Headers show

Comments

Angel Ezquerra - Jan. 11, 2015, 1:20 a.m.
# HG changeset patch
# User Angel Ezquerra <angel.ezquerra@gmail.com>
# Date 1420932118 -3600
#      Sun Jan 11 00:21:58 2015 +0100
# Node ID 30525cc442c282d27eb08ce29b0810087013f67f
# Parent  821f6400243e795c7feb3dfa876ca4f957fca78e
localrepo: remove all internal uses of localrepo.sopener

It has been replaced with localrepo.svfs.

Patch

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -314,14 +314,14 @@ 
 
     def _applyrequirements(self, requirements):
         self.requirements = requirements
-        self.sopener.options = dict((r, 1) for r in requirements
+        self.svfs.options = dict((r, 1) for r in requirements
                                            if r in self.openerreqs)
         chunkcachesize = self.ui.configint('format', 'chunkcachesize')
         if chunkcachesize is not None:
-            self.sopener.options['chunkcachesize'] = chunkcachesize
+            self.svfs.options['chunkcachesize'] = chunkcachesize
         maxchainlen = self.ui.configint('format', 'maxchainlen')
         if maxchainlen is not None:
-            self.sopener.options['maxchainlen'] = maxchainlen
+            self.svfs.options['maxchainlen'] = maxchainlen
 
     def _writerequirements(self):
         reqfile = self.vfs("requires", "w")
@@ -413,7 +413,7 @@ 
         if defaultformat is not None:
             kwargs['defaultformat'] = defaultformat
         readonly = not obsolete.isenabled(self, obsolete.createmarkersopt)
-        store = obsolete.obsstore(self.sopener, readonly=readonly,
+        store = obsolete.obsstore(self.svfs, readonly=readonly,
                                   **kwargs)
         if store and readonly:
             # message is rare enough to not be translated
@@ -423,7 +423,7 @@ 
 
     @storecache('00changelog.i')
     def changelog(self):
-        c = changelog.changelog(self.sopener)
+        c = changelog.changelog(self.svfs)
         if 'HG_PENDING' in os.environ:
             p = os.environ['HG_PENDING']
             if p.startswith(self.root):
@@ -432,7 +432,7 @@ 
 
     @storecache('00manifest.i')
     def manifest(self):
-        return manifest.manifest(self.sopener)
+        return manifest.manifest(self.svfs)
 
     @repofilecache('dirstate')
     def dirstate(self):
@@ -781,7 +781,7 @@ 
     def file(self, f):
         if f[0] == '/':
             f = f[1:]
-        return filelog.filelog(self.sopener, f)
+        return filelog.filelog(self.svfs, f)
 
     def changectx(self, changeid):
         return self[changeid]
@@ -909,7 +909,7 @@ 
         renames = [(vfs, x, undoname(x)) for vfs, x in self._journalfiles()]
         rp = report and report or self.ui.warn
         vfsmap = {'plain': self.vfs} # root of .hg/
-        tr = transaction.transaction(rp, self.sopener, vfsmap,
+        tr = transaction.transaction(rp, self.svfs, vfsmap,
                                      "journal",
                                      aftertrans(renames),
                                      self.store.createmode)
@@ -940,17 +940,17 @@ 
                           "%d\n%s\n" % (len(self), desc))
         self.vfs.write("journal.bookmarks",
                           self.vfs.tryread("bookmarks"))
-        self.sopener.write("journal.phaseroots",
-                           self.sopener.tryread("phaseroots"))
+        self.svfs.write("journal.phaseroots",
+                           self.svfs.tryread("phaseroots"))
 
     def recover(self):
         lock = self.lock()
         try:
             if self.svfs.exists("journal"):
                 self.ui.status(_("rolling back interrupted transaction\n"))
-                vfsmap = {'': self.sopener,
+                vfsmap = {'': self.svfs,
                           'plain': self.vfs,}
-                transaction.rollback(self.sopener, vfsmap, "journal",
+                transaction.rollback(self.svfs, vfsmap, "journal",
                                      self.ui.warn)
                 self.invalidate()
                 return True
@@ -1007,7 +1007,7 @@ 
         parents = self.dirstate.parents()
         self.destroying()
         vfsmap = {'plain': self.vfs}
-        transaction.rollback(self.sopener, vfsmap, 'undo', ui.warn)
+        transaction.rollback(self.svfs, vfsmap, 'undo', ui.warn)
         if self.vfs.exists('undo.bookmarks'):
             self.vfs.rename('undo.bookmarks', 'bookmarks')
         if self.svfs.exists('undo.phaseroots'):
@@ -1692,7 +1692,7 @@ 
                         self.ui.debug('adding %s (%s)\n' %
                                       (name, util.bytecount(size)))
                     # for backwards compat, name was partially encoded
-                    ofp = self.sopener(store.decodedir(name), 'w')
+                    ofp = self.svfs(store.decodedir(name), 'w')
                     for chunk in util.filechunkiter(fp, limit=size):
                         handled_bytes += len(chunk)
                         self.ui.progress(_('clone'), handled_bytes,