[PATCH 01 of 10 V10] bookmarks: introduce listbinbookmarks()
Augie Fackler
raf at durin42.com
Mon Nov 21 22:08:30 EST 2016
I’ve queued patches 1-3 per Greg’s review and my own secondary quick pass.
Thanks!
> On Nov 20, 2016, at 7:13 AM, Stanislau Hlebik <stash at fb.com> wrote:
>
> # HG changeset patch
> # User Stanislau Hlebik <stash at fb.com>
> # Date 1479373181 28800
> # Thu Nov 17 00:59:41 2016 -0800
> # Node ID a3159f73e59868f8ae0993cc91277142aaa10536
> # Parent 854190becacb8abecddddbf5c18a777b02bbc045
> bookmarks: introduce listbinbookmarks()
>
> `bookmarks` bundle2 part will work with binary nodes. To avoid unnecessary
> conversions between binary and hex nodes let's add `listbinbookmarks()` that
> returns binary nodes. For now this function is a copy-paste of
> listbookmarks(). In the next patch this copy-paste will be removed.
>
> diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py
> --- a/mercurial/bookmarks.py
> +++ b/mercurial/bookmarks.py
> @@ -284,6 +284,17 @@
> lockmod.release(tr, lock)
> return update
>
> +def listbinbookmarks(repo):
> + # We may try to list bookmarks on a repo type that does not
> + # support it (e.g., statichttprepository).
> + marks = getattr(repo, '_bookmarks', {})
> +
> + hasnode = repo.changelog.hasnode
> + for k, v in marks.iteritems():
> + # don't expose local divergent bookmarks
> + if hasnode(v) and ('@' not in k or k.endswith('@')):
> + yield k, v
> +
> def listbookmarks(repo):
> # We may try to list bookmarks on a repo type that does not
> # support it (e.g., statichttprepository).
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20161121/4d941108/attachment.sig>
More information about the Mercurial-devel
mailing list