changeset 16237:b5c0c7d0f83f

repair: remove undo files after strip
author Idan Kamara <idankk86@gmail.com>
date Tue, 06 Mar 2012 18:43:05 +0200
parents 97efd26eb957
children e8eecfe37d4e
files mercurial/repair.py
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/repair.py	Tue Mar 06 18:42:52 2012 +0200
+++ b/mercurial/repair.py	Tue Mar 06 18:43:05 2012 +0200
@@ -56,7 +56,7 @@
 
 def strip(ui, repo, node, backup="all"):
     cl = repo.changelog
-    # TODO delete the undo files, and handle undo of merge sets
+    # TODO handle undo of merge sets
     striprev = cl.rev(node)
 
     keeppartialbundle = backup == 'strip'
@@ -142,6 +142,14 @@
             if not keeppartialbundle:
                 os.unlink(chgrpfile)
 
+        # remove undo files
+        for undofile in repo.undofiles():
+            try:
+                os.unlink(undofile)
+            except OSError, e:
+                if e.errno != errno.ENOENT:
+                    ui.warn(_('error removing %s: %s\n') % (undofile, str(e)))
+
         for m in updatebm:
             bm[m] = repo['.'].node()
         bookmarks.write(repo)