localrepo: make "undofiles()" return list of tuples "(vfs, relative filename)"
authorFUJIWARA Katsunori <foozy@lares.dti.ne.jp>
Sun, 09 Mar 2014 01:03:28 +0900
changeset 20975 37cdf1fca1b2
parent 20974 ef377f2e0ab9
child 20976 c20f4898631e
localrepo: make "undofiles()" return list of tuples "(vfs, relative filename)" Before this patch, "localrepository.undofiles()" returns list of absolute filename of undo files. This patch makes it return list of tuples "(vfs, relative filename)" to access undo files via vfs. This patch also changes "repair.strip()", which is the only user of "localrepository.undofiles()".
mercurial/localrepo.py
mercurial/repair.py
--- a/mercurial/localrepo.py	Fri Apr 11 17:20:15 2014 -0400
+++ b/mercurial/localrepo.py	Sun Mar 09 01:03:28 2014 +0900
@@ -862,7 +862,7 @@
                 (self.svfs, 'journal.phaseroots'))
 
     def undofiles(self):
-        return [vfs.join(undoname(x)) for vfs, x in self._journalfiles()]
+        return [(vfs, undoname(x)) for vfs, x in self._journalfiles()]
 
     def _writejournal(self, desc):
         self.opener.write("journal.dirstate",
--- a/mercurial/repair.py	Fri Apr 11 17:20:15 2014 -0400
+++ b/mercurial/repair.py	Sun Mar 09 01:03:28 2014 +0900
@@ -157,12 +157,13 @@
                 os.unlink(chgrpfile)
 
         # remove undo files
-        for undofile in repo.undofiles():
+        for undovfs, undofile in repo.undofiles():
             try:
-                os.unlink(undofile)
+                undovfs.unlink(undofile)
             except OSError, e:
                 if e.errno != errno.ENOENT:
-                    ui.warn(_('error removing %s: %s\n') % (undofile, str(e)))
+                    ui.warn(_('error removing %s: %s\n') %
+                            (undovfs.join(undofile), str(e)))
 
         for m in updatebm:
             bm[m] = repo[newbmtarget].node()