subrepo: clone of git sub-repository creates incorrect git branch (issue3870)
authorpozheg <pozheg@gmail.com>
Tue, 16 Apr 2013 22:00:05 -0500
changeset 19012 811e253226c3
parent 19011 12acbea17625
child 19013 2b34d004e644
subrepo: clone of git sub-repository creates incorrect git branch (issue3870) Mercurial handles git subrepos by incorrect way. If the mercurial repo has a git sub-repo and somebody started a new branch in the subrepo and push it into git, the next one who will clone the whole repo will get incorrect branch name in the git subrepo.
mercurial/subrepo.py
--- a/mercurial/subrepo.py	Tue Apr 16 14:39:37 2013 -0700
+++ b/mercurial/subrepo.py	Tue Apr 16 22:00:05 2013 -0500
@@ -1266,7 +1266,7 @@
 
         if remote not in tracking:
             # create a new local tracking branch
-            local = remote.split('/', 2)[2]
+            local = remote.split('/', 3)[3]
             checkout(['-b', local, remote])
         elif self._gitisancestor(branch2rev[tracking[remote]], remote):
             # When updating to a tracked remote branch,