Patchwork [6,of,6,RFC] localrepo: remove wopener as an alias for localrepo.wvfs

login
register
mail settings
Submitter Angel Ezquerra
Date Jan. 11, 2015, 1:20 a.m.
Message ID <4f27052416342cc20a2f.1420939255@Angels-MacBook-Pro.local>
Download mbox | patch
Permalink /patch/7433/
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 1420937512 -3600
#      Sun Jan 11 01:51:52 2015 +0100
# Node ID 4f27052416342cc20a2f7da78b8fc8e1c7e0eaf9
# Parent  2911bce490c6310a2fa2ffb8ad7a9d061d212852
localrepo: remove wopener as an alias for localrepo.wvfs

This change touches every module in which repository.wopener was being used
instead of repository.wvfs.

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/hgext/keyword.py b/hgext/keyword.py
--- a/hgext/keyword.py
+++ b/hgext/keyword.py
@@ -282,7 +282,7 @@ 
                 data, found = _shrinktext(data, re_kw.subn)
             if found:
                 self.ui.note(msg % f)
-                fp = self.repo.wopener(f, "wb", atomictemp=True)
+                fp = self.repo.wvfs(f, "wb", atomictemp=True)
                 fp.write(data)
                 fp.close()
                 if kwcmd:
@@ -440,7 +440,7 @@ 
     demoitems('keywordset', ui.configitems('keywordset'))
     demoitems('keywordmaps', kwmaps.iteritems())
     keywords = '$' + '$\n$'.join(sorted(kwmaps.keys())) + '$\n'
-    repo.wopener.write(fn, keywords)
+    repo.wvfs.write(fn, keywords)
     repo[None].add([fn])
     ui.note(_('\nkeywords written to %s:\n') % fn)
     ui.note(keywords)
diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -2306,7 +2306,7 @@ 
     q.savedirty()
     if r:
         if not os.path.exists(r.wjoin('.hgignore')):
-            fp = r.wopener('.hgignore', 'w')
+            fp = r.wvfs('.hgignore', 'w')
             fp.write('^\\.hg\n')
             fp.write('^\\.mq\n')
             fp.write('syntax: glob\n')
@@ -2314,7 +2314,7 @@ 
             fp.write('guards\n')
             fp.close()
         if not os.path.exists(r.wjoin('series')):
-            r.wopener('series', 'w').close()
+            r.wvfs('series', 'w').close()
         r[None].add(['.hgignore', 'series'])
         commands.add(ui, r)
     return 0
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -190,7 +190,6 @@ 
 
     def __init__(self, baseui, path=None, create=False):
         self.wvfs = scmutil.vfs(path, expandpath=True, realpath=True)
-        self.wopener = self.wvfs
         self.root = self.wvfs.base
         self.path = self.wvfs.join(".hg")
         self.origroot = path
diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -301,7 +301,7 @@ 
     if f2 is None:
         f2 = f
     return (os.path.isfile(repo.wjoin(f))
-        and repo.wopener.audit.check(f)
+        and repo.wvfs.audit.check(f)
         and repo.dirstate.normalize(f) not in repo.dirstate
         and mctx[f2].cmp(wctx[f]))
 
@@ -651,7 +651,7 @@ 
     verbose = repo.ui.verbose
     unlink = util.unlinkpath
     wjoin = repo.wjoin
-    audit = repo.wopener.audit
+    audit = repo.wvfs.audit
     i = 0
     for f, args, msg in actions:
         repo.ui.debug(" %s: %s -> r\n" % (f, msg))
@@ -727,7 +727,7 @@ 
         if f1 != f and move:
             moves.append(f1)
 
-    audit = repo.wopener.audit
+    audit = repo.wvfs.audit
     _updating = _('updating')
     _files = _('files')
     progress = repo.ui.progress