Difference between revisions of "Subversion"
(7 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
<!--__NOTOC__--> | <!--__NOTOC__--> | ||
− | <h1> Basic Linux Subversion Usage </h1> | + | <h1> Basic Linux Subversion Usage (Terminal)</h1> |
<h2> Install subversion </h2> | <h2> Install subversion </h2> | ||
Line 8: | Line 8: | ||
In linux debian/ubuntu OS: | In linux debian/ubuntu OS: | ||
<pre> | <pre> | ||
− | sudo apt-get install | + | sudo apt-get install subversion |
</pre> | </pre> | ||
Line 17: | Line 17: | ||
<h2> Basic Commands </h2> | <h2> Basic Commands </h2> | ||
− | |||
− | |||
<table> | <table> | ||
<tr> | <tr> | ||
Line 35: | Line 33: | ||
<td>Upload modifications </td> | <td>Upload modifications </td> | ||
<td>:</td> | <td>:</td> | ||
− | <td>svn ci </td> | + | <td>svn ci (equivalent to svn commit)</td> |
+ | </tr> | ||
+ | <tr> | ||
+ | <td></td> | ||
+ | <td>:</td> | ||
+ | <td>svn commit</td> | ||
</tr> | </tr> | ||
Line 41: | Line 44: | ||
<td>Upload modifications with comments </td> | <td>Upload modifications with comments </td> | ||
<td>:</td> | <td>:</td> | ||
− | <td>svn ci -m "<YOUR_COMMENT>"</td> | + | <td>svn ci -m "<YOUR_COMMENT>" </td> |
+ | </tr> | ||
+ | <tr> | ||
+ | <td></td> | ||
+ | <td>:</td> | ||
+ | <td>svn commit -m "<YOUR_COMMENT>"</td> | ||
</tr> | </tr> | ||
Line 55: | Line 63: | ||
<td>svn logs </td> | <td>svn logs </td> | ||
</tr> | </tr> | ||
− | + | </table> | |
+ | <h2> Status information </h2> | ||
+ | |||
+ | The execution of <i>svn st</i> shows information about the local status of the repository’s files. | ||
+ | This information is shown through a tag before file's name. | ||
+ | The main tags: | ||
+ | |||
+ | <table> | ||
+ | <tr> | ||
+ | <td>M</td> | ||
+ | <td>:</td> | ||
+ | <td>The file has been modified and it will replace the old version in the next commit.</td> | ||
+ | </tr> | ||
+ | <tr> | ||
+ | <td>?</td> | ||
+ | <td>:</td> | ||
+ | <td>The file is new and it is not in the version control.</td> | ||
+ | </tr> | ||
+ | <tr> | ||
+ | <td>A</td> | ||
+ | <td>:</td> | ||
+ | <td>The file was new and it will be added in the next commit.</td> | ||
+ | </tr> | ||
</table> | </table> | ||
+ | |||
+ | More information at http://svnbook.red-bean.com/en/1.7/svn.ref.svn.c.status.html | ||
+ | |||
+ | |||
+ | <h2> Typical usage </h2> | ||
+ | |||
+ | |||
+ | <h3> Upgrade new changes </h3> | ||
+ | When you are working on a folder under the version control, you usually modify or add files. | ||
+ | You can know the status of your folder with: | ||
+ | <pre> | ||
+ | svn st | ||
+ | </pre> | ||
+ | This command shows a list of new and modified files (between other possibilities). | ||
+ | For example, you can obtain the following information: | ||
+ | <pre> | ||
+ | ? file_1 | ||
+ | M file_2 | ||
+ | </pre> | ||
+ | This implies that <i>file_1</i> is a new file which is not in the version control and <i>file_2</i> is a preexisting file which has been modified. | ||
+ | If you want to store <i>file_1</i> on the repository, you should execute the following command: | ||
+ | <pre> | ||
+ | svn add file_1 | ||
+ | </pre> | ||
+ | With this command, you mark <i>file_1</i> in your local version as a file which you want to add to the version control. | ||
+ | Recalls that <i>file_1</i> is NOT already on the repository server, it is still only in your local computer. | ||
+ | If you execute now <i>svn st</i>, you will see the new status: | ||
+ | <pre> | ||
+ | A file_1 | ||
+ | M file_2 | ||
+ | </pre> | ||
+ | <i>file_1</i> is marked as an added file. | ||
+ | The next step is to upgrade the repository with the new version of the files. | ||
+ | Execute the following command: | ||
+ | <pre> | ||
+ | svn ci -m "<YOUR_COMMENT>" | ||
+ | </pre> | ||
+ | You should include a message (<YOUR_COMMENT>), it will be logged to know the changes made. | ||
+ | The repository is now upgraded and the current version has been incremented. | ||
+ | The changes can be updated in other instances of the repository. | ||
+ | |||
+ | |||
<h1> Basic Windows Subversion Usage </h1> | <h1> Basic Windows Subversion Usage </h1> | ||
Latest revision as of 19:36, 11 January 2016
Contents
Basic Linux Subversion Usage (Terminal)
Install subversion
In order to use subversion repositories, you should install it before. In linux debian/ubuntu OS:
sudo apt-get install subversion
Download a repository
svn co svn+ssh://<USER>@<SERVER>/<COMPLETE_PATH>
Basic Commands
Update repository | : | svn up |
Add a File | : | svn add <FILENAME> |
Upload modifications | : | svn ci (equivalent to svn commit) |
: | svn commit | |
Upload modifications with comments | : | svn ci -m "<YOUR_COMMENT>" |
: | svn commit -m "<YOUR_COMMENT>" | |
Check status | : | svn st |
Check logs | : | svn logs |
Status information
The execution of svn st shows information about the local status of the repository’s files. This information is shown through a tag before file's name. The main tags:
M | : | The file has been modified and it will replace the old version in the next commit. |
? | : | The file is new and it is not in the version control. |
A | : | The file was new and it will be added in the next commit. |
More information at http://svnbook.red-bean.com/en/1.7/svn.ref.svn.c.status.html
Typical usage
Upgrade new changes
When you are working on a folder under the version control, you usually modify or add files. You can know the status of your folder with:
svn st
This command shows a list of new and modified files (between other possibilities). For example, you can obtain the following information:
? file_1 M file_2
This implies that file_1 is a new file which is not in the version control and file_2 is a preexisting file which has been modified. If you want to store file_1 on the repository, you should execute the following command:
svn add file_1
With this command, you mark file_1 in your local version as a file which you want to add to the version control. Recalls that file_1 is NOT already on the repository server, it is still only in your local computer. If you execute now svn st, you will see the new status:
A file_1 M file_2
file_1 is marked as an added file. The next step is to upgrade the repository with the new version of the files. Execute the following command:
svn ci -m "<YOUR_COMMENT>"
You should include a message (<YOUR_COMMENT>), it will be logged to know the changes made. The repository is now upgraded and the current version has been incremented. The changes can be updated in other instances of the repository.
Basic Windows Subversion Usage
Download and check:
http://tortoisesvn.net/
Subversion Manager
Relocate server
svn sw --relocate svn+ssh://<USER>@<OLD_SERVER>/<COMPLETE_PATH> svn+ssh://<USER>@<NEW_SERVER>/<COMPLE_PATH>
Dump
To create a file with all the repo
svnadmin dump <SVN_REPO_NAME> > <SVN_DUMPFILE_NAME>
Load
To create a repo from a dump file
svnadmin create <SVN_REPO_NAME> svnadmin load --ignore-uuid <SVN_DUMPFILE_NAME> < <SVN_REPO_NAME>
Filter
To create a repo file with a specific directory within the dump file
svndumpfilter include <PATH_TO_DESIRED_DIR> --drop-empty-revs --renumber-revs --preserve-revprops < <SVN_DUMPFILE_NAME> > <SVN_DESIRED_DIR_DUMPFILE_NAME>
However, the <SVN_DESIRED_DIR_DUMPFILE_NAME> keeps the directory structure of the old repo. If you want to delete it:
1) Edit <SVN_DESIRED_DIR_DUMPFILE_NAME>
2) Remove the top directory (e.g.):
Node-path: 2007-2008 Node-action: add Node-kind: dir Prop-content-length: 10 Content-length: 10 PROPS-END
3) Remove all the references to the top directory (e.g.)
sed -i 's/Node-path: 2005-2006/Node-path: /g' asignaturas_2005-2006_dump sed -i 's/Node-copyfrom-path: 2005-2006/Node-copyfrom-path: /g' asignaturas_2005-2006_dump