如何在 git svn 的作者文件中包含尾随空格字符
我的 svn 仓库中的作者如下:
$ svn 日志 --xml | grep 作者 |排序 -u | perl -pe 's/.>(.?)<./$1 = /'
输出:
<author>ashfame</author>
<author>clean</author>
<author>clean </author>
<author>rocketweb</author>
但是在使用 git svn clone 克隆存储库以进行导入时,它会在说 之间停止作者:clean 未在 /home/ashfame/fun/authors-transform.txt 文件中定义
请注意 clean 后面的双空格,这意味着它是第三个用户“clean”
。
如何格式化我的作者文件以在用户名中包含空格?我当前的内容如下:
ashfame = Ashfame <[email protected]>
clean = Yogesh Tiwari <[email protected]>
clean = Yogesh Tiwari <[email protected]>
"clean\ " = Yogesh Tiwari <[email protected]>
"clean " = Yogesh Tiwari <[email protected]>
rocketweb = rocketweb <[email protected]>
(no author) = Yogesh Tiwari <[email protected]>
(no author) = no_author
有趣的发现:我尝试将 svn 存储库导入到 git 中,而无需任何用户映射我看不到任何与“clean”用户相关的内容,只有“clean”存在,所以我猜测这是 svn repo 上的一些问题。关于可以采取什么措施的任何指示?
Authors in my svn repo are as follows:
$ svn log --xml | grep author | sort -u | perl -pe 's/.>(.?)<./$1 = /'
Output:
<author>ashfame</author>
<author>clean</author>
<author>clean </author>
<author>rocketweb</author>
But while cloning the repo for import using git svn clone
, it halts in between saying Author: clean not defined in /home/ashfame/fun/authors-transform.txt file
Notice the double space after clean, which means its the 3rd user "clean "
.
How do I format my authors file to have a space in username? My current contents are as follows:
ashfame = Ashfame <[email protected]>
clean = Yogesh Tiwari <[email protected]>
clean = Yogesh Tiwari <[email protected]>
"clean\ " = Yogesh Tiwari <[email protected]>
"clean " = Yogesh Tiwari <[email protected]>
rocketweb = rocketweb <[email protected]>
(no author) = Yogesh Tiwari <[email protected]>
(no author) = no_author
Interesting discovery: I tried importing the svn repo into git without any user mapping and I couldn't see anything related to "clean " user, only "clean" exists, so I am guessing this is some hiccup on svn repo. Any pointers on what can be done about it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
作者名中的空格也有类似的问题。
使用author-prog选项解决这个问题,该选项允许您使用bash脚本,这将转换未知的作者。
Had the similar problem with space in authorname.
Solve it using author-prog option, which allows you to use bash script, which will transform unknown authors.
我不明白 SVN 存储库出了什么问题,所以我只是导入了它们,没有任何作者文件。然后我使用 Github 中的脚本重命名提交作者数据:
保存上面的代码在一个名为
change-commit-author-script.sh
的文件中,并将该文件放入您的存储库根目录中。通过 chmod +x change-commit-author-script.sh 使其可执行,然后通过 ./change-commit-author-script.sh 运行 是的,不要'不要忘记编辑脚本来填写您的姓名和电子邮件值。
I couldn't figure what the hiccup was with the SVN repo, so I just imported them without any author file. And then I renamed the commit author data using this script from Github:
Save the above code in a file with a name say
change-commit-author-script.sh
and put the file in your repo root. Make it executable bychmod +x change-commit-author-script.sh
and then run in by./change-commit-author-script.sh
And yeah don't forget to edit the script to fill in your name and email values.
如果像我一样,您已经创建了一个
users.txt
并希望将其作为--authors-file
传递,然后才意识到它不起作用,那么这里是一个利用现有users.txt
并允许进行其他自定义的脚本:像这样运行它:
If, like me, you already created a
users.txt
that you wanted to pass as--authors-file
only to then realize that it doesn't work, here is a script that makes use of your existingusers.txt
and allows one to make additional customizations:Run it like this: