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

Boris FELD boris.feld at octobus.net
Tue Jul 31 06:10:22 EDT 2018


On 30/07/2018 18:46, Martin von Zweigbergk via Mercurial-devel wrote:
> I'll queue with the following folded in:

Perfect, thanks
>
> 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 
> <mailto:boris.feld at octobus.net>> wrote:
>
>     # HG changeset patch
>     # User Boris Feld <boris.feld at octobus.net
>     <mailto: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:
>
>
>
> _______________________________________________
> 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/20180731/071c7210/attachment.html>


More information about the Mercurial-devel mailing list