Patchwork [3,of,8] localrepo: use "vfs.exists()" instead of "os.path.exists()"

login
register
mail settings
Submitter Katsunori FUJIWARA
Date April 14, 2013, 5:23 p.m.
Message ID <27bd1687a600db77f96f.1365960192@feefifofum>
Download mbox | patch
Permalink /patch/1296/
State Accepted, archived
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 27bd1687a600db77f96fa55bd9f3116fa461b144
# Parent  82678ef500c55c41e3173f46b41cd77446b6293b
localrepo: use "vfs.exists()" instead of "os.path.exists()"

Patch

diff -r 82678ef500c5 -r 27bd1687a600 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
@@ -806,7 +806,7 @@ 
             return tr.nest()
 
         # abort here if the journal already exists
-        if os.path.exists(self.sjoin("journal")):
+        if self.svfs.exists("journal"):
             raise error.RepoError(
                 _("abandoned transaction found - run hg recover"))
 
@@ -844,7 +844,7 @@ 
     def recover(self):
         lock = self.lock()
         try:
-            if os.path.exists(self.sjoin("journal")):
+            if self.svfs.exists("journal"):
                 self.ui.status(_("rolling back interrupted transaction\n"))
                 transaction.rollback(self.sopener, self.sjoin("journal"),
                                      self.ui.warn)
@@ -861,7 +861,7 @@ 
         try:
             wlock = self.wlock()
             lock = self.lock()
-            if os.path.exists(self.sjoin("undo")):
+            if self.svfs.exists("undo"):
                 return self._rollback(dryrun, force)
             else:
                 self.ui.warn(_("no rollback information available\n"))
@@ -903,10 +903,10 @@ 
         parents = self.dirstate.parents()
         self.destroying()
         transaction.rollback(self.sopener, self.sjoin('undo'), ui.warn)
-        if os.path.exists(self.join('undo.bookmarks')):
+        if self.vfs.exists('undo.bookmarks'):
             util.rename(self.join('undo.bookmarks'),
                         self.join('bookmarks'))
-        if os.path.exists(self.sjoin('undo.phaseroots')):
+        if self.svfs.exists('undo.phaseroots'):
             util.rename(self.sjoin('undo.phaseroots'),
                         self.sjoin('phaseroots'))
         self.invalidate()