Mercurial > hg
comparison mercurial/hg.py @ 38753:e06a10d3b926 stable
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.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Mon, 30 Jul 2018 15:36:04 +0200 |
parents | 63e6f5ae84bc |
children | d58958676b3c |
comparison
equal
deleted
inserted
replaced
38752:8623a6c96998 | 38753:e06a10d3b926 |
---|---|
729 }).result() | 729 }).result() |
730 | 730 |
731 uprev = None | 731 uprev = None |
732 status = None | 732 status = None |
733 if checkout is not None: | 733 if checkout is not None: |
734 if checkout in destrepo: | 734 # Some extensions (at least hg-git and hg-subversion) have |
735 # a peer.lookup() implementation that returns a name instead | |
736 # of a nodeid. We work around it here until we've figured | |
737 # out a better solution. | |
738 if len(checkout) == 20 and checkout in destrepo: | |
735 uprev = checkout | 739 uprev = checkout |
740 elif scmutil.isrevsymbol(destrepo, checkout): | |
741 uprev = scmutil.revsymbol(destrepo, checkout).node() | |
736 else: | 742 else: |
737 if update is not True: | 743 if update is not True: |
738 try: | 744 try: |
739 uprev = destrepo.lookup(update) | 745 uprev = destrepo.lookup(update) |
740 except error.RepoLookupError: | 746 except error.RepoLookupError: |