diff --git a/hggit/git_handler.py b/hggit/git_handler.py
index bf5d4487560b7c2e088b0cec289104a8bb4420a6_aGdnaXQvZ2l0X2hhbmRsZXIucHk=..264471993b24d6da11ad8e4533f8a48356f4940c_aGdnaXQvZ2l0X2hhbmRsZXIucHk= 100644
--- a/hggit/git_handler.py
+++ b/hggit/git_handler.py
@@ -1675,7 +1675,9 @@
                         changes.append((head + suffix, hgsha))
 
             if changes:
-                util.updatebookmarks(self.repo, changes)
+                with self.repo.wlock(), self.repo.lock():
+                    with self.repo.transaction(b"hg-git") as tr:
+                        bms.applychanges(self.repo, tr, changes)
 
         except AttributeError:
             self.ui.warn(_(b'creating bookmarks failed, do you have'
diff --git a/hggit/util.py b/hggit/util.py
index bf5d4487560b7c2e088b0cec289104a8bb4420a6_aGdnaXQvdXRpbC5weQ==..264471993b24d6da11ad8e4533f8a48356f4940c_aGdnaXQvdXRpbC5weQ== 100644
--- a/hggit/util.py
+++ b/hggit/util.py
@@ -10,7 +10,6 @@
 from mercurial.i18n import _
 from mercurial import (
     error,
-    lock as lockmod,
     util as hgutil,
 )
 
@@ -102,20 +101,6 @@
     return False
 
 
-def updatebookmarks(repo, changes, name=b'git_handler'):
-    """abstract writing bookmarks for backwards compatibility"""
-    bms = repo._bookmarks
-    tr = lock = wlock = None
-    try:
-        wlock = repo.wlock()
-        lock = repo.lock()
-        tr = repo.transaction(name)
-        bms.applychanges(repo, tr, changes)
-        tr.close()
-    finally:
-        lockmod.release(tr, lock, wlock)
-
-
 def checksafessh(host):
     """check if a hostname is a potentially unsafe ssh exploit (SEC)