[PATCH 4 of 6] bookmarks: update and updatecurrentbookmark return status

Kevin Bullock kbullock+mercurial at ringworld.org
Wed Dec 7 11:40:56 CST 2011


# HG changeset patch
# User Kevin Bullock <kbullock at ringworld.org>
# Date 1321478997 21600
# Node ID 1917c90be9b026cc5aeff849a07045f38e221be7
# Parent  72dead285560d6b77d32a2a221301f0b65c29095
bookmarks: update and updatecurrentbookmark return status

This makes bookmarks.update() and bookmarks.updatecurrentbookmark() return
True or False to indicate whether the bookmark was updated or not. This allows
callers to e.g. abort if the update failed.

diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py
--- a/mercurial/bookmarks.py
+++ b/mercurial/bookmarks.py
@@ -128,7 +128,7 @@
 
 def updatecurrentbookmark(repo, oldnode, curbranch):
     try:
-        update(repo, oldnode, repo.branchtags()[curbranch])
+        return update(repo, oldnode, repo.branchtags()[curbranch])
     except KeyError:
         if curbranch == "default": # no default branch!
             update(repo, oldnode, repo.lookup("tip"))
@@ -147,6 +147,7 @@
             update = True
     if update:
         repo._writebookmarks(marks)
+    return update
 
 def listbookmarks(repo):
     # We may try to list bookmarks on a repo type that does not


More information about the Mercurial-devel mailing list