[PATCH 3 of 7 V4] bundle2: add `bookmarks` part handler

Stanislau Hlebik stash at fb.com
Sun Sep 4 18:46:55 EDT 2016


# HG changeset patch
# User Stanislau Hlebik <stash at fb.com>
# Date 1473012054 25200
#      Sun Sep 04 11:00:54 2016 -0700
# Node ID 70a86f2bd0e7684eda82310dc9024b346f59dbf6
# Parent  f3bc1662dbce19de1f51c4da519238dbe98c1c95
bundle2: add `bookmarks` part handler

diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -156,6 +156,7 @@
 from .i18n import _
 from . import (
     changegroup,
+    encoding,
     error,
     obsolete,
     pushkey,
@@ -1613,3 +1614,12 @@
 
     cache.write()
     op.ui.debug('applied %i hgtags fnodes cache entries\n' % count)
+
+ at parthandler('bookmarks')
+def handlebookmarks(op, inpart):
+    dec = encoding.tolocal
+    bookmarks = {}
+    for bookmarknode in inpart.read().splitlines():
+        book, node = bookmarknode.rsplit(' ', 1)
+        bookmarks[dec(book)] = dec(node)
+    op.records.add('bookmarks', bookmarks)


More information about the Mercurial-devel mailing list