[PATCH 1 of 8 V7] exchange: add `_getbookmarks()` function

Stanislau Hlebik stash at fb.com
Wed Nov 2 14:06:43 UTC 2016


# HG changeset patch
# User Stanislau Hlebik <stash at fb.com>
# Date 1478016027 25200
#      Tue Nov 01 09:00:27 2016 -0700
# Branch stable
# Node ID a56a624a8a42b93ec980d2c284756a38719dffe6
# Parent  b9f7b0c10027764cee77f9c6d61877fcffea837f
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 list of bookmarks.
+
+    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 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