vfs: use repo.vfs.rename
authorMads Kiilerich <mads@kiilerich.com>
Sat, 11 Mar 2017 11:04:14 -0800
changeset 31312 7eb53603744b
parent 31311 f59b6cf663a9
child 31313 80752c655320
vfs: use repo.vfs.rename
hgext/mq.py
hgext/shelve.py
--- a/hgext/mq.py	Sat Mar 11 11:02:25 2017 -0800
+++ b/hgext/mq.py	Sat Mar 11 11:04:14 2017 -0800
@@ -3339,7 +3339,7 @@
                 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()
@@ -3392,7 +3392,7 @@
                 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)
--- a/hgext/shelve.py	Sat Mar 11 11:02:25 2017 -0800
+++ b/hgext/shelve.py	Sat Mar 11 11:04:14 2017 -0800
@@ -551,15 +551,13 @@
         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)
@@ -619,15 +617,13 @@
                 _("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']
@@ -698,8 +694,7 @@
         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')"))