Patchwork Fixed issue 3870

login
register
mail settings
Submitter Eugeny Pozharsky
Date March 27, 2013, 11:16 a.m.
Message ID <CAGwaKEaXm6cGDCh6PXDPg0XZuxdn5eMKiQ0u2GYWT74+9gV_fQ@mail.gmail.com>
Download mbox | patch
Permalink /patch/1200/
State Accepted, archived
Headers show

Comments

Eugeny Pozharsky - March 27, 2013, 11:16 a.m.
# HG changeset patch
# User pozheg <pozheg@gmail.com>
# Date 1364382672 -10800
# Node ID b8fcb5c31f1b6ce8bb3bfa4943d928447d83dcac
# Parent  af9ddea2cb99b6e4314a6e79b793b5fc30ea4f19
opener: 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.
Bryan O'Sullivan - March 27, 2013, 3:38 p.m.
On Wed, Mar 27, 2013 at 4:16 AM, Eugeny Pozharsky <pozheg@gmail.com> wrote:

> opener: clone of git sub-repository creates incorrect git branch
> (issue3870)
>

This looks fine, but please add a test so that we don't accidentally
regress your fix.
Augie Fackler - April 17, 2013, 3:01 a.m.
On Apr 16, 2013, at 10:20 PM, Kevin Bullock <kbullock+mercurial@ringworld.org> wrote:

> Crewed with a test added, thanks.
> 
> (Noticed after I pushed that 'opener:' is the wrong label here, both for this patch and for my test. Hrrrg.)

Good news, crew is draft-phase. I've reputed both patches with the component changed to "subrepo".

Patch

diff -r af9ddea2cb99 -r b8fcb5c31f1b mercurial/subrepo.py
--- a/mercurial/subrepo.py      Thu Feb 28 13:11:42 2013 -0800
+++ b/mercurial/subrepo.py      Wed Mar 27 14:11:12 2013 +0300
@@ -1151,7 +1151,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,