# HG changeset patch # User Laurent Charignon # Date 2015-11-17 01:15:36 # Node ID 4b5dc0d9e89972a5e17eb8c3874fc9640d0522f5 # Parent fdd63acf321573f64efe0d364403adbcbe7f5439 convert: use repo._bookmarks.recordchange instead of repo._bookmarks.write Before this patch, convert was using repo._bookmarks.write, a deprecated API for saving bookmarks. This patch changes the use of repo._bookmarks.write to repo._bookmarks.recordchange. diff --git a/hgext/convert/hg.py b/hgext/convert/hg.py --- a/hgext/convert/hg.py +++ b/hgext/convert/hg.py @@ -23,6 +23,7 @@ from mercurial.i18n import _ from mercurial.node import bin, hex, nullid from mercurial import hg, util, context, bookmarks, error, scmutil, exchange from mercurial import phases +from mercurial import lock as lockmod from mercurial import merge as mergemod from common import NoRepo, commit, converter_source, converter_sink, mapfile @@ -410,12 +411,19 @@ class mercurial_sink(converter_sink): def putbookmarks(self, updatedbookmark): if not len(updatedbookmark): return - if True: + wlock = lock = tr = None + try: + wlock = self.repo.wlock() + lock = self.repo.lock() + tr = self.repo.transaction('bookmark') self.ui.status(_("updating bookmarks\n")) destmarks = self.repo._bookmarks for bookmark in updatedbookmark: destmarks[bookmark] = bin(updatedbookmark[bookmark]) - destmarks.write() + destmarks.recordchange(tr) + tr.close() + finally: + lockmod.release(lock, wlock, tr) def hascommitfrommap(self, rev): # the exact semantics of clonebranches is unclear so we can't say no