Author not defined when importing SVN repository into Git

断了今生、忘了曾经 提交于 2019-12-09 14:03:31

问题


I'm trying to import our SVN repository into Git. When I run either this command:

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 <none@example.com>

That error doesn't happen until it gets to revision 8700, so it must be grabbing the other author names correctly.

What could be going on here? Thanks.


回答1:


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.




回答2:


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.

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.




回答3:


I had the same issue. The format of the authors.txt is strict with the form

svn name = user name &#8249;email&#8250;

as in:

cruise-control = Cruise Control &#8249;cruise-control@abc.com&#8250;
user1 = User1 Lastname1 &#8249;user1@abc.com&#8250;
user2 = User2 Lastname2 &#8249;user2@abc.com&#8250;

For instance this format won't work:

user1 = user1@abc.com



回答4:


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".




回答5:


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@example.com> which showed just fine in Notepad. Although when opened in Notepad++ I noticed that it was formatted the following way:

john =
John <email@example.com>

After I fixed this in Notepad++ to be a single line, it seemed to work fine for me.




回答6:


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):

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.

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:

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("^ ", "", $2); sub(" $", "", $2); print $2" = "$2" <"$2">"}' | sort -u > authors-transform.txt



回答7:


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.



来源:https://stackoverflow.com/questions/11037166/author-not-defined-when-importing-svn-repository-into-git

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!