Patchwork [4,of,8] localrepo: use "vfs.rename()" instead of "util.rename()"

login
register
mail settings
Submitter Katsunori FUJIWARA
Date April 14, 2013, 5:23 p.m.
Message ID <377ae29bfbc64406fff3.1365960193@feefifofum>
Download mbox | patch
Permalink /patch/1300/
State Superseded, archived
Commit 2f05fa16231653494331fc79967d48a9d1db7b03
Headers show

Comments

Katsunori FUJIWARA - April 14, 2013, 5:23 p.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
# Date 1365956535 -32400
# Node ID 377ae29bfbc64406fff3a6b8d2cb9a1b4efcfd70
# Parent  27bd1687a600db77f96fa55bd9f3116fa461b144
localrepo: use "vfs.rename()" instead of "util.rename()"

Patch

diff -r 27bd1687a600 -r 377ae29bfbc6 mercurial/localrepo.py
--- a/mercurial/localrepo.py	Mon Apr 15 01:22:15 2013 +0900
+++ b/mercurial/localrepo.py	Mon Apr 15 01:22:15 2013 +0900
@@ -904,17 +904,15 @@ 
         self.destroying()
         transaction.rollback(self.sopener, self.sjoin('undo'), ui.warn)
         if self.vfs.exists('undo.bookmarks'):
-            util.rename(self.join('undo.bookmarks'),
-                        self.join('bookmarks'))
+            self.vfs.rename('undo.bookmarks', 'bookmarks')
         if self.svfs.exists('undo.phaseroots'):
-            util.rename(self.sjoin('undo.phaseroots'),
-                        self.sjoin('phaseroots'))
+            self.svfs.rename('undo.phaseroots', 'phaseroots')
         self.invalidate()
 
         parentgone = (parents[0] not in self.changelog.nodemap or
                       parents[1] not in self.changelog.nodemap)
         if parentgone:
-            util.rename(self.join('undo.dirstate'), self.join('dirstate'))
+            self.vfs.rename('undo.dirstate', 'dirstate')
             try:
                 branch = self.opener.read('undo.branch')
                 self.dirstate.setbranch(encoding.tolocal(branch))
diff -r 27bd1687a600 -r 377ae29bfbc6 mercurial/scmutil.py
--- a/mercurial/scmutil.py	Mon Apr 15 01:22:15 2013 +0900
+++ b/mercurial/scmutil.py	Mon Apr 15 01:22:15 2013 +0900
@@ -254,6 +254,9 @@ 
     def readdir(self, path=None, stat=None, skip=None):
         return osutil.listdir(self.join(path), stat, skip)
 
+    def rename(self, src, dst):
+        return util.rename(self.join(src), self.join(dst))
+
     def stat(self, path=None):
         return os.stat(self.join(path))