将 SVN 存储库导入 Git 时未定义作者
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11037166/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Author not defined when importing SVN repository into Git
提问by Greg
I'm trying to import our SVN repository into Git. When I run either this command:
我正在尝试将我们的 SVN 存储库导入 Git。当我运行此命令时:
git svn --authors-file=/path/to/authors --trunk=trunk clone https://my-repo/project .
or this command:
或此命令:
svn2git https://my-repo/project --no-minimize-url -v --authors /path/to/authors
Both return this error:
两者都返回此错误:
Author: patrick not defined in /path/to/authors file
..but as far as I can tell, there is nothing wrong with my authors file:
..但据我所知,我的作者文件没有任何问题:
$ grep patrick /path/to/authors
patrick = Patrick <[email protected]>
That error doesn't happen until it gets to revision 8700, so it must be grabbing the other author names correctly.
直到修订版 8700 才会发生该错误,因此它必须正确获取其他作者姓名。
What could be going on here? Thanks.
这里会发生什么?谢谢。
采纳答案by Greg
There were two problems:
有两个问题:
I solved the first by assigning unique email addresses to each author.
我通过为每个作者分配唯一的电子邮件地址来解决第一个问题。
Also, the username was "patrick ". I have no idea how that happened, but by using svnadmin I was able to change all instances of that nickname to just "patrick".
此外,用户名是“patrick”。我不知道这是怎么发生的,但是通过使用 svnadmin 我能够将该昵称的所有实例更改为“patrick”。
回答by Daniel Lemke
I've had the same issue when trying to execute this on Windows. It turned out that the encoding of the file that I stored the authors in was set to UTF-8 instead of UTF-8 without BOM. As the "with BOM" version adds some additional bytes to the beginning of the file, the first author in the list was never found.
尝试在 Windows 上执行此操作时,我遇到了同样的问题。原来,我存储作者的文件的编码设置为 UTF-8,而不是没有 BOM 的 UTF-8。由于“with BOM”版本在文件开头添加了一些额外的字节,因此从未找到列表中的第一作者。
回答by Stephane
I had the same problem but the cause was actually rather different: I used Powershell to dump the authors list from SVN and I didn't realized that it saved the result as a UTF-16 file.
我遇到了同样的问题,但原因实际上相当不同:我使用 Powershell 从 SVN 转储作者列表,但我没有意识到它将结果保存为 UTF-16 文件。
It turned out git (at least, up to git for windows version 2.16.1) is unable to use UTF-16 files. Converting the file to UTF-8 did the trick for me.
事实证明 git(至少,对于 windows 版本 2.16.1 来说是 git)无法使用 UTF-16 文件。将文件转换为 UTF-8 对我来说很有效。
回答by Oscar Montoya
I had the same issue. The format of the authors.txt is strict with the form
我遇到过同样的问题。author.txt 的格式对表格有严格要求
svn name = user name ‹email›
as in:
如:
cruise-control = Cruise Control ‹[email protected]›
user1 = User1 Lastname1 ‹[email protected]›
user2 = User2 Lastname2 ‹[email protected]›
For instance this format won't work:
例如,这种格式将不起作用:
user1 = [email protected]
回答by Fizz
I had the same error as the question and for my solution was extra newline or carriage return characters that were not showing up in Notepad. I had the entry john = John <[email protected]>
which showed just fine in Notepad. Although when opened in Notepad++ I noticed that it was formatted the following way:
我遇到了与问题相同的错误,我的解决方案是额外的换行符或回车符,这些字符没有出现在记事本中。我的条目john = John <[email protected]>
在记事本中显示得很好。虽然在 Notepad++ 中打开时,我注意到它的格式如下:
john =
John <[email protected]>
After I fixed this in Notepad++ to be a single line, it seemed to work fine for me.
在 Notepad++ 中将其修复为一行后,它似乎对我来说工作正常。
回答by Svend Hansen
I saw the same error, but for a different reason. I'll post my solution here as an "answer", as it might be the answer to other people who find this question (even if it isn't the solution/answer to OP's problem/question):
我看到了同样的错误,但原因不同。我将在这里发布我的解决方案作为“答案”,因为它可能是其他发现此问题的人的答案(即使它不是 OP 问题/问题的解决方案/答案):
I was running the svn log
from the checkout of the project. But I only had trunk
checked out, so only authors who had committed changes to trunk were included. This was obviously most of the authors, so the clone would run for a long time (over 90 minutes) before it would crash with the error.
我正在svn log
从项目的结帐中运行。但我只是trunk
签出,所以只包括对主干进行更改的作者。这显然是大多数作者,所以克隆会运行很长时间(超过 90 分钟),然后它会因错误而崩溃。
As checking out the entire the entire project root wasn't a viable option (it has over 500 branches and tags, and a dump is over 600 GB), I found that I could just run the svn log
on the remote repo like this:
由于检查整个项目根目录不是一个可行的选择(它有超过 500 个分支和标签,并且转储超过 600 GB),我发现我可以svn log
像这样在远程仓库上运行:
svn log -q svn://server/path-to-project-root
The actual command also did some filtering and formatting of the output:
实际命令还对输出进行了一些过滤和格式化:
svn log -q svn://server-url/path-to-project-root | awk -F '|' '/^r/ {sub("^ ", "", ); sub(" $", "", ); print " = "" <"">"}' | sort -u > authors-transform.txt
回答by Add
Look for any empty spaces in the beginning of the Authors names and delete the spaces. If that does not help, try moving the author's name to the top of the file.
在作者姓名的开头查找任何空格并删除空格。如果这没有帮助,请尝试将作者姓名移至文件顶部。
回答by Naeem Gittham
I have 2 users in the file one after the other and the encoding was set to Ucs-2 LE BOM by default. Changing the encoding to UTF-8 worked for me.
我在文件中一个接一个地有 2 个用户,默认情况下编码设置为 Ucs-2 LE BOM。将编码更改为 UTF-8 对我有用。