Submitter | Stanislau Hlebik |
---|---|
Date | Nov. 20, 2016, 12:13 p.m. |
Message ID | <a3159f73e59868f8ae09.1479644034@dev1918.lla1.facebook.com> |
Download | mbox | patch |
Permalink | /patch/17641/ |
State | Accepted |
Headers | show |
Comments
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@fb.com> wrote: > > # HG changeset patch > # User Stanislau Hlebik <stash@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@mercurial-scm.org > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Patch
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).