Patchwork [4,of,4] vfs: use repo.vfs.rename

login
register
mail settings
Submitter Mads Kiilerich
Date March 11, 2017, 7:07 p.m.
Message ID <fdbee5ee81dd7f2156f1.1489259278@localhost.localdomain>
Download mbox | patch
Permalink /patch/19102/
State Superseded
Headers show

Comments

Mads Kiilerich - March 11, 2017, 7:07 p.m.
# HG changeset patch
# User Mads Kiilerich <mads@kiilerich.com>
# Date 1489259054 28800
#      Sat Mar 11 11:04:14 2017 -0800
# Node ID fdbee5ee81dd7f2156f1d06da4929ab4699cab06
# Parent  6a4b43aac8e015396498a35e332b1b7ada475fca
vfs: use repo.vfs.rename

Patch

diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -3338,7 +3338,7 @@  def qqueue(ui, repo, name=None, **opts):
                 continue
             fh.write('%s\n' % (queue,))
         fh.close()
-        util.rename(repo.join('patches.queues.new'), repo.join(_allqueues))
+        repo.vfs.rename('patches.queues.new', _allqueues)
 
     if not name or opts.get('list') or opts.get('active'):
         current = _getcurrent()
@@ -3391,7 +3391,7 @@  def qqueue(ui, repo, name=None, **opts):
                 else:
                     fh.write('%s\n' % (queue,))
             fh.close()
-            util.rename(repo.join('patches.queues.new'), repo.join(_allqueues))
+            repo.vfs.rename('patches.queues.new', _allqueues)
             _setactivenocheck(name)
         elif opts.get('delete'):
             _delete(name)
diff --git a/hgext/shelve.py b/hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -550,15 +550,13 @@  def unshelveabort(ui, repo, state, opts)
         try:
             checkparents(repo, state)
 
-            util.rename(repo.join('unshelverebasestate'),
-                        repo.join('rebasestate'))
+            repo.vfs.rename('unshelverebasestate', 'rebasestate')
             try:
                 rebase.rebase(ui, repo, **{
                     'abort' : True
                 })
             except Exception:
-                util.rename(repo.join('rebasestate'),
-                            repo.join('unshelverebasestate'))
+                repo.vfs.rename('rebasestate', 'unshelverebasestate')
                 raise
 
             mergefiles(ui, repo, state.wctx, state.pendingctx)
@@ -618,15 +616,13 @@  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'))
+        repo.vfs.rename('unshelverebasestate', 'rebasestate')
         try:
             rebase.rebase(ui, repo, **{
                 'continue' : True
             })
         except Exception:
-            util.rename(repo.join('rebasestate'),
-                        repo.join('unshelverebasestate'))
+            repo.vfs.rename('rebasestate', 'unshelverebasestate')
             raise
 
         shelvectx = repo['tip']
@@ -697,8 +693,7 @@  def _rebaserestoredcommit(ui, repo, opts
         shelvedstate.save(repo, basename, pctx, tmpwctx, stripnodes,
                           branchtorestore, opts.get('keep'))
 
-        util.rename(repo.join('rebasestate'),
-                    repo.join('unshelverebasestate'))
+        repo.vfs.rename('rebasestate', 'unshelverebasestate')
         raise error.InterventionRequired(
             _("unresolved conflicts (see 'hg resolve', then "
               "'hg unshelve --continue')"))