Submitter | Stanislau Hlebik |
---|---|
Date | Sept. 4, 2016, 10:46 p.m. |
Message ID | <70a86f2bd0e7684eda82.1473029215@dev1918.lla1.facebook.com> |
Download | mbox | patch |
Permalink | /patch/16542/ |
State | Accepted |
Headers | show |
Comments
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 70a86f2bd0e7684eda82310dc9024b346f59dbf6 > # Parent f3bc1662dbce19de1f51c4da519238dbe98c1c95 > bundle2: add `bookmarks` part handler > > diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py > --- a/mercurial/bundle2.py > +++ b/mercurial/bundle2.py > @@ -156,6 +156,7 @@ > from .i18n import _ > from . import ( > changegroup, > + encoding, > error, > obsolete, > pushkey, > @@ -1613,3 +1614,12 @@ > > cache.write() > op.ui.debug('applied %i hgtags fnodes cache entries\n' % count) > + > +@parthandler('bookmarks') > +def handlebookmarks(op, inpart): > + dec = encoding.tolocal > + bookmarks = {} > + for bookmarknode in inpart.read().splitlines(): > + book, node = bookmarknode.rsplit(' ', 1) > + bookmarks[dec(book)] = dec(node) The bookmark are encoded on the other side, should we decode them here or is it handled somewhere else. > + op.records.add('bookmarks', bookmarks) Now that we have a specific part for bookmark we might be able to do something more in the part handler itself (keeping the record seems useful for the purpose of communication with other bits) Cheers,
Patch
diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py --- a/mercurial/bundle2.py +++ b/mercurial/bundle2.py @@ -156,6 +156,7 @@ from .i18n import _ from . import ( changegroup, + encoding, error, obsolete, pushkey, @@ -1613,3 +1614,12 @@ cache.write() op.ui.debug('applied %i hgtags fnodes cache entries\n' % count) + +@parthandler('bookmarks') +def handlebookmarks(op, inpart): + dec = encoding.tolocal + bookmarks = {} + for bookmarknode in inpart.read().splitlines(): + book, node = bookmarknode.rsplit(' ', 1) + bookmarks[dec(book)] = dec(node) + op.records.add('bookmarks', bookmarks)