diff hggit/git_handler.py @ 600:e0089655caa6

Fixes #54 | option branch_bookmark_suffix doesn't move bookmarks along Test case based on the one proposed by David Carr at https://bitbucket.org/durin42/hg-git/issue/54/with-option-branch_bookmark_suffix-set
author André Felipe Dias <andref.dias@pronus.eng.br>
date Mon, 01 Jul 2013 16:04:53 -0300 (2013-07-01)
parents d6b9c30a3e0f
children ca86479dd2d9
line wrap: on
line diff
--- a/hggit/git_handler.py
+++ b/hggit/git_handler.py
@@ -1109,6 +1109,7 @@
             heads = dict([(ref[11:],refs[ref]) for ref in refs
                           if ref.startswith('refs/heads/')])
 
+            suffix = self.branch_bookmark_suffix or ''
             for head, sha in heads.iteritems():
                 # refs contains all the refs in the server, not just
                 # the ones we are pulling
@@ -1117,28 +1118,13 @@
                 hgsha = bin(self.map_hg_get(sha))
                 if not head in bms:
                     # new branch
-                    bms[head] = hgsha
+                    bms[head + suffix] = hgsha
                 else:
                     bm = self.repo[bms[head]]
                     if bm.ancestor(self.repo[hgsha]) == bm:
                         # fast forward
-                        bms[head] = hgsha
+                        bms[head + suffix] = hgsha
 
-            # if there's a branch bookmark suffix,
-            # then add it on to all bookmark names
-            # that would otherwise conflict with a branch
-            # name
-            if self.branch_bookmark_suffix:
-                real_branch_names = self.repo.branchmap()
-                bms = dict(
-                    (
-                        bm_name + self.branch_bookmark_suffix
-                            if bm_name in real_branch_names
-                        else bm_name,
-                        bms[bm_name]
-                    )
-                    for bm_name in bms
-                )
             if heads:
                 if oldbm:
                     bookmarks.write(self.repo, bms)