diff --git a/hggit/git_handler.py b/hggit/git_handler.py
index 78959c8e5e607a00f23e0991760439923bf30dfb_aGdnaXQvZ2l0X2hhbmRsZXIucHk=..078c3912afce7513ddc82321aa6f49fde8d42434_aGdnaXQvZ2l0X2hhbmRsZXIucHk= 100644
--- a/hggit/git_handler.py
+++ b/hggit/git_handler.py
@@ -300,8 +300,8 @@
                     # make sure the bookmark exists; at the point the remote
                     # branches has already been set up
                     suffix = self.branch_bookmark_suffix or ''
-                    self.repo._bookmarks[rhead + suffix] = rnode
-                    util.recordbookmarks(self.repo, self.repo._bookmarks)
+                    changes = [(rhead + suffix, rnode)]
+                    util.updatebookmarks(self.repo, changes)
                     bms = [rhead + suffix]
 
                 if bms:
@@ -1372,6 +1372,7 @@
                           if ref.startswith('refs/heads/')])
 
             suffix = self.branch_bookmark_suffix or ''
+            changes = []
             for head, sha in heads.iteritems():
                 # refs contains all the refs in the server, not just
                 # the ones we are pulling
@@ -1381,8 +1382,8 @@
                 hgsha = bin(hgsha)
                 if head not in bms:
                     # new branch
-                    bms[head + suffix] = hgsha
+                    changes.append((head + suffix, hgsha))
                 else:
                     bm = self.repo[bms[head]]
                     if bm.ancestor(self.repo[hgsha]) == bm:
                         # fast forward
@@ -1385,7 +1386,7 @@
                 else:
                     bm = self.repo[bms[head]]
                     if bm.ancestor(self.repo[hgsha]) == bm:
                         # fast forward
-                        bms[head + suffix] = hgsha
+                        changes.append((head + suffix, hgsha))
 
             if heads:
@@ -1390,6 +1391,6 @@
 
             if heads:
-                util.recordbookmarks(self.repo, bms)
+                util.updatebookmarks(self.repo, changes)
 
         except AttributeError:
             self.ui.warn(_('creating bookmarks failed, do you have'
diff --git a/hggit/util.py b/hggit/util.py
index 78959c8e5e607a00f23e0991760439923bf30dfb_aGdnaXQvdXRpbC5weQ==..078c3912afce7513ddc82321aa6f49fde8d42434_aGdnaXQvdXRpbC5weQ== 100644
--- a/hggit/util.py
+++ b/hggit/util.py
@@ -94,5 +94,5 @@
             return True
     return False
 
-def recordbookmarks(repo, bms, name='git_handler'):
+def updatebookmarks(repo, changes, name='git_handler'):
     """abstract writing bookmarks for backwards compatibility"""
@@ -98,6 +98,7 @@
     """abstract writing bookmarks for backwards compatibility"""
+    bms = repo._bookmarks
     tr = lock = wlock = None
     try:
         wlock = repo.wlock()
         lock = repo.lock()
         tr = repo.transaction(name)
@@ -99,9 +100,9 @@
     tr = lock = wlock = None
     try:
         wlock = repo.wlock()
         lock = repo.lock()
         tr = repo.transaction(name)
-        if hgutil.safehasattr(bms, 'recordchange'):
-            # recordchange was added in mercurial 3.2
-            bms.recordchange(tr)
+        if hgutil.safehasattr(bms, 'applychanges'):
+            # applychanges was added in mercurial 4.3
+            bms.applychanges(repo, tr, changes)
         else:
@@ -107,5 +108,14 @@
         else:
-            bms.write()
+            for name, node in changes:
+                if node is None:
+                    del bms[name]
+                else:
+                    bms[name] = node
+            if hgutil.safehasattr(bms, 'recordchange'):
+                # recordchange was added in mercurial 3.2
+                bms.recordchange(tr)
+            else:
+                bms.write()
         tr.close()
     finally:
         lockmod.release(tr, lock, wlock)