changeset 381:80544310834a

fix handling of spaces in hg tag names
author Dmitry Gladkov <dmitry.gladkov@gmail.com>
date Wed, 23 Mar 2011 01:03:29 +0200
parents d27379c0abde
children f55869b556f0
files hggit/git_handler.py
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hggit/git_handler.py
+++ b/hggit/git_handler.py
@@ -574,8 +574,10 @@
                 labels = lambda c: ctx.tags() + ctx.bookmarks()
             else:
                 labels = lambda c: ctx.tags()
-            heads = [t for t in labels(ctx) if t in self.local_heads()]
-            tags = [t for t in labels(ctx) if t in self.tags]
+            prep = lambda itr: [i.replace(' ', '_') for i in itr]
+
+            heads = [t for t in prep(labels(ctx)) if t in self.local_heads()]
+            tags = [t for t in prep(labels(ctx)) if t in self.tags]
 
             if not (heads or tags):
                 raise hgutil.Abort("revision %s cannot be pushed since"
@@ -676,6 +678,7 @@
     def export_hg_tags(self):
         for tag, sha in self.repo.tags().iteritems():
             if self.repo.tagtype(tag) in ('global', 'git'):
+                tag = tag.replace(' ', '_')
                 self.git.refs['refs/tags/' + tag] = self.map_git_get(hex(sha))
                 self.tags[tag] = hex(sha)