bookmark: introduce a 'bookmarks' part
authorBoris Feld <boris.feld@octobus.net>
Sun, 15 Oct 2017 18:02:11 +0200
changeset 35269 af5507203d01
parent 35268 ad5f2b923b0d
child 35270 f392066d127c
bookmark: introduce a 'bookmarks' part This part can carry and apply bookmarks information. We start with adding the core behavior of the part. In its current form, the part is only suitable for push since it plain update the bookmark without consideration for the local state. Support of the behavior needed for pulling will be added in later changesets.
mercurial/bundle2.py
--- a/mercurial/bundle2.py	Mon Nov 13 04:22:45 2017 +0100
+++ b/mercurial/bundle2.py	Sun Oct 15 18:02:11 2017 +0200
@@ -1976,6 +1976,21 @@
                 kwargs[key] = inpart.params[key]
         raise error.PushkeyFailed(partid=str(inpart.id), **kwargs)
 
+@parthandler('bookmarks')
+def handlebookmark(op, inpart):
+    """transmit bookmark information
+
+    The part contains binary encoded bookmark information. The bookmark
+    information is applied as is to the unbundling repository. Make sure a
+    'check:bookmarks' part is issued earlier to check for race condition in
+    such update.
+
+    This behavior is suitable for pushing. Semantic adjustment will be needed
+    for pull.
+    """
+    changes = bookmarks.binarydecode(inpart)
+    op.repo._bookmarks.applychanges(op.repo, op.gettransaction(), changes)
+
 @parthandler('phase-heads')
 def handlephases(op, inpart):
     """apply phases from bundle part to repo"""