[PATCH STABLE follow-up] clone: process 'lookup' return as an arbitrary symbol

Martin von Zweigbergk martinvonz at google.com
Mon Jul 30 12:46:10 EDT 2018


I'll queue with the following folded in:

diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -731,6 +731,10 @@ def clone(ui, peeropts, source, dest=Non
                 uprev = None
                 status = None
                 if checkout is not None:
+                    # Some extensions (at least hg-git and hg-subversion)
have
+                    # a peer.lookup() implementation that returns a name
instead
+                    # of a nodeid. We work around it here until we've
figured
+                    # out a better solution.
                     if len(checkout) == 20 and checkout in destrepo:
                         uprev = checkout
                     elif scmutil.isrevsymbol(destrepo, checkout):


On Mon, Jul 30, 2018 at 7:41 AM Boris Feld <boris.feld at octobus.net> wrote:

> # HG changeset patch
> # User Boris Feld <boris.feld at octobus.net>
> # Date 1532957764 -7200
> #      Mon Jul 30 15:36:04 2018 +0200
> # Branch stable
> # Node ID 85b015944582ad63927849e253ca7077924b0ec9
> # Parent  ae17555ef93fc95d800b46ccab865ea93f9951ca
> # EXP-Topic compat-hggit
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r
> 85b015944582
> clone: process 'lookup' return as an arbitrary symbol
>
> In theory, checkout is expected to be a node here because it was returned
> by
> peer.lookup.
>
> In practice, multiple important extensions (like hg-git, hg-subversion) use
> peers not backed by a mercurial repository where lookup cannot return a
> node.
>
> Allowing arbitrary symbols is necessary to make these extensions working
> with
> 4.7.
>
> We should probably introduce a new API in Core to have these extensions to
> work without abusing the lookup API. In the meantime, a small change to
> restore compatibility in 4.7 seems in order.
>
> diff --git a/mercurial/hg.py b/mercurial/hg.py
> --- a/mercurial/hg.py
> +++ b/mercurial/hg.py
> @@ -731,8 +731,10 @@ def clone(ui, peeropts, source, dest=Non
>                  uprev = None
>                  status = None
>                  if checkout is not None:
> -                    if checkout in destrepo:
> +                    if len(checkout) == 20 and checkout in destrepo:
>                          uprev = checkout
> +                    elif scmutil.isrevsymbol(destrepo, checkout):
> +                        uprev = scmutil.revsymbol(destrepo,
> checkout).node()
>                      else:
>                          if update is not True:
>                              try:
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20180730/2f194382/attachment.html>


More information about the Mercurial-devel mailing list