Patchwork [06,of,15,V2] bookmark: introduce a 'bookmarks' part

mail settings
Submitter Boris Feld
Date Nov. 2, 2017, 1:18 p.m.
Message ID <8c03b055c85e73058e11.1509628683@FB>
Download mbox | patch
Permalink /patch/25335/
State Accepted
Headers show


Boris Feld - Nov. 2, 2017, 1:18 p.m.
# HG changeset patch
# User Boris Feld <>
# Date 1508083331 -7200
#      Sun Oct 15 18:02:11 2017 +0200
# Node ID 8c03b055c85e73058e11df7f802860bd47c7d7df
# Parent  d8b0dccd1281582764e0dfd643f730fa35f38246
# EXP-Topic b2.bookmarks
# Available At
#              hg pull -r 8c03b055c85e
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


diff --git a/mercurial/ b/mercurial/
--- a/mercurial/
+++ b/mercurial/
@@ -1891,6 +1891,21 @@  def handlepushkey(op, inpart):
                 kwargs[key] = inpart.params[key]
         raise error.PushkeyFailed(partid=str(, **kwargs)
+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)
 def handlephases(op, inpart):
     """apply phases from bundle part to repo"""