Hi!
I’m working at a company which is still using svn and we want to switch from svn to git in the near future. At the moment I’m trying out some different tools after svn2git failed most of the time. I discovered subgit and used it for 2 pretty big repositories with a lot of revisions. I wanna try it out for 1-2 more before I decide to use subgit in the migration process in a few months.
I had some little errors while using it:
- Sometimes I have some XML errors but I always could restart the import process and it would continue
- Sometimes I just don’t see any console output but can verify in the log that the process is still going strong
Is this normal or what could the issue be here?
The biggest problem I have is with one of our biggest repository. I use the import command as I used it with the two different svn repos before. At the beginning there is no output in the console but later on it prints some revisions out. The log seemed normal. But after I interrupted the process once and try to start the import process again I get the following error:
IMPORT FAILED
error: There’re new Git commits, not present in SVN repository, can’t import.
error: If you want to continuous synchronization between SVN and Git repositories, use ‘subgit install’ command instead.
Any ideas what the problem is here?
Hi Andy!
thank you for reaching out to us on that matter!
I’m not sure what are those XML error you mentioned, but if those are errors E175002 like
error: svn: E175002: Processing REPORT request response failed: XML document structures must start and end within the same entity. (/svn…)
error: svn: E175002: REPORT request failed on '/svn…'
error: Unexpected error has occurred; please report along with the logs
or similar, then it indicates that SubGit was unable to gather data from SVN which often is caused by network issues or, for example, too small timeout setting on a web server.
Regarding the console output – SubGit indeed does not show much information on console, just a progress bar showing a revision being currently handled and if the revision is big then SubGit may not be showing a new info for a relatively long time; but you are right, SubGit always continues writing in logs, so the log is a better way to check if the process is working well.
Regarding the failing import – just to be sure, could it happen that the target Git repository has a commit that was pushed directly to the Git repository? If not, could you please try to run
subgit install <REPO PATH>
it should pick up the initial import process where it stopped and continue until the latest revision. It will also leave the SubGit daemon running after initial import, it can be stopped with the following command:
subgit shutdown <REPO PATH>
or
subgit uninstall --purge <REPO PATH>
the latter one will stop the daemon and clean out all the SubGit metadata.
Hi ildar,
Thanks for the fast reply.
Yes it is exactly this XML error.
For the failing import process. I probably need to mention that I’m not trying to import it directly onto our gitlab test server.
I did the following (which seemd to work for the other repos):
subgit configure http://svn/repos/myrepo
added authors.txt and enabled http spooling in the config file
subgit import http://svn/repos/myrepo
this created a myrepo.git directory which I later added the remote origin and pushed it to the gitlab server
Probably I already made some mistakes here but it seemed to work for my other repos.
I did not commit anything in the myrepo.git directory locally, that’s why the error seems strange.
When I’m using
subgit install…myrepo
I receive the following error:
INSTALLATION FAILED
error: Subversion and Git repositories are out of sync and can not be synchronized
Hi Andy,
it’s definitely not a mistake, but perfectly working way, not that straightforward comparing with the direct import to a GitLab project, of course) but also a well-working way.
The error Subversion and Git repositories are out of sync and can not be synchronized
means that SVN and Git repositories history diverged – that is, there are commits in Git that don’t have counterparts in SVN and that is the reason why SubGit cannot proceed, it just is unaware on how to deal with those commits. Most often that happens when a new commits are pushed to Git and not synchronized with SVN, but it looks not to be the case here. If nothing has been changed in the Git repository manually after the import has been stopped, then I guess it probably might have been caused by the unexpected interruption. A possible solution then is to rebuild the repository, but to not to start the import from the very beginning, it may be rebuilt from a recent revision that was imported correctly. The rebuild can be performed with the following command:
subgit install --rebuild-from-revision <REV_NO> <REPO_PATH>
where REV_NO stands for the revision number from which the rebuild should start.
Note, that this is install
command that will start the mirror after the initial import, and if you don’t need the mirror, then it will be stopped with shutdown
or even SubGit uninstalled.
Hi!
Thanks again, I really appreciate the help. It is strange because with the other repositories I often interrupted the import process but with this one I tried it multiple times and as soon as I interrupt it the next time I wanna continue I have the same “There’re new Git commits, not present in SVN repository, can’t import.” error even tho it is a local .git directory and I did not commit at all.
I will try to restart it completly again and see how it goes. If it fails again I will try with the rebuild attribute.
Hey :) It’s me again.
I still have this issue after interrupting the import process. Last week I tried to use the subgit import command to migrate some more of our svn repositories. I did it on my own pc and sadly had a bluescreen in the middle of the day. 5 repos interrupted. After trying to continue with the import process all of them had the error:
There’re new Git commits, not present in SVN repository, can’t import.
I 100% dit not commit anything into the .git folder. After your last message in here some weeks ago I tried the command
subgit --rebuild-from-revision XXX PATH
and received the error
SubGit installed into repository ‘mygit.git’ is too old (3.3.14#4433) and is not compatible with this version of SubGit (3.3.14#4433).
I am really only interested in a one-way migration from svn to git. Is there anything I can try to avoid the out of sync git error after an interrupt? Would it be better to start with subgit install and shutdown the sync process afterwards?
Thanks for helping me out.
Hi Andy,
SubGit is designed so that it relies upon smooth initial import and it does not expect the import is broken in the middle. The matter is that it is very hard to predict the repository state in case of unexpected interruption, not telling about restoring the state after such a fault. Thus SubGit just tries to continue the import when it starts, and fails in case if the interruption broke something in the repository. The most proper way to perform the initial import well is to make sure it goes smooth without interruptions, I’m afraid, SubGit does its best in order to continue an interrupted import, but it is expected that such an attempt may fail.