# HG changeset patch
# User vpenne <vpenne@wyplay.com>
# Date 1242854883 0
#      Wed May 20 21:28:03 2009 +0000
# Node ID 33da6875a5349ed2138ca1b01b2d8af4fd676bae
# Parent  2fa3ac77598394bdabf4fa01ab58646c25911f7a
preserve branch name of the form xxx/yyy when converting them into hg bookmarks

diff --git a/dulwich/repo.py b/dulwich/repo.py
--- a/dulwich/repo.py
+++ b/dulwich/repo.py
@@ -289,9 +289,12 @@
 
     def remote_refs(self, remote_name):
         ret = {}
-        for root, dirs, files in os.walk(os.path.join(self.controldir(), 'refs', 'remotes', remote_name)):
+        r = os.path.join(self.controldir(), 'refs', 'remotes', remote_name)
+        for root, dirs, files in os.walk(r):
             for name in files:
-                ret[name] = self._get_ref(os.path.join(root, name))
+                if root != r:
+                    name = root[len(r) + 1:] + "/" + name
+                ret[name] = self._get_ref(os.path.join(r, name))
         return ret
 
     def head(self):