--- a/hgext/bookmarks.py Sun Jul 26 10:45:35 2009 +0100
+++ b/hgext/bookmarks.py Mon Jul 27 19:23:04 2009 -0700
@@ -249,12 +249,12 @@
key = self._bookmarks[key]
return super(bookmark_repo, self).lookup(key)
- def commit(self, *k, **kw):
+ def commitctx(self, ctx, error=False):
"""Add a revision to the repository and
move the bookmark"""
wlock = self.wlock() # do both commit and bookmark with lock held
try:
- node = super(bookmark_repo, self).commit(*k, **kw)
+ node = super(bookmark_repo, self).commitctx(ctx, error)
if node is None:
return None
parents = self.changelog.parents(node)
@@ -262,12 +262,13 @@
parents = (parents[0],)
marks = parse(self)
update = False
- for mark, n in marks.items():
- if ui.configbool('bookmarks', 'track.current'):
- if mark == current(self) and n in parents:
- marks[mark] = node
- update = True
- else:
+ if ui.configbool('bookmarks', 'track.current'):
+ mark = current(self)
+ if mark and marks[mark] in parents:
+ marks[mark] = node
+ update = True
+ else:
+ for mark, n in marks.items():
if n in parents:
marks[mark] = node
update = True
@@ -288,10 +289,16 @@
node = self.changelog.tip()
marks = parse(self)
update = False
- for mark, n in marks.items():
- if n in parents:
+ if ui.configbool('bookmarks', 'track.current'):
+ mark = current(self)
+ if mark and marks[mark] in parents:
marks[mark] = node
update = True
+ else:
+ for mark, n in marks.items():
+ if n in parents:
+ marks[mark] = node
+ update = True
if update:
write(self, marks)
return result