Patchwork [03,of,22] vfs: use 'vfs' module directly in 'mercurial.patch'

login
register
mail settings
Submitter Pierre-Yves David
Date March 8, 2017, 9:18 p.m.
Message ID <712046a71a6fb8fabde3.1489007894@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/19001/
State Accepted
Headers show

Comments

Pierre-Yves David - March 8, 2017, 9:18 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
# Date 1488457799 -3600
#      Thu Mar 02 13:29:59 2017 +0100
# Node ID 712046a71a6fb8fabde315c312dc66e424c57bc9
# Parent  3ea27e3eb238450add3bca5b9d23f9bba3ddfced
# EXP-Topic vfs.cleanup
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r 712046a71a6f
vfs: use 'vfs' module directly in 'mercurial.patch'

Now that the 'vfs' classes moved in their own module, lets use the new module
directly. We update code iteratively to help with possible bisect needs in the
future.

Patch

diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -38,6 +38,7 @@  from . import (
     scmutil,
     similar,
     util,
+    vfs as vfsmod,
 )
 stringio = util.stringio
 
@@ -449,7 +450,7 @@  class abstractbackend(object):
 class fsbackend(abstractbackend):
     def __init__(self, ui, basedir):
         super(fsbackend, self).__init__(ui)
-        self.opener = scmutil.vfs(basedir)
+        self.opener = vfsmod.vfs(basedir)
 
     def _join(self, f):
         return os.path.join(self.opener.base, f)
@@ -560,7 +561,7 @@  class filestore(object):
         else:
             if self.opener is None:
                 root = tempfile.mkdtemp(prefix='hg-patch-')
-                self.opener = scmutil.vfs(root)
+                self.opener = vfsmod.vfs(root)
             # Avoid filename issues with these simple names
             fn = str(self.created)
             self.opener.write(fn, data)