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

login
register
mail settings
Submitter Stanislau Hlebik
Date Sept. 16, 2016, 11:10 a.m.
Message ID <b25504471680d6d14f30.1474024229@dev1918.lla1.facebook.com>
Download mbox | patch
Permalink /patch/16641/
State Accepted
Headers show

Comments

Stanislau Hlebik - Sept. 16, 2016, 11:10 a.m.
# HG changeset patch
# User Stanislau Hlebik <stash@fb.com>
# Date 1473172001 25200
#      Tue Sep 06 07:26:41 2016 -0700
# Node ID b25504471680d6d14f3096997760bc3acd76089d
# Parent  f148bfa40489269be2e48046734f81065129847a
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.
Pierre-Yves David - Sept. 16, 2016, 3:53 p.m.
On 09/16/2016 01:10 PM, Stanislau Hlebik wrote:
> # HG changeset patch
> # User Stanislau Hlebik <stash@fb.com>
> # Date 1473172001 25200
> #      Tue Sep 06 07:26:41 2016 -0700
> # Node ID b25504471680d6d14f3096997760bc3acd76089d
> # Parent  f148bfa40489269be2e48046734f81065129847a
> 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.

A good share of this description could be moved as the missing docstring 
for this method :-)

>
> diff --git a/mercurial/exchange.py b/mercurial/exchange.py
> --- a/mercurial/exchange.py
> +++ b/mercurial/exchange.py
> @@ -1671,6 +1671,9 @@
>      if chunks:
>          bundler.newpart('hgtagsfnodes', data=''.join(chunks))
>
> +def _getbookmarks(repo, **kwargs):
> +    return repo.listkeys(namespace='bookmarks')
> +
>  def check_heads(repo, their_heads, context):
>      """check if the heads of a repo have been modified
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>

Patch

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -1671,6 +1671,9 @@ 
     if chunks:
         bundler.newpart('hgtagsfnodes', data=''.join(chunks))
 
+def _getbookmarks(repo, **kwargs):
+    return repo.listkeys(namespace='bookmarks')
+
 def check_heads(repo, their_heads, context):
     """check if the heads of a repo have been modified