Patchwork [18,of,20] shelve: directly use repo.vfs.join

login
register
mail settings
Submitter Pierre-Yves David
Date March 12, 2017, 2:45 p.m.
Message ID <601f0e651365ed906bd9.1489329952@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/19163/
State Accepted
Headers show

Comments

Pierre-Yves David - March 12, 2017, 2:45 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
# Date 1489020762 28800
#      Wed Mar 08 16:52:42 2017 -0800
# Node ID 601f0e651365ed906bd9e59ab139e908f50adf8c
# Parent  99130f7619bff6da9ee1b569c0fa3bd172478ece
# 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 601f0e651365
shelve: directly use repo.vfs.join

The 'repo.join' method is about to be deprecated.

Patch

diff --git a/hgext/shelve.py b/hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -79,8 +79,8 @@  class shelvedfile(object):
     def __init__(self, repo, name, filetype=None):
         self.repo = repo
         self.name = name
-        self.vfs = vfsmod.vfs(repo.join(shelvedir))
-        self.backupvfs = vfsmod.vfs(repo.join(backupdir))
+        self.vfs = vfsmod.vfs(repo.vfs.join(shelvedir))
+        self.backupvfs = vfsmod.vfs(repo.vfs.join(backupdir))
         self.ui = self.repo.ui
         if filetype:
             self.fname = name + '.' + filetype
@@ -218,10 +218,10 @@  class shelvedstate(object):
 
     @classmethod
     def clear(cls, repo):
-        util.unlinkpath(repo.join(cls._filename), ignoremissing=True)
+        util.unlinkpath(repo.vfs.join(cls._filename), ignoremissing=True)
 
 def cleanupoldbackups(repo):
-    vfs = vfsmod.vfs(repo.join(backupdir))
+    vfs = vfsmod.vfs(repo.vfs.join(backupdir))
     maxbackups = repo.ui.configint('shelve', 'maxbackups', 10)
     hgfiles = [f for f in vfs.listdir()
                if f.endswith('.' + patchextension)]
@@ -551,15 +551,15 @@  def unshelveabort(ui, repo, state, opts)
         try:
             checkparents(repo, state)
 
-            util.rename(repo.join('unshelverebasestate'),
-                        repo.join('rebasestate'))
+            util.rename(repo.vfs.join('unshelverebasestate'),
+                        repo.vfs.join('rebasestate'))
             try:
                 rebase.rebase(ui, repo, **{
                     'abort' : True
                 })
             except Exception:
-                util.rename(repo.join('rebasestate'),
-                            repo.join('unshelverebasestate'))
+                util.rename(repo.vfs.join('rebasestate'),
+                            repo.vfs.join('unshelverebasestate'))
                 raise
 
             mergefiles(ui, repo, state.wctx, state.pendingctx)
@@ -619,15 +619,15 @@  def unshelvecontinue(ui, repo, state, op
                 _("unresolved conflicts, can't continue"),
                 hint=_("see 'hg resolve', then 'hg unshelve --continue'"))
 
-        util.rename(repo.join('unshelverebasestate'),
-                    repo.join('rebasestate'))
+        util.rename(repo.vfs.join('unshelverebasestate'),
+                    repo.vfs.join('rebasestate'))
         try:
             rebase.rebase(ui, repo, **{
                 'continue' : True
             })
         except Exception:
-            util.rename(repo.join('rebasestate'),
-                        repo.join('unshelverebasestate'))
+            util.rename(repo.vfs.join('rebasestate'),
+                        repo.vfs.join('unshelverebasestate'))
             raise
 
         shelvectx = repo['tip']
@@ -698,8 +698,8 @@  def _rebaserestoredcommit(ui, repo, opts
         shelvedstate.save(repo, basename, pctx, tmpwctx, stripnodes,
                           branchtorestore, opts.get('keep'))
 
-        util.rename(repo.join('rebasestate'),
-                    repo.join('unshelverebasestate'))
+        util.rename(repo.vfs.join('rebasestate'),
+                    repo.vfs.join('unshelverebasestate'))
         raise error.InterventionRequired(
             _("unresolved conflicts (see 'hg resolve', then "
               "'hg unshelve --continue')"))