changeset 30483:8491845a75b2

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.
author Stanislau Hlebik <stash@fb.com>
date Thu, 17 Nov 2016 00:59:41 -0800
parents 55ec13c82ea0
children d1b97fc87f55
files mercurial/exchange.py
diffstat 1 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/exchange.py	Thu Nov 17 00:59:41 2016 -0800
+++ b/mercurial/exchange.py	Thu Nov 17 00:59:41 2016 -0800
@@ -1661,6 +1661,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