clone: check update rev for being True
authorSean Farley <sean@farley.io>
Thu, 24 Sep 2015 15:52:11 -0700
changeset 26354 c1fb2cab6260
parent 26353 7c20d501709b
child 26355 f51713b8c6fa
clone: check update rev for being True In 30be3aeb5344, there was an attempt to fallback to looking up the update revision assuming it was always a rev but the documentation states: True means update to default rev, anything else is treated as a revision Therefore, we should only fallback to looking up the update rev if it is not True. This bug was found in hg-git and I couldn't think of a test that does this in pure Mercurial since the source repository is checked for the revision as well (and therefore gracefully falls back).
mercurial/hg.py
--- a/mercurial/hg.py	Thu Sep 24 15:47:23 2015 -0700
+++ b/mercurial/hg.py	Thu Sep 24 15:52:11 2015 -0700
@@ -582,10 +582,11 @@
                     try:
                         uprev = destrepo.lookup(checkout)
                     except error.RepoLookupError:
-                        try:
-                            uprev = destrepo.lookup(update)
-                        except error.RepoLookupError:
-                            pass
+                        if update is not True:
+                            try:
+                                uprev = destrepo.lookup(update)
+                            except error.RepoLookupError:
+                                pass
                 if uprev is None:
                     try:
                         uprev = destrepo._bookmarks['@']