diff mercurial/hg.py @ 26103:30be3aeb5344

clone: fix updaterev to update to latest branch changeset (issue4528) Before this patch if clone --updaterev points to branch which head on src repo wasnt in dest repo, clone updated dest repo to default branch. After applying this patch, if changeset from src repo pointing at given branch is not in dest repo, it searches for changeset pointing for given branch locally in dest repo. Lookup in destination repo: 559: uprev = destrepo.lookup(update) is wrapped by try/except block to preserve current behaviour when given revset to -u is not found - it will not fail,but silently update dest repo to head of default branch.
author liscju <piotr.listkiewicz@gmail.com>
date Sun, 30 Aug 2015 11:47:43 +0200
parents 5243890224ff
children ae33fff17c1e
line wrap: on
line diff
--- a/mercurial/hg.py	Thu Aug 20 17:19:32 2015 +0200
+++ b/mercurial/hg.py	Sun Aug 30 11:47:43 2015 +0200
@@ -582,7 +582,10 @@
                     try:
                         uprev = destrepo.lookup(checkout)
                     except error.RepoLookupError:
-                        pass
+                        try:
+                            uprev = destrepo.lookup(update)
+                        except error.RepoLookupError:
+                            pass
                 if uprev is None:
                     try:
                         uprev = destrepo._bookmarks['@']