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

login
register
mail settings
Submitter Stanislau Hlebik
Date Nov. 2, 2016, 2:06 p.m.
Message ID <a56a624a8a42b93ec980.1478095603@dev1918.lla1.facebook.com>
Download mbox | patch
Permalink /patch/17277/
State Superseded
Headers show

Comments

Stanislau Hlebik - Nov. 2, 2016, 2:06 p.m.
# HG changeset patch
# User Stanislau Hlebik <stash@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.

Patch

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