NavicoOS / ac2git

Tool to convert an AccuRev repository to Git.
29 stars 15 forks source link

Failed to parse a branch name #113

Closed ghost closed 6 years ago

ghost commented 6 years ago

When we run the script against our (huge & tangled) Accurev depot, it prints a lot of lines like this:

Error: git.py failed to parse a branch name! Please ensure that the git.repo.branch_list() returns a list with no None items. Non-fatal, continuing.

What would cause that? Is it because of some special characters in our stream names, like dots? Is it because a child stream's name has parentheses, even though we are not including it in the conversion? It says "non-fatal, continuing", but what might that effect?

I tried using the branch-name attribute to rename all streams replacing dots with underscores, but the errors are still there.

Thanks again for making this script!

orao commented 6 years ago

I'm not certain as it has been a while since I last looked at this but the parsing of branch names for the branch_list() function is done here and it uses this regex:

^(?P<iscurrent>\*)?\s+(?P<name>.+?)\s+(?P<hash>[A-Fa-f0-9]+)\s+(?:(?P<remote>\[\S+\])\s+)?(?P<comment>.*)$

to parse the branch names. You can test it out online here with the branch list that you are working with to see how it will behave.

ghost commented 6 years ago

Thank you, I'll check against the regex if we see it again. I actually have not seen that issue the last couple times that I ran it, so I do not know why I was seeing it before.

delalikwami commented 5 years ago

@tamiasalpine I realize that this was a year ago, but what OS were you using? I ask because I'm currently seeing this message when running the tool on Windows Server 2016. From what I'm seeing, if the file that contains the commit message has newlines, they aren't displayed correctly in the 'git branch -vv' output, and you'll end up seeing ^M in the comments, which gets interpreted by ac2git as an empty "branch".

With regard to my current trial/error, I've tried running through this process manually (outside of the script), using python to generate a file with multiple lines, and executing the commit using subprocess. Doing this seems to work, and my 'git branch -vv' output doesn't have ^M for the newlines. I also tried re-using one of the ac2gitcommit* files that the tool generates as my commit message and, again, I didn't see the ^M. Essentially, it seems that I'm only seeing the encoding issue when running ac2git.py and I'm unable to reproduce it outside of the tool.