bookmarks: fix formatting of exchange message (issue4439)

The message formatting was crashing when doing explicit pulling `hg pull -B X`.
This changeset fix it and improved the test coverage.

--HG--
branch : stable