# HG changeset patch # User Kevin Bullock # Date 2011-11-16 21:29:57 # Node ID 013688350c7d830a06750ce27d5e676fa2309e38 # Parent 73faa26649095e4f15b351e8f4e9bcfbcd0901a1 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,10 +128,10 @@ def setcurrent(repo, mark): 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")) + return update(repo, oldnode, repo.lookup("tip")) else: raise util.Abort(_("branch %s not found") % curbranch) @@ -147,6 +147,7 @@ def update(repo, parents, node): 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