Patchwork [3,of,3] localrepo: remove all external users of localrepo.wopener

login
register
mail settings
Submitter Angel Ezquerra
Date Jan. 16, 2015, 12:05 a.m.
Message ID <dc6d8a8243f3096d6eb2.1421366748@Angels-MacBook-Pro.local>
Download mbox | patch
Permalink /patch/7475/
State Accepted
Headers show

Comments

Angel Ezquerra - Jan. 16, 2015, 12:05 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 dc6d8a8243f3096d6eb2800ef18f300a2d9d54e1
# Parent  aef00913bb3608ce9d16f1b52e0d528c4ed97028
localrepo: remove all external users of localrepo.wopener

This change touches every module in which repository.wopener was being used, and
changes it for the equivalent repository.wvfs.

It should now be possible to remove localrepo.wopener.
Pierre-Yves David - Jan. 16, 2015, 2:46 a.m.
On 01/15/2015 04:05 PM, Angel Ezquerra wrote:
> # HG changeset patch
> # User Angel Ezquerra <angel.ezquerra@gmail.com>
> # Date 1420937512 -3600
> #      Sun Jan 11 01:51:52 2015 +0100
> # Node ID dc6d8a8243f3096d6eb2800ef18f300a2d9d54e1
> # Parent  aef00913bb3608ce9d16f1b52e0d528c4ed97028
> localrepo: remove all external users of localrepo.wopener
>
> This change touches every module in which repository.wopener was being used, and
> changes it for the equivalent repository.wvfs.
>
> It should now be possible to remove localrepo.wopener.

There three are pushed to the clowncopter.

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/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