diff --git a/mercurial/hg.py b/mercurial/hg.py --- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -409,14 +409,20 @@ def clone(ui, peeropts, source, dest=Non if update: if update is not True: checkout = srcpeer.lookup(update) - for test in (checkout, '@', 'default', 'tip'): - if test is None: - continue + uprev = None + if checkout is not None: try: - uprev = destrepo.lookup(test) - break + uprev = destrepo.lookup(checkout) except error.RepoLookupError: - continue + pass + if uprev is None: + try: + uprev = destrepo._bookmarks['@'] + except KeyError: + try: + uprev = destrepo.branchtip('default') + except error.RepoLookupError: + uprev = destrepo.lookup('tip') bn = destrepo[uprev].branch() destrepo.ui.status(_("updating to branch %s\n") % bn) _update(destrepo, uprev) diff --git a/tests/test-hardlinks.t b/tests/test-hardlinks.t --- a/tests/test-hardlinks.t +++ b/tests/test-hardlinks.t @@ -197,7 +197,6 @@ r4 has hardlinks in the working dir (not 2 r4/.hg/00changelog.i 2 r4/.hg/branch 2 r4/.hg/cache/branchheads - 2 r4/.hg/cache/tags 2 r4/.hg/dirstate 2 r4/.hg/hgrc 2 r4/.hg/last-message.txt @@ -228,7 +227,6 @@ Update back to revision 11 in r4 should 2 r4/.hg/00changelog.i 1 r4/.hg/branch 2 r4/.hg/cache/branchheads - 2 r4/.hg/cache/tags 1 r4/.hg/dirstate 2 r4/.hg/hgrc 2 r4/.hg/last-message.txt