Patchwork [1,of,7,V4] exchange: add `_get_bookmarks()` function

login
register
mail settings
Submitter Stanislau Hlebik
Date Sept. 4, 2016, 10:46 p.m.
Message ID <6e9d1438a270ba02cd06.1473029213@dev1918.lla1.facebook.com>
Download mbox | patch
Permalink /patch/16541/
State Accepted
Headers show

Comments

Stanislau Hlebik - Sept. 4, 2016, 10:46 p.m.
# HG changeset patch
# User Stanislau Hlebik <stash@fb.com>
# Date 1473012054 25200
#      Sun Sep 04 11:00:54 2016 -0700
# Node ID 6e9d1438a270ba02cd06590efd959039b0fae566
# Parent  f148bfa40489269be2e48046734f81065129847a
exchange: add `_get_bookmarks()` 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. 6, 2016, 12:52 p.m.
On 09/05/2016 12:46 AM, Stanislau Hlebik wrote:
> # HG changeset patch
> # User Stanislau Hlebik <stash@fb.com>
> # Date 1473012054 25200
> #      Sun Sep 04 11:00:54 2016 -0700
> # Node ID 6e9d1438a270ba02cd06590efd959039b0fae566
> # Parent  f148bfa40489269be2e48046734f81065129847a
> exchange: add `_get_bookmarks()` 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.

we don't use '_' in name 
https://www.mercurial-scm.org/wiki/CodingStyle#Naming_conventions

Should this kwargs, be **kwargs instead?

>
> 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 _get_bookmarks(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 _get_bookmarks(repo, kwargs):
+    return repo.listkeys(namespace='bookmarks')
+
 def check_heads(repo, their_heads, context):
     """check if the heads of a repo have been modified