How to import/export repository from SVN to new SVN - linux

I have an old Subversion on one server and another new one on another server.
I would like to export the head revision from the old repository and import it into the new one.
I have tried the below which seems to export, but I can't get it to import into the new one.
svn export --depth immediates file:///repositories/repo1/ /home/me/repo-export
This is what I am trying for import:
svn import /home/me/repo-export/ /svnroot/
How can this be done via the Linux (Red Hat Linux 4) command line?

It is possible to migrate only the most recent version without the history. However, I strongly recommend to migrate everything. The migration is explained in detail in the online book Version Control with Subversion:
http://svnbook.red-bean.com/en/1.7/svn.reposadmin.maint.html#svn.reposadmin.maint.migrate
In short:
Use svnadmin dump /path/to/old/repo or svnrdump dump old-url to create a dump of the old repository.
Use svnadmin load /path/to/new/repo or svnrdump load new-url to load the dump into the new repository.

Related

Copy Gitlab repositories to another Gitlab server through filesystem

I had a gitlab server of 7.6.2 version with some repositories. Now this server was upgraded by newest Ubuntu and it has an empty gitlab server of version 12.0.1. I also have a HDD backup from old gitlab server.
I need to move all repositories from old gitlab server to the new one. I tried to copy .git repositories from /var/opt/gitlab/repositories/user/ to the similar location of the new server with disabled hashed repositories storage, but it has no effect.
I also tried to create an empty repository with e.g. name test and replace test.git directory on new server from directory from old one, but there is no effect neither.
I tried to find file from created test repository named test.txt by find command in whole server file system, but there is no such file was found (but this file exists in the gitlab repository).
My question is: where repositories of gitlab server are stored and how can I copy it from backup of old server HDD to the new server file system (I can not run both instances of gitlab because I have only one machine. Running backup of old server as virtual machine's rootfs is also impossible by some reasons).
Upd.
It is not duplicate of this question because I have no backups of old gitlab server made by gitlab, I have only backup of filesystem of machine it was installed on. I also can not run old server to pull repositories because its machine was upgraded. Only thing I have from old server: its filesystem.
If you just need to migrate repositories (ie: no issues, pipelines, etc), it's better to clone each repository and upload it again (one by one, or using a batch command):
cd /var/opt/gitlab/repositories/...
git remote add newserver url
git push --all newserver url
Instead, if you need to migrate all features, it's better to restore the server backup and upgrade OS and Gitlab in place... even if it's a long road between 7 and 12, and you probably neeed to make multiple steps.
Careful, this might cause massive breakage, experiment on a scratch system.
The git repositories should be the same, so I'd try just copying the contents over. The user information and ancillary stuff is probably different.
Another path would be to set up the old system, and upgrade that one. Version by version, if need be.
Last resort is to clone the old repositories and upload them into the new system.

After migrate svn repositories to another server in conf folder passwd file is empty

After migrating svn repos from a server to another server, even I used "--force-uuid" in svnadmin load command, the passwd files of the repositories are empty.
All conf folder contents are empty.
Is there a way to migrate conf file properly?
Thanks for your help.
edit: from server's svn version is 1.6, to server's svn version is 1.7. is version difference causes a problem like this?
edit: from server's svn version is 1.6, to server's svn version is
1.7. is version difference causes a problem like this?
You must not use Subversion 1.7 or older versions. Upgrade to the latest 1.9.x.
I would recommend that you read the documentation before you perform any repository maintenance or administration tasks. SVNBook is a great resource of information about Subversion and version control in general. It will help you familiarize yourself with common terminology and concepts of SVN and version control.
After migrating svn repos from a server to another server, even I used
"--force-uuid" in svnadmin load command, the passwd files of the
repositories are empty. All conf folder contents are empty.
Read SVNBook | Repository data migration using svnadmin:
The Subversion repository dump format describes versioned repository
changes only. It will not carry any information about uncommitted
transactions, user locks on filesystem paths, repository or server
configuration customizations (including hook scripts), and so on.
And note that UUID has nothing to do with your htpasswd file.

Setting up a local SVN

I'm trying to set up a local svn to version control a really big project.
Normally i have only used premade SVNs for school stuff, is it even possible to create a
local svn folder that will keep track of changes.
I am using svnadmin create myrepo to create the repository, and then svn import home/dev/svntest file:///home/dev/myrepo to import the file there. However when I run that command a file called svn-commit.tmp is created with the following text in it:
"--This line, and those below, will be ignored--
A hello.txt:///~myrepo/test1"
What am i doing wrong?
You're missing a commit message for your svn import. Add -m "Initial import of project svntest" to your svn import line.
Follow-up to #Mike
Don't worry about this strange file, just test results of import
Conventional layout of repo tree (/trunk+ /tags +/branches) from the beginning may have some benefits (i.e before import perform 3 mkdir and import into file:///home/dev/myrepo/trunk)
You can always see at the repo and control results tree using svn ls -v -R file:///home/dev/myrepo command

TortoiseSVN, how to dump a repository?

I use Windows 7 and also I use TortoiseSVN to keep track of my code, now I want to migrate my repository to a cloud-service and the requirement is create a *.dump file, but I can't find a way to create it. Some forums say to use "svnadmin" but I can't find it also.
My question is how can I create a *.dump file with TortoiseSVN?
TortoiseSVN ships the svnadmin utility with it. It is a command line utillity. So you will have to create a dump of your repository in the command line.
To create a dump of your repository, use
svnadmin dump C:\SVN\MyProject > C:\tmp\MyProject.dump
where C:\SVN\MyProject is the path to your SVN repo and C:\tmp\MyProject.dump is the path to the dump file, which will be created.
To import your previously made dump file into a new repository, use
svnadmin load C:\SVN\MyProject < C:\tmp\MyProject.dump
where C:\SVN\MyProject is the path to your new SVN repo and C:\tmp\MyProject.dump is the path to the dump file, which should be imported.
Subversion 1.7 now has the svnrdump command line utility.
svnrdump dump https://host/repo > repo.dump
Note that this always creates a dump with deltas, which might not be what you want.
TortoiseSVN is a svn client. It cannot take a dump of your repository. You need a tool like svnadmin on the server hosting your SVN repository to take a dump. You need access to the server and its filesystem.
Also see here for migrating a repository
svnadmin is part of the SVN server, so you should have a direct admin access to your repository server.
The first thing you need to do is follow this tutorial to get some idea about how to use TortoiseSVN on the local machine.
http://www.thinkplexx.com/learn/howto/scm/svn/how-to-create-and-use-local-svn-subversion-repository-on-windows-or-linux-simple-and-fast-step-by-step
once you have done with above tutorial and committed your files to the repository, execute below command.
svnadmin dump TortoiseRepository > dumpfile
If your TortoiseSVN repository is not called 'TortoiseRepository' just change the name above to whatever you have called it. If the dump works you should see lots of '*Dumped revision' messages. The 'dumpfile' now contains an entire export of your TortoiseSVN repository and all the revisions, comments etc.

Tortoise Delete File System Repository

I am working on a file system repository with Tortoise.
I deleted the initial folder where I created the repository.
The folder which I added to the old repository, when I try to add to a new repository, the error message appears:
Repository UUID '6df16c57-c740-ea49-ab7f-fcd22d7f7cb9' doesn't match expected
Is there a way to simply clear out the settings for the old repository? So that I could perform the importing of the folder to add into the new repository in a clean slate.
BTW this is my tortoise version (if it is of any help):
TortoiseSVN 1.5.8, Build 15348 - 32 Bit , 2009/02/13 18:06:18
Subversion 1.5.5,
apr 1.2.12
apr-utils 1.2.12
berkeley db 4.4.20
neon 0.28.3
OpenSSL 0.9.8i 15 Sep 2008
zlib 1.2.3
Basically, all I want to do is to clear up the repository which I earlier created so that it is like starting from scratch over again.
Thanks.
There's an easy way to do this with TortoioseSVN:
unversion a working copy
Yes. If you have Cygwin installed, you can use the unsvn utility to remove all the ".svn" folders.

Resources