diff mercurial/repair.py @ 13362:ee01d9d84115

bookmarks: move strip support to repair
author Matt Mackall <mpm@selenic.com>
date Thu, 10 Feb 2011 13:46:28 -0600
parents 798ef5b19cb1
children ffd370aa050b
line wrap: on
line diff
--- a/mercurial/repair.py	Thu Feb 10 13:46:28 2011 -0600
+++ b/mercurial/repair.py	Thu Feb 10 13:46:28 2011 -0600
@@ -6,7 +6,7 @@
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2 or any later version.
 
-import changegroup
+import changegroup, bookmarks
 from node import nullrev, short
 from i18n import _
 import os
@@ -105,6 +105,13 @@
             saveheads.difference_update(parents)
             saveheads.add(r)
 
+    bm = repo._bookmarks
+    updatebm = []
+    for m in bm:
+        rev = repo[bm[m]].rev()
+        if rev in tostrip:
+            updatebm.append(m)
+
     saveheads = [cl.node(r) for r in saveheads]
     files = _collectfiles(repo, striprev)
 
@@ -155,6 +162,11 @@
             f.close()
             if not keeppartialbundle:
                 os.unlink(chgrpfile)
+
+        for m in updatebm:
+            bm[m] = repo['.'].node()
+        bookmarks.write(repo)
+
     except:
         if backupfile:
             ui.warn(_("strip failed, full bundle stored in '%s'\n")