问题
I've been struggling with getting a Subversion to Git migration to work on a corporate-IT managed Red Hat 6.4 Linux workstation. Our IT organization provides several versions of most of the OTS packages they think we'll need by mounting them under an "/apps" directory on our local workstations. I do not have root or sudo on my box, or this would probably be easier. Following some blog posts (such as this one), and trying to set up my PATH and LD_LIBRARY_PATH correclty, I've gotten to the point where I've done a successful git svn init <my/svn/path>
, but running the git svn fetch
yields errors such as:
Can't load '/apps/subversion_1.9.4/lib/site_perl/5.14.2/x86_64-linux-thread-multi-ld//auto/SVN/_Core/_Core.so' for module SVN::_Core:
/apps/subversion_1.9.4/lib/site_perl/5.14.2/x86_64-linux-thread-multi-ld//auto/SVN/_Core/_Core.so:
undefined symbol: svn_swig_pl_thunk_config_enumerator at /usr/lib64/perl5/DynaLoader.pm line 200.
at /apps/subversion_1.9.4/lib/site_perl/5.14.2/x86_64-linux-thread-multi-ld//SVN/Base.pm line 59 BEGIN failed--compilation aborted at /apps/subversion_1.9.4/lib/site_perl/5.14.2/x86_64-linux-thread-multi-ld//SVN/Core.pm line 5.
I've tracked down the library that contains this symbol (seems like this could be an issue with compilation paths) to be libsvn_swig_perl-1.so
. I set the LD_PRELOAD env variable in bash to the path to that library, but then running the git svn fetch
gives me a new error:
/apps/git_2.9.3/bin/git: symbol lookup error:
/apps/subversion_1.9.4/lib/libsvn_swig_perl-1.so: undefined symbol: PL_thr_key
I have not yet been able to successfully locate what package and library "PL_thr_key" comes from. Any hints on where I can get a full list of dependencies (or at least where PL_thr_key is defined) to hopefully get my svn-to-git migration finished?
回答1:
For a one-time migration git-svn
is not the right tool for conversions of repositories or parts of a repository. It is a great tool if you want to use Git as frontend for an existing SVN server, but for one-time conversions you should not use git-svn
, but svn2git
which is much more suited for this use-case.
There are plenty tools called svn2git
, the probably best one is the KDE one from https://github.com/svn-all-fast-export/svn2git. I strongly recommend using that svn2git
tool. It is the best I know available out there and it is very flexible in what you can do with its rules files.
You will be easily able to configure svn2git
s rule file to produce the result you want from your current SVN layout, including any complex histories that might exist and including producing several Git repos out of one SVN repo or combining different SVN repos into one Git repo cleanly in one run if you like and also excluding any paths or branches or tags you don't to have migrated, though I'm always crying a little if someone discards code history which is precious.
If you are not 100% about the history of your repository, svneverever
from http://blog.hartwork.org/?p=763 is a great tool to investigate the history of an SVN repository when migrating it to Git.
Even though git-svn
or the nirvdrum svn2git
is easier to start with, here are some further reasons why using the KDE svn2git
instead of git-svn
is superior, besides its flexibility:
- the history is rebuilt much better and cleaner by
svn2git
(if the correct one is used), this is especially the case for more complex histories with branches and merges and so on - the tags are real tags and not branches in Git
- you can generate annotated tags instead of lightweight tags
- with
git-svn
the tags contain an extra empty commit which also makes them not part of the branches, so a normalfetch
will not get them until you give--tags
to the command as by default only tags pointing to fetched branches are fetched also. With the proper svn2git tags are where they belong - if you changed layout in SVN you can easily configure this with
svn2git
, withgit-svn
you will loose history eventually - with
svn2git
you can also split one SVN repository into multiple Git repositories easily - or combine multiple SVN repositories in the same SVN root into one Git repository easily
- the conversion is a gazillion times faster with the correct
svn2git
than withgit-svn
You see, there are many reasons why git-svn
is worse and the KDE svn2git
is superior. :-)
回答2:
The solution that finally worked for me was to follow a co-workers suggestion, and create a VM where I had root/sudo access, copy the subversion repo in there, and do the conversion there--where I have control over installing matching versions of software. Yes, it was higher effort than a simple git svn clone
, but without the ability to easily troubleshoot the process, and trying to ferret out depenencies between possibly mismatched versions of svn and git, it wound up being the best solution in the end. In case this winds up being helpful to anyone else. On an AWS ubuntu 16.04 LTS Virtual Machine, I installed the following:
sudo apt-get install build-essential subversion git qtchooser qt5-qmake libapr1 libapr1-dev libsvn-dev
This gave me the following version combination for git and svn:
$ git --version
git version 2.7.4
$ svn --version
svn, version 1.9.3 (r1718519)
After this, the git svn clone
went fairly smooth, the only hitch was remembering to use a file:///path/to/svn/repo
format to point to the repo, as it was unhappy with an absolute path.
As a footnote, I did try the svn-all-fast-export
option mentioned by Vampire's answer, but was ultimately unable to get that working (I dead ended at a core dump before going back to git svn clone
).
来源:https://stackoverflow.com/questions/48712773/what-dependencies-does-running-git-svn-need-to-have-installed-in-order-to-run