--- a/hgext/bookmarks.py Thu Feb 10 13:46:28 2011 -0600
+++ b/hgext/bookmarks.py Thu Feb 10 13:46:28 2011 -0600
@@ -129,36 +129,6 @@
label=label)
return
-def _revstostrip(changelog, node):
- srev = changelog.rev(node)
- tostrip = [srev]
- saveheads = []
- for r in xrange(srev, len(changelog)):
- parents = changelog.parentrevs(r)
- if parents[0] in tostrip or parents[1] in tostrip:
- tostrip.append(r)
- if parents[1] != nullrev:
- for p in parents:
- if p not in tostrip and p > srev:
- saveheads.append(p)
- return [r for r in tostrip if r not in saveheads]
-
-def strip(oldstrip, ui, repo, node, backup="all"):
- """Strip bookmarks if revisions are stripped using
- the mercurial.strip method. This usually happens during
- qpush and qpop"""
- revisions = _revstostrip(repo.changelog, node)
- marks = repo._bookmarks
- update = []
- for mark, n in marks.iteritems():
- if repo.changelog.rev(n) in revisions:
- update.append(mark)
- oldstrip(ui, repo, node, backup)
- if len(update) > 0:
- for m in update:
- marks[m] = repo.changectx('.').node()
- bookmarks.write(repo)
-
def reposetup(ui, repo):
if not repo.local():
return
@@ -315,7 +285,6 @@
return oldoutgoing(ui, repo, dest, **opts)
def uisetup(ui):
- extensions.wrapfunction(repair, "strip", strip)
if ui.configbool('bookmarks', 'track.current'):
extensions.wrapcommand(commands.table, 'update', updatecurbookmark)
--- 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")