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

Stanislau Hlebik stash at fb.com
Sat Nov 12 15:19:53 EST 2016


# HG changeset patch
# User Stanislau Hlebik <stash at fb.com>
# Date 1478980606 28800
#      Sat Nov 12 11:56:46 2016 -0800
# Branch stable
# Node ID cf754de559217f5965d1101c4591689d9924bddc
# Parent  13b3e16c68d303a523550980d7739bb676420851
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.listbookmarks(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