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

mail settings
Submitter Boris Feld
Date July 30, 2018, 2:41 p.m.
Message ID <85b015944582ad639278.1532961670@FB-lair>
Download mbox | patch
Permalink /patch/32972/
State New
Headers show


Boris Feld - July 30, 2018, 2:41 p.m.
# HG changeset patch
# User Boris Feld <>
# Date 1532957764 -7200
#      Mon Jul 30 15:36:04 2018 +0200
# Branch stable
# Node ID 85b015944582ad63927849e253ca7077924b0ec9
# Parent  ae17555ef93fc95d800b46ccab865ea93f9951ca
# EXP-Topic compat-hggit
# Available At
#              hg pull -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

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

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/ b/mercurial/
--- a/mercurial/
+++ b/mercurial/
@@ -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()
                         if update is not True: