Subject: How to undo SVN IMPORT
Author: Linux
In response to: SVN default structure
Posted on: 03/20/2018 06:59:44 PM
Instead of importing:
sudo svn import -m 'Initial Upload' /tmp/svn-container/ http://localhost/svn/xyz/trunk/projects/ --username=admin
I did:
sudo svn import -m 'Initial Upload' /tmp/svn-container/project-name/ http://localhost/svn/xyz/trunk/projects/ --username=admin
As you can see, the version (let say 26) after import is messed up by missing the project folder "project-name" which should hold all files and sub-directories inside itself.
Here is how to undo this version:
$ cd /tmp
$ sudo svnadmin dump /var/lib/svn/xyz/ --revision 0:25 > dump.db <-- assume that the messed-up version is 26
$ sudo mv /var/lib/svn/xyz /var/lib/svn/xyzbk
$ sudo svnadmin create /var/lib/svn/xyz <-- create repository named 'xyz' again
$ sudo chown -R www-data:www-data /var/lib/svn <-- change owner for http://localhost/svn
$ sudo chmod -R 775 /var/lib/svn
$ sudo svnadmin load /var/lib/svn/xyz < dump.db <-- load back all versions until the last one
$ sudo rm -R dump.db
$ sudo rm -R /var/lib/svn/xyzbk
>
> On 11/04/2017 05:45:35 AM
Linux wrote:
Conventionally, every Subversion project has trunk, tags, and branches directories directly under the repository's root directory.
| /svn/xyz
| -- [+] trunk
| ------- [+] projects
| ----------- [+] project#1
| ----------- [+] project#2
| -- [+] branches
| ------- [+] 1.0
| ----------- [+] projects
| --------------- [+] project#1
| --------------- [+] project#2
| ------- [+] 1.1
| ----------- [+] projects
| --------------- [+] project#1
| --------------- [+] project#2
| ------- [+] 2.0
| ----------- [+] projects
| --------------- [+] project#1
| --------------- [+] project#2
| -- [+] tags
| ------- [+] 1.0.0
| ----------- [+] projects
| --------------- [+] project#1
| --------------- [+] project#2
| ------- [+] 1.0.1
| ----------- [+] projects
| --------------- [+] project#1
| --------------- [+] project#2
| ------- [+] 1.1.0
| ----------- [+] projects
| --------------- [+] project#1
| --------------- [+] project#2
| ------- [+] 1.1.1
| ----------- [+] projects
| --------------- [+] project#1
| --------------- [+] project#2
| ------- [+] 2.0.0
| ----------- [+] projects
| --------------- [+] project#1
| --------------- [+] project#2
The trunk is a directory where all the main development happens and is usually checked out by the developers to work on the project.
The branches directory is used when you want to pursue different routes of development.
The tags directory is used to store snapshots of the project for production release.
Populate the reposiory with the above empty structure:
$ sudo mkdir /tmp/svn-template
$ sudo mkdir /tmp/svn-template/trunk
$ sudo mkdir /tmp/svn-template/branches
$ sudo mkdir /tmp/svn-template/tags
$ sudo svn import -m 'Create trunk, branches, tags directory structure' /tmp/svn-template/ http://localhost/svn/xyz --username=admin
Then the 'projects' container:
$ sudo mkdir /tmp/svn-template/trunk/projects
$ sudo svn import -m 'Create projects directory under trunk' /tmp/svn-template/trunk http://localhost/svn/xyz/trunk --username=admin
Finally a specific project (a mvn project stored under /opt/maven/hello-one):
$ sudo mkdir /tmp/svn-template/trunk/projects/hello-one
$ sudo cp -R /opt/maven/hello-one /tmp/svn-template/trunk/projects/
$ sudo svn import -m 'Create project directory' /tmp/svn-template/trunk/projects/ http://localhost/svn/xyz/trunk/projects/ --username=admin
References: