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

mail settings
Submitter Katsunori FUJIWARA
Date April 14, 2013, 5:23 p.m.
Message ID <e2b72160ef7b8b950c59.1365960197@feefifofum>
Download mbox | patch
Permalink /patch/1298/
State Accepted, archived
Headers show


Katsunori FUJIWARA - April 14, 2013, 5:23 p.m.
# HG changeset patch
# User FUJIWARA Katsunori <>
# Date 1365956535 -32400
# Node ID e2b72160ef7b8b950c5991fe289c9ea9cebd9a55
# Parent  f0ccfa4681e72a0871841184139322728a2ed0b8
localrepo: use "vfs.rename()" instead of "util.rename()"

This patch makes "_journalfiles()" return a list of pairs of journal
file and corresponded vfs instance instead of a list of journal files
in full path, to use "vfs.rename()" instead of "util.rename()" in

"undofiles()" still returns a list of undo files in full path, because
"repair.strip()" expects such list. It'll be also made to return a
list of pairs of undo file and corresponded vfs at vfs migration for
"repair.strip()" in the near future.


diff -r f0ccfa4681e7 -r e2b72160ef7b mercurial/
--- a/mercurial/	Mon Apr 15 01:22:15 2013 +0900
+++ b/mercurial/	Mon Apr 15 01:22:15 2013 +0900
@@ -811,7 +811,7 @@ 
                 _("abandoned transaction found - run hg recover"))
-        renames = [(x, undoname(x)) for x in self._journalfiles()]
+        renames = [(vfs, x, undoname(x)) for vfs, x in self._journalfiles()]
         tr = transaction.transaction(self.ui.warn, self.sopener,
@@ -821,13 +821,15 @@ 
         return tr
     def _journalfiles(self):
-        return (self.sjoin('journal'), self.join('journal.dirstate'),
-                self.join('journal.branch'), self.join('journal.desc'),
-                self.join('journal.bookmarks'),
-                self.sjoin('journal.phaseroots'))
+        return ((self.svfs, 'journal'),
+                (self.vfs, 'journal.dirstate'),
+                (self.vfs, 'journal.branch'),
+                (self.vfs, 'journal.desc'),
+                (self.vfs, 'journal.bookmarks'),
+                (self.svfs, 'journal.phaseroots'))
     def undofiles(self):
-        return [undoname(x) for x in self._journalfiles()]
+        return [vfs.join(undoname(x)) for vfs, x in self._journalfiles()]
     def _writejournal(self, desc):
@@ -2575,9 +2577,9 @@ 
 def aftertrans(files):
     renamefiles = [tuple(t) for t in files]
     def a():
-        for src, dest in renamefiles:
+        for vfs, src, dest in renamefiles:
-                util.rename(src, dest)
+                vfs.rename(src, dest)
             except OSError: # journal file does not yet exist
     return a