vfs: replace 'scmutil.opener' usage with 'scmutil.vfs'
The 'vfs' class is the first class citizen for years. We remove all usages of
the older API. This will let us remove the old API eventually.
--- a/contrib/undumprevlog Tue Mar 07 12:52:00 2017 -0800
+++ b/contrib/undumprevlog Thu Mar 02 03:52:36 2017 +0100
@@ -17,7 +17,7 @@
for fp in (sys.stdin, sys.stdout, sys.stderr):
util.setbinary(fp)
-opener = scmutil.opener('.', False)
+opener = scmutil.vfs('.', False)
tr = transaction.transaction(sys.stderr.write, opener, {'store': opener},
"undump.journal")
while True:
--- a/hgext/convert/subversion.py Tue Mar 07 12:52:00 2017 -0800
+++ b/hgext/convert/subversion.py Thu Mar 02 03:52:36 2017 +0100
@@ -1146,8 +1146,8 @@
self.run0('checkout', path, wcpath)
self.wc = wcpath
- self.opener = scmutil.opener(self.wc)
- self.wopener = scmutil.opener(self.wc)
+ self.opener = scmutil.vfs(self.wc)
+ self.wopener = scmutil.vfs(self.wc)
self.childmap = mapfile(ui, self.join('hg-childmap'))
if util.checkexec(self.wc):
self.is_exec = util.isexec
--- a/hgext/largefiles/lfutil.py Tue Mar 07 12:52:00 2017 -0800
+++ b/hgext/largefiles/lfutil.py Thu Mar 02 03:52:36 2017 +0100
@@ -144,7 +144,7 @@
'''
vfs = repo.vfs
lfstoredir = longname
- opener = scmutil.opener(vfs.join(lfstoredir))
+ opener = scmutil.vfs(vfs.join(lfstoredir))
lfdirstate = largefilesdirstate(opener, ui, repo.root,
repo.dirstate._validate)
--- a/hgext/mq.py Tue Mar 07 12:52:00 2017 -0800
+++ b/hgext/mq.py Thu Mar 02 03:52:36 2017 +0100
@@ -434,7 +434,7 @@
except IOError:
curpath = os.path.join(path, 'patches')
self.path = patchdir or curpath
- self.opener = scmutil.opener(self.path)
+ self.opener = scmutil.vfs(self.path)
self.ui = ui
self.baseui = baseui
self.applieddirty = False
--- a/hgext/transplant.py Tue Mar 07 12:52:00 2017 -0800
+++ b/hgext/transplant.py Thu Mar 02 03:52:36 2017 +0100
@@ -60,7 +60,7 @@
self.opener = opener
if not opener:
- self.opener = scmutil.opener(self.path)
+ self.opener = scmutil.vfs(self.path)
self.transplants = {}
self.dirty = False
self.read()
@@ -103,7 +103,7 @@
def __init__(self, ui, repo, opts):
self.ui = ui
self.path = repo.join('transplant')
- self.opener = scmutil.opener(self.path)
+ self.opener = scmutil.vfs(self.path)
self.transplants = transplants(self.path, 'transplants',
opener=self.opener)
def getcommiteditor():
--- a/mercurial/archival.py Tue Mar 07 12:52:00 2017 -0800
+++ b/mercurial/archival.py Thu Mar 02 03:52:36 2017 +0100
@@ -249,7 +249,7 @@
def __init__(self, name, mtime):
self.basedir = name
- self.opener = scmutil.opener(self.basedir)
+ self.opener = scmutil.vfs(self.basedir)
def addfile(self, name, mode, islink, data):
if islink:
--- a/mercurial/cmdutil.py Tue Mar 07 12:52:00 2017 -0800
+++ b/mercurial/cmdutil.py Thu Mar 02 03:52:36 2017 +0100
@@ -583,7 +583,7 @@
raise error.CommandError(cmd, _('invalid arguments'))
if not os.path.isfile(file_):
raise error.Abort(_("revlog '%s' not found") % file_)
- r = revlog.revlog(scmutil.opener(pycompat.getcwd(), audit=False),
+ r = revlog.revlog(scmutil.vfs(pycompat.getcwd(), audit=False),
file_[:-2] + ".i")
return r
--- a/mercurial/debugcommands.py Tue Mar 07 12:52:00 2017 -0800
+++ b/mercurial/debugcommands.py Thu Mar 02 03:52:36 2017 +0100
@@ -76,7 +76,7 @@
"""find the ancestor revision of two revisions in a given index"""
if len(args) == 3:
index, rev1, rev2 = args
- r = revlog.revlog(scmutil.opener(pycompat.getcwd(), audit=False), index)
+ r = revlog.revlog(scmutil.vfs(pycompat.getcwd(), audit=False), index)
lookup = r.lookup
elif len(args) == 2:
if not repo:
@@ -452,7 +452,7 @@
spaces = opts.get('spaces')
dots = opts.get('dots')
if file_:
- rlog = revlog.revlog(scmutil.opener(pycompat.getcwd(), audit=False),
+ rlog = revlog.revlog(scmutil.vfs(pycompat.getcwd(), audit=False),
file_)
revs = set((int(r) for r in revs))
def events():
--- a/mercurial/patch.py Tue Mar 07 12:52:00 2017 -0800
+++ b/mercurial/patch.py Thu Mar 02 03:52:36 2017 +0100
@@ -449,7 +449,7 @@
class fsbackend(abstractbackend):
def __init__(self, ui, basedir):
super(fsbackend, self).__init__(ui)
- self.opener = scmutil.opener(basedir)
+ self.opener = scmutil.vfs(basedir)
def _join(self, f):
return os.path.join(self.opener.base, f)
@@ -560,7 +560,7 @@
else:
if self.opener is None:
root = tempfile.mkdtemp(prefix='hg-patch-')
- self.opener = scmutil.opener(root)
+ self.opener = scmutil.vfs(root)
# Avoid filename issues with these simple names
fn = str(self.created)
self.opener.write(fn, data)
--- a/mercurial/simplemerge.py Tue Mar 07 12:52:00 2017 -0800
+++ b/mercurial/simplemerge.py Thu Mar 02 03:52:36 2017 +0100
@@ -437,7 +437,7 @@
local = os.path.realpath(local)
if not opts.get('print'):
- opener = scmutil.opener(os.path.dirname(local))
+ opener = scmutil.vfs(os.path.dirname(local))
out = opener(os.path.basename(local), "w", atomictemp=True)
else:
out = ui.fout
--- a/tests/test-filecache.py Tue Mar 07 12:52:00 2017 -0800
+++ b/tests/test-filecache.py Thu Mar 02 03:52:36 2017 +0100
@@ -73,7 +73,7 @@
# atomic replace file, size doesn't change
# hopefully st_mtime doesn't change as well so this doesn't use the cache
# because of inode change
- f = scmutil.opener('.')('x', 'w', atomictemp=True)
+ f = scmutil.vfs('.')('x', 'w', atomictemp=True)
f.write('b')
f.close()
@@ -97,7 +97,7 @@
# should recreate the object
repo.cached
- f = scmutil.opener('.')('y', 'w', atomictemp=True)
+ f = scmutil.vfs('.')('y', 'w', atomictemp=True)
f.write('B')
f.close()
@@ -105,10 +105,10 @@
print("* file y changed inode")
repo.cached
- f = scmutil.opener('.')('x', 'w', atomictemp=True)
+ f = scmutil.vfs('.')('x', 'w', atomictemp=True)
f.write('c')
f.close()
- f = scmutil.opener('.')('y', 'w', atomictemp=True)
+ f = scmutil.vfs('.')('y', 'w', atomictemp=True)
f.write('C')
f.close()
--- a/tests/test-parseindex.t Tue Mar 07 12:52:00 2017 -0800
+++ b/tests/test-parseindex.t Thu Mar 02 03:52:36 2017 +0100
@@ -42,7 +42,7 @@
> return getattr(self.real, key)
>
> def opener(*args):
- > o = scmutil.opener(*args)
+ > o = scmutil.vfs(*args)
> def wrapper(*a):
> f = o(*a)
> return singlebyteread(f)