[PATCH 03 of 10 V10] exchange: add `_getbookmarks()` function

Stanislau Hlebik stash at fb.com
Sun Nov 20 07:13:56 EST 2016


# HG changeset patch
# User Stanislau Hlebik <stash at fb.com>
# Date 1479373181 28800
#      Thu Nov 17 00:59:41 2016 -0800
# Node ID 4e782ccf84f8fee96963f09439f7da7202c37775
# Parent  54b24eb2eac7c181f9fd15423fd05218a6a11186
exchange: add `_getbookmarks()` function

This function will be used to generate bookmarks bundle2 part.
It is a separate function in order to make it easy to overwrite it
in extensions. Passing `kwargs` to the function makes it easy to
add new parameters in extensions.

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -1666,6 +1666,17 @@
     if chunks:
         bundler.newpart('hgtagsfnodes', data=''.join(chunks))
 
+def _getbookmarks(repo, **kwargs):
+    """Returns bookmark to node mapping.
+
+    This function is primarily used to generate `bookmarks` bundle2 part.
+    It is a separate function in order to make it easy to wrap it
+    in extensions. Passing `kwargs` to the function makes it easy to
+    add new parameters in extensions.
+    """
+
+    return dict(bookmod.listbinbookmarks(repo))
+
 def check_heads(repo, their_heads, context):
     """check if the heads of a repo have been modified
 


More information about the Mercurial-devel mailing list