# gexport fails on bookmarks with spaces in them (RefFormatError)

Issue #163 new
Zoltán Lehóczky
created an issue

If a bookmark in the hg repo contains a space gexport will fail. E.g. the bookmark "hg/Orchard1.9.1" will be handled fine (and appear as a git branch), the bookmark "hg/Orchard 1.9.1" will fail with the below exception.

```** Unknown exception encountered with possibly-broken third-party extension hggit
** which supports versions 3.4 of Mercurial.
** If that fixes the bug please report it to https://bitbucket.org/durin42/hg-git/issues
** Python 2.7.9 (default, Dec 10 2014, 12:28:03) [MSC v.1500 64 bit (AMD64)]
** Mercurial Distributed SCM (version 3.5+5)
** Extensions loaded: rebase, strip, mq, hggit, eol
Traceback (most recent call last):
File "hg", line 49, in <module>
File "mercurial\dispatch.pyo", line 30, in run
File "mercurial\dispatch.pyo", line 92, in dispatch
File "mercurial\dispatch.pyo", line 163, in _runcatch
File "mercurial\dispatch.pyo", line 895, in _dispatch
File "mercurial\dispatch.pyo", line 656, in runcommand
File "mercurial\dispatch.pyo", line 1013, in _runcommand
File "mercurial\dispatch.pyo", line 982, in checkargs
File "mercurial\dispatch.pyo", line 892, in <lambda>
File "mercurial\util.pyo", line 792, in check
File "mercurial\extensions.pyo", line 171, in closure
File "mercurial\util.pyo", line 792, in check
File "hgext\mq.pyo", line 3515, in mqcommand
File "mercurial\util.pyo", line 792, in check
File "hggit\__init__.pyo", line 182, in gexport
File "hggit\git_handler.pyo", line 294, in export_commits
File "hggit\git_handler.pyo", line 1187, in update_references
File "dulwich\refs.pyo", line 261, in __setitem__
File "dulwich\refs.pyo", line 565, in set_if_equals
File "dulwich\refs.pyo", line 174, in _check_refname
```

This is possibly the same bug as this, but not sure: https://bitbucket.org/durin42/hg-git/issues/116/exception-pushing-to-git-repository

I realize this is more of a dulwich issue but not entirely sure about it, so posting it here.

Not only space but russian symbols also

```hg push ..\hggit-test-git
pushing to ..\hggit-test-git
** unknown exception encountered, please report by visiting
** http://mercurial.selenic.com/wiki/BugTracker
** Python 2.7.6 (default, Nov 10 2013, 19:24:24) [MSC v.1500 64 bit (AMD64)]
** Mercurial Distributed SCM (version 3.3)
** Extensions loaded: hgsubversion, eol, strip, mq, hggit
Traceback (most recent call last):
File "hg", line 42, in <module>
File "mercurial\dispatch.pyo", line 28, in run
File "mercurial\dispatch.pyo", line 71, in dispatch
File "mercurial\dispatch.pyo", line 140, in _runcatch
File "mercurial\dispatch.pyo", line 860, in _dispatch
File "mercurial\dispatch.pyo", line 621, in runcommand
File "mercurial\dispatch.pyo", line 951, in _runcommand
File "mercurial\dispatch.pyo", line 922, in checkargs
File "mercurial\dispatch.pyo", line 857, in <lambda>
File "mercurial\util.pyo", line 711, in check
File "mercurial\extensions.pyo", line 149, in wrap
File "mercurial\util.pyo", line 711, in check
File "hgext\mq.pyo", line 3483, in mqcommand
File "mercurial\util.pyo", line 711, in check
File "mercurial\extensions.pyo", line 149, in wrap
File "mercurial\util.pyo", line 711, in check
File "hgsubversion\wrappers.pyo", line 693, in generic
File "mercurial\util.pyo", line 711, in check
File "mercurial\commands.pyo", line 5115, in push
File "mercurial\extensions.pyo", line 194, in wrap
File "hgsubversion\wrappers.pyo", line 380, in exchangepush
File "mercurial\extensions.pyo", line 194, in wrap
File "hggit\util.pyo", line 42, in inner
File "hggit\__init__.pyo", line 258, in exchangepush
File "hggit\git_handler.pyo", line 309, in push
File "hggit\git_handler.pyo", line 277, in export_commits
File "hggit\git_handler.pyo", line 1134, in update_references
File "dulwich\refs.pyo", line 258, in __setitem__
File "dulwich\refs.pyo", line 560, in set_if_equals
File "dulwich\refs.pyo", line 171, in _check_refname
```dulwich.errors.RefFormatError: refs/heads/onespace bookmark