I am trying to migrate a mercurial repo to git while using hg-git. I follow the tutorial here and I stumbled on an issue in the migration step when I push to the git repo. Some branches (who where converted to bookmarks) aren't migrated because they have spaces in their names.
So my solution to that is just to create bookmarks without spaces, I do it with this command (from git bash in win10 x64):
$ hg branches -T {branch}\\n | sed -e 's/.*/"&"/g;p;s/ /_/g;s/"//g' | xargs -d \\n -L 2 sh -c 'hg bookmark -r $0 $1_migrate'
But this fails with the following error:
hg: parse error at 1: unterminated string
("BTSR
^ here)
xargs: sh: exited with status 255; aborting
However, if I replace the bookmark command with echo, the output seems ok:
$ hg branches -T {branch}\\n | sed -e 's/.*/"&"/g;p;s/ /_/g;s/"//g' | xargs -d \\n -L 2 sh -c 'echo $0 $1_migrate'
"BTSR UF2" BTSR_UF2_migrate
So I don't understand what I'm doing wrong here. I must be doing something wrong with xargs I presume, but what?
Thanks in advance
Instead of stumbling with the spaces problem, I tried to find an alternative solution. Instead of bookmarking a branch by name, I bookmark it now by rev which circumvents the spaces problem:
If anyone knows the solution to the spaces problem, I would really like to know it. But I can live happily with this workaround.