[PATCH 6 of 7] subrepo: work around old git's remote naming scheme

Eric Eisner ede at MIT.EDU
Mon Dec 6 20:37:10 CST 2010


# HG changeset patch
# User Eric Eisner <ede at mit.edu>
# Date 1291688247 18000
# Node ID 6e74b912fa5ceeefa76d0a51a9d05d8038425583
# Parent  49c7e875482dc5fb1cea6c9e2fdb3180588a972f
subrepo: work around old git's remote naming scheme

Older git versions use 'origin/master'
Current git uses 'remotes/origin/master'

diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py
--- a/mercurial/subrepo.py
+++ b/mercurial/subrepo.py
@@ -682,8 +682,11 @@ class gitsubrepo(object):
             if line[2:].startswith('(no branch)'):
                 continue
             branch, revision = line[2:].split()[:2]
-            if revision == '->':
+            if revision == '->' or branch.endswith('/HEAD'):
                 continue # ignore remote/HEAD redirects
+            if '/' in branch and not branch.startswith('remotes/'):
+                # old git compatability
+                branch = 'remotes/' + branch
             if line[0] == '*':
                 current = branch
             branch2rev[branch] = revision


More information about the Mercurial-devel mailing list