clone: make sure to use "@" as bookmark and "default" as branch (issue3677) stable
authorThomas Arendsen Hein <thomas@intevation.de>
Fri, 26 Oct 2012 12:36:15 +0200
branchstable
changeset 17867 c9339efed653
parent 17866 75b43843eb4d
child 17868 04755508f8ed
clone: make sure to use "@" as bookmark and "default" as branch (issue3677) Before this change a bookmark named "default" or a branch named "@" would cause the wrong changeset to be checked out. The change in output of test-hardlinks.t is due to the fact that no unneeded tag lookups for the tags "@" or "default" happen, therefore the cache file is not created.
mercurial/hg.py
tests/test-hardlinks.t
--- a/mercurial/hg.py	Fri Oct 26 09:29:50 2012 +0200
+++ b/mercurial/hg.py	Fri Oct 26 12:36:15 2012 +0200
@@ -409,14 +409,20 @@
             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)
--- a/tests/test-hardlinks.t	Fri Oct 26 09:29:50 2012 +0200
+++ b/tests/test-hardlinks.t	Fri Oct 26 12:36:15 2012 +0200
@@ -197,7 +197,6 @@
   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 @@
   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