hgext/narrow/narrowbundle2.py
changeset 40868 109a267acc1e
parent 40867 0d50bfcd8f65
child 41076 8ecb17b7f432
--- a/hgext/narrow/narrowbundle2.py	Sat Dec 08 23:04:11 2018 -0800
+++ b/hgext/narrow/narrowbundle2.py	Sat Dec 08 23:41:54 2018 -0800
@@ -20,6 +20,7 @@
     changegroup,
     error,
     exchange,
+    localrepo,
     narrowspec,
     repair,
     repository,
@@ -179,14 +180,13 @@
 
     if clkills:
         # preserve bookmarks that repair.strip() would otherwise strip
-        bmstore = repo._bookmarks
+        op._bookmarksbackup = repo._bookmarks
         class dummybmstore(dict):
             def applychanges(self, repo, tr, changes):
                 pass
-        repo._bookmarks = dummybmstore()
+        localrepo.localrepository._bookmarks.set(repo, dummybmstore())
         chgrpfile = repair.strip(op.ui, repo, list(clkills), backup=True,
                                  topic='widen')
-        repo._bookmarks = bmstore
         if chgrpfile:
             op._widen_uninterr = repo.ui.uninterruptable()
             op._widen_uninterr.__enter__()
@@ -270,5 +270,10 @@
         origcghandler(op, inpart)
         if util.safehasattr(op, '_widen_bundle'):
             handlechangegroup_widen(op, inpart)
+        if util.safehasattr(op, '_bookmarksbackup'):
+            localrepo.localrepository._bookmarks.set(op.repo,
+                                                     op._bookmarksbackup)
+            del op._bookmarksbackup
+
     wrappedcghandler.params = origcghandler.params
     bundle2.parthandlermapping['changegroup'] = wrappedcghandler