changeset 13357:b67867940bd1

bookmarks: move commit action into core
author Matt Mackall <mpm@selenic.com>
date Thu, 10 Feb 2011 13:46:27 -0600
parents d96db730fcb2
children f26a51857dc7
files hgext/bookmarks.py mercurial/localrepo.py
diffstat 2 files changed, 5 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/bookmarks.py	Thu Feb 10 13:46:27 2011 -0600
+++ b/hgext/bookmarks.py	Thu Feb 10 13:46:27 2011 -0600
@@ -169,23 +169,6 @@
                 key = self._bookmarks[key]
             return super(bookmark_repo, self).lookup(key)
 
-        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).commitctx(ctx, error)
-                if node is None:
-                    return None
-                parents = self.changelog.parents(node)
-                if parents[1] == nullid:
-                    parents = (parents[0],)
-
-                bookmarks.update(self, parents, node)
-                return node
-            finally:
-                wlock.release()
-
         def pull(self, remote, heads=None, force=False):
             result = super(bookmark_repo, self).pull(remote, heads, force)
 
--- a/mercurial/localrepo.py	Thu Feb 10 13:46:27 2011 -0600
+++ b/mercurial/localrepo.py	Thu Feb 10 13:46:27 2011 -0600
@@ -987,7 +987,11 @@
                         _('note: commit message saved in %s\n') % msgfn)
                 raise
 
-            # update dirstate and mergestate
+            # update bookmarks, dirstate and mergestate
+            parents = (p1, p2)
+            if p2 == nullid:
+                parents = (p1,)
+            bookmarks.update(self, parents, ret)
             for f in changes[0] + changes[1]:
                 self.dirstate.normal(f)
             for f in changes[2]: