Patchwork [4,of,6,RFC] localrepo: remove sopener as an alias for localrepo.svfs

login
register
mail settings
Submitter Angel Ezquerra
Date Jan. 11, 2015, 1:20 a.m.
Message ID <fcc635af6d5d6762694b.1420939253@Angels-MacBook-Pro.local>
Download mbox | patch
Permalink /patch/7431/
State Changes Requested
Headers show

Comments

Angel Ezquerra - Jan. 11, 2015, 1:20 a.m.
# HG changeset patch
# User Angel Ezquerra <angel.ezquerra@gmail.com>
# Date 1420932354 -3600
#      Sun Jan 11 00:25:54 2015 +0100
# Node ID fcc635af6d5d6762694b57016d27c7d8905bb4c7
# Parent  30525cc442c282d27eb08ce29b0810087013f67f
localrepo: remove sopener as an alias for localrepo.svfs

This change touches every module in which repository.sopener was being used
instead of repository.svfs.

I ran the test suite on OSX and there are no failures related to this patch, but
there are a few skipped tests that I could not test:

Skipped test-convert-svn-source.t: skipped
Skipped test-convert-svn-move.t: skipped
Skipped test-convert-svn-encoding.t: skipped
Skipped test-convert-svn-branches.t: skipped
Skipped test-convert-hg-svn.t: skipped
Skipped test-convert-p4-filetypes.t: skipped
Skipped test-convert-svn-startrev.t: skipped
Skipped test-https.t: skipped
Skipped test-convert-mtn.t: skipped
Skipped test-convert-svn-tags.t: skipped
Skipped test-convert-cvs.t: skipped
Skipped test-convert-bzr.t: missing feature: Canonical's Bazaar client
Skipped test-convert-baz.t: skipped
Skipped test-convert-cvs-detectmerge.t: skipped
Skipped test-convert-cvs-synthetic.t: skipped
Skipped test-convert-bzr-directories.t: missing feature: Canonical's Bazaar client
Skipped test-convert-cvsnt-mergepoints.t: skipped
Skipped test-convert-p4.t: skipped
Skipped test-convert-tla.t: skipped
Skipped test-convert-cvs-branch.t: skipped
Skipped test-convert-darcs.t: skipped
Skipped test-convert-bzr-merges.t: missing feature: Canonical's Bazaar client
Skipped test-casecollision.t: skipped
Skipped test-i18n.t: skipped
Skipped test-no-symlinks.t: skipped
Skipped test-gpg.t: skipped
Skipped test-convert-bzr-ghosts.t: missing feature: Canonical's Bazaar client
Skipped test-convert-bzr-114.t: skipped
Skipped test-convert-bzr-treeroot.t: missing feature: Canonical's Bazaar client

Given the number of changes in this patch (even though they are trivial), the
whole test suite should be run before accepting this patch.

Patch

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -125,8 +125,8 @@ 
     import mercurial.manifest
     timer, fm = gettimer(ui)
     def t():
-        repo.changelog = mercurial.changelog.changelog(repo.sopener)
-        repo.manifest = mercurial.manifest.manifest(repo.sopener)
+        repo.changelog = mercurial.changelog.changelog(repo.svfs)
+        repo.manifest = mercurial.manifest.manifest(repo.svfs)
         repo._tags = None
         return len(repo.tags())
     timer(t)
@@ -265,7 +265,7 @@ 
     mercurial.revlog._prereadsize = 2**24 # disable lazy parser in old hg
     n = repo["tip"].node()
     def d():
-        cl = mercurial.revlog.revlog(repo.sopener, "00changelog.i")
+        cl = mercurial.revlog.revlog(repo.svfs, "00changelog.i")
         cl.rev(n)
     timer(d)
     fm.end()
@@ -308,7 +308,7 @@ 
     import mercurial.revlog
     mercurial.revlog._prereadsize = 2**24 # disable lazy parser in old hg
     n = repo[rev].node()
-    cl = mercurial.revlog.revlog(repo.sopener, "00changelog.i")
+    cl = mercurial.revlog.revlog(repo.svfs, "00changelog.i")
     def d():
         cl.rev(n)
         clearcaches(cl)
@@ -533,5 +533,5 @@ 
 
     Result is the number of markers in the repo."""
     timer, fm = gettimer(ui)
-    timer(lambda: len(obsolete.obsstore(repo.sopener)))
+    timer(lambda: len(obsolete.obsstore(repo.svfs)))
     fm.end()
diff --git a/hgext/keyword.py b/hgext/keyword.py
--- a/hgext/keyword.py
+++ b/hgext/keyword.py
@@ -591,7 +591,7 @@ 
         def file(self, f):
             if f[0] == '/':
                 f = f[1:]
-            return kwfilelog(self.sopener, kwt, f)
+            return kwfilelog(self.svfs, kwt, f)
 
         def wread(self, filename):
             data = super(kwrepo, self).wread(filename)
diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py
--- a/mercurial/bundlerepo.py
+++ b/mercurial/bundlerepo.py
@@ -254,7 +254,7 @@ 
     def changelog(self):
         # consume the header if it exists
         self.bundle.changelogheader()
-        c = bundlechangelog(self.sopener, self.bundle)
+        c = bundlechangelog(self.svfs, self.bundle)
         self.manstart = self.bundle.tell()
         return c
 
@@ -263,7 +263,7 @@ 
         self.bundle.seek(self.manstart)
         # consume the header if it exists
         self.bundle.manifestheader()
-        m = bundlemanifest(self.sopener, self.bundle, self.changelog.rev)
+        m = bundlemanifest(self.svfs, self.bundle, self.changelog.rev)
         self.filestart = self.bundle.tell()
         return m
 
@@ -296,10 +296,10 @@ 
 
         if f in self.bundlefilespos:
             self.bundle.seek(self.bundlefilespos[f])
-            return bundlefilelog(self.sopener, f, self.bundle,
+            return bundlefilelog(self.svfs, f, self.bundle,
                                  self.changelog.rev, self)
         else:
-            return filelog.filelog(self.sopener, f)
+            return filelog.filelog(self.svfs, f)
 
     def close(self):
         """Close assigned bundle file immediately."""
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -269,7 +269,6 @@ 
         self.store = store.store(requirements, self.sharedpath, scmutil.vfs)
         self.spath = self.store.path
         self.svfs = self.store.vfs
-        self.sopener = self.svfs
         self.sjoin = self.store.join
         self.vfs.createmode = self.store.createmode
         self._applyrequirements(requirements)
diff --git a/mercurial/phases.py b/mercurial/phases.py
--- a/mercurial/phases.py
+++ b/mercurial/phases.py
@@ -133,7 +133,7 @@ 
                 if inst.errno != errno.ENOENT:
                     raise
         if f is None:
-            f = repo.sopener('phaseroots')
+            f = repo.svfs('phaseroots')
         try:
             for line in f:
                 phase, nh = line.split()
@@ -156,7 +156,7 @@ 
             self.phaseroots, self.dirty = _readroots(repo, phasedefaults)
             self._phaserevs = None
             self.filterunknown(repo)
-            self.opener = repo.sopener
+            self.opener = repo.svfs
 
     def copy(self):
         # Shallow copy meant to ensure isolation in
diff --git a/mercurial/repair.py b/mercurial/repair.py
--- a/mercurial/repair.py
+++ b/mercurial/repair.py
@@ -140,7 +140,7 @@ 
         try:
             for i in xrange(offset, len(tr.entries)):
                 file, troffset, ignore = tr.entries[i]
-                repo.sopener(file, 'a').truncate(troffset)
+                repo.svfs(file, 'a').truncate(troffset)
                 if troffset == 0:
                     repo.store.markremoved(file)
             tr.close()
diff --git a/mercurial/statichttprepo.py b/mercurial/statichttprepo.py
--- a/mercurial/statichttprepo.py
+++ b/mercurial/statichttprepo.py
@@ -129,14 +129,14 @@ 
         # setup store
         self.store = store.store(requirements, self.path, opener)
         self.spath = self.store.path
-        self.sopener = self.store.opener
-        self.svfs = self.sopener
+        self.svfs = self.store.opener
+        self.svfs = self.svfs
         self.sjoin = self.store.join
         self._filecache = {}
         self.requirements = requirements
 
-        self.manifest = manifest.manifest(self.sopener)
-        self.changelog = changelog.changelog(self.sopener)
+        self.manifest = manifest.manifest(self.svfs)
+        self.changelog = changelog.changelog(self.svfs)
         self._tags = None
         self.nodetagscache = None
         self._branchcaches = {}
diff --git a/mercurial/unionrepo.py b/mercurial/unionrepo.py
--- a/mercurial/unionrepo.py
+++ b/mercurial/unionrepo.py
@@ -178,7 +178,7 @@ 
 
     @localrepo.unfilteredpropertycache
     def changelog(self):
-        return unionchangelog(self.sopener, self.repo2.sopener)
+        return unionchangelog(self.svfs, self.repo2.svfs)
 
     def _clrev(self, rev2):
         """map from repo2 changelog rev to temporary rev in self.changelog"""
@@ -187,14 +187,14 @@ 
 
     @localrepo.unfilteredpropertycache
     def manifest(self):
-        return unionmanifest(self.sopener, self.repo2.sopener,
+        return unionmanifest(self.svfs, self.repo2.svfs,
                              self._clrev)
 
     def url(self):
         return self._url
 
     def file(self, f):
-        return unionfilelog(self.sopener, f, self.repo2.sopener,
+        return unionfilelog(self.svfs, f, self.repo2.svfs,
                             self._clrev, self)
 
     def close(self):
diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py
--- a/mercurial/wireproto.py
+++ b/mercurial/wireproto.py
@@ -778,7 +778,7 @@ 
                       (len(entries), total_bytes))
         yield '%d %d\n' % (len(entries), total_bytes)
 
-        sopener = repo.sopener
+        sopener = repo.svfs
         oldaudit = sopener.mustaudit
         debugflag = repo.ui.debugflag
         sopener.mustaudit = False