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

FUJIWARA Katsunori foozy at lares.dti.ne.jp
Sun Apr 14 12:23:12 CDT 2013


# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1365956535 -32400
# Node ID 27bd1687a600db77f96fa55bd9f3116fa461b144
# Parent  82678ef500c55c41e3173f46b41cd77446b6293b
localrepo: use "vfs.exists()" instead of "os.path.exists()"

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()


More information about the Mercurial-devel mailing list