[PATCH 01 of 15] pull: store binary node in pullop.remotebookmarks

Gregory Szorc gregory.szorc at gmail.com
Wed Oct 18 12:59:57 EDT 2017


On Wed, Oct 18, 2017 at 6:09 PM, Boris Feld <boris.feld at octobus.net> wrote:

> # HG changeset patch
> # User Boris Feld <boris.feld at octobus.net>
> # Date 1508230905 -7200
> #      Tue Oct 17 11:01:45 2017 +0200
> # Node ID a450dc69ef95073af4d4ece34e251ed0bb5b808f
> # Parent  537de0b14030868e3e850ae388b08f88cabc88e8
> # EXP-Topic b2.bookmarks
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r
> a450dc69ef95
> pull: store binary node in pullop.remotebookmarks
>
> The internal representation of bookmark value is binary. The fact we stored
> 'hex' was an implementation detail from using pushkey.
>
> We move the values in 'pullop.remotebookmarks' to binary before adding a
> way to
> exchange bookmarks not based on pushkey.
>

Queued part 1 (with "API" added to the commit message).


>
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -3911,12 +3911,13 @@
>              # not ending up with the name of the bookmark because of a
> race
>              # condition on the server. (See issue 4689 for details)
>              remotebookmarks = other.listkeys('bookmarks')
> +            remotebookmarks = bookmarks.unhexlifybookmarks(
> remotebookmarks)
>              pullopargs['remotebookmarks'] = remotebookmarks
>              for b in opts['bookmark']:
>                  b = repo._bookmarks.expandname(b)
>                  if b not in remotebookmarks:
>                      raise error.Abort(_('remote bookmark %s not found!')
> % b)
> -                revs.append(remotebookmarks[b])
> +                revs.append(hex(remotebookmarks[b]))
>
>          if revs:
>              try:
> diff --git a/mercurial/exchange.py b/mercurial/exchange.py
> --- a/mercurial/exchange.py
> +++ b/mercurial/exchange.py
> @@ -1348,7 +1348,8 @@
>          # all known bundle2 servers now support listkeys, but lets be
> nice with
>          # new implementation.
>          return
> -    pullop.remotebookmarks = pullop.remote.listkeys('bookmarks')
> +    books = pullop.remote.listkeys('bookmarks')
> +    pullop.remotebookmarks = bookmod.unhexlifybookmarks(books)
>
>
>  @pulldiscovery('changegroup')
> @@ -1459,7 +1460,7 @@
>      # processing bookmark update
>      for namespace, value in op.records['listkeys']:
>          if namespace == 'bookmarks':
> -            pullop.remotebookmarks = value
> +            pullop.remotebookmarks = bookmod.unhexlifybookmarks(value)
>
>      # bookmark data were either already there or pulled in the bundle
>      if pullop.remotebookmarks is not None:
> @@ -1552,7 +1553,6 @@
>      pullop.stepsdone.add('bookmarks')
>      repo = pullop.repo
>      remotebookmarks = pullop.remotebookmarks
> -    remotebookmarks = bookmod.unhexlifybookmarks(remotebookmarks)
>      bookmod.updatefromremote(repo.ui, repo, remotebookmarks,
>                               pullop.remote.url(),
>                               pullop.gettransaction,
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20171018/a96efda3/attachment.html>


More information about the Mercurial-devel mailing list