Difference between revisions of "Subversion"

From VideoLAN Wiki
Jump to navigation Jump to search
 
m (Fix link: en:Patch (Unix) should be wikipedia:patch (Unix))
 
(50 intermediate revisions by 19 users not shown)
Line 1: Line 1:
The VideoLAN's repository is now using [http://subversion.tigris.org/ Subversion], which is ever so slightly trendier than CVS but provides a pretty similar interface so should not be too disruptive. It also provides a better control over the repository.
+
{{Historical}}
 +
:''Replaced with [[Git]]''
 +
== Introduction to SVN ==
 +
Some VideoLAN's repositories are using [https://subversion.apache.org Subversion], which is a classical VCS, like CVS.
 +
It also provides a better control over the repository compared to CVS.
  
Currently the repository is hosted on one of the [[VideoLAN Servers]].
+
Note that some project, like {{VLC}} or x264 are using Git. You can read more about VideoLAN's git repository in our [[Git|Git wiki page]].
  
To use it, you have to download the [http://subversion.tigris.org/ official command line Subversion client]. You can also use alternative clients, such as the graphical [http://tortoisesvn.tigris.org/ TortoiseSVN] for Windows.
+
'''Currently the Subversion repositories are discontinued on VideoLAN.'''
 +
 
 +
=== How to use it ===
 +
To use it, you have to download the [https://subversion.apache.org official command line Subversion client]. You can also use alternative clients, such as the graphical [http://tortoisesvn.tigris.org/ TortoiseSVN] for Windows.
 +
 
 +
When using [[Cygwin]] as compilation environment it is recommended to use the SVN package that comes with it (using the Cygwin setup). Using an "external" SVN application might otherwise cause problems with so called DOS versus UNIX "line endings" when creating files.
  
 
Subversion's command-line interface is generally pretty similar to CVS. This is a '''basic''' and partial guide of the most useful commands. For a complete guide, use the book [http://svnbook.red-bean.com/en/1.2/index.html Version Control with Subversion]. If you have a write access to the server, it's very recommended that you read it and know about the advanced features of Subversion, because you might use them sooner or later.
 
Subversion's command-line interface is generally pretty similar to CVS. This is a '''basic''' and partial guide of the most useful commands. For a complete guide, use the book [http://svnbook.red-bean.com/en/1.2/index.html Version Control with Subversion]. If you have a write access to the server, it's very recommended that you read it and know about the advanced features of Subversion, because you might use them sooner or later.
Line 11: Line 20:
  
 
=== Check out ===
 
=== Check out ===
First, you have to check out the code of VLC media player. Use the following syntax:
+
First, you have to check out the code of libdvbpsi. Use the following syntax:
  <nowiki> svn checkout svn://svn.videolan.org/vlc/trunk vlc-trunk</nowiki>
+
  {{%}} <nowiki>svn checkout svn://svn.videolan.org/libdvbpsi/trunk libdvbpsi-trunk</nowiki>
  
You can browse the code structure using the [http://trac.videolan.org/vlc/browser Trac's web interface] ([http://trac.edgewell.org/ Trac]).
+
You can browse the code structure using on the [http://svn.videolan.org SVN webviewer]
 
Use the three folders there for different purposes:
 
Use the three folders there for different purposes:
* [http://trac.videolan.org/vlc/browser/trunk Trunk] is the main development branch.
+
* {{SVNSourceFile|name=trunk|repo=libdvbpsi}} is the main development branch.
* The [http://trac.videolan.org/vlc/browser/branches branches] are used for stable versions and for the development of complex features.
+
* The {{SVNSourceFile|name=branches|repo=libdvbpsi}} are used for stable versions and for the development of complex features.
* The [http://trac.videolan.org/vlc/browser/tags tags] are used to track the released versions.
+
* The {{SVNSourceFile|name=tags|repo=libdvbpsi}} are used to track the released versions.
  
 
The URL structure is:
 
The URL structure is:
  
 
; transport : svn://svn.videolan.org
 
; transport : svn://svn.videolan.org
; project repository : /vlc
+
; project repository : /libdvbpsi
 
; branch/tag : /trunk, or /branches/0.8.6, or /tags/0.8.5
 
; branch/tag : /trunk, or /branches/0.8.6, or /tags/0.8.5
 
; files : /README
 
; files : /README
Line 32: Line 41:
  
 
=== Projects on VideoLAN's SVN ===
 
=== Projects on VideoLAN's SVN ===
    * svn://svn.videolan.org/vlc: VLC media player;
 
    * svn://svn.videolan.org/vls: VideoLAN Server;
 
    * svn://svn.videolan.org/libdvdcss: library for decrypting DVDs, used by {{VLC}} and VLS.
 
    * svn://svn.videolan.org/libdvdplay: library for DVD navigation, used by {{VLC}}.
 
    * svn://svn.videolan.org/libdvbpsi: library for parsing Program Specific Information from MPEG and DVB streams, used by VLC and VLS.
 
    * svn://svn.videolan.org/x264: library for H.264/AVC encoding, used by {{VLC}}.
 
    * svn://svn.videolan.org/videolan/www.videolan.org: the website (no trunk or branches)
 
    * svn://svn.videolan.org/videolan/developers.videolan.org: the developers website (no trunk or branches)
 
  
 +
All projects from VideoLAN SVN are moved to gitlab on code.videolan.org.
  
 
=== Updating the working copy ===
 
=== Updating the working copy ===
 
To update your working copy and get the latest files, use the following command:
 
To update your working copy and get the latest files, use the following command:
  
  svn update
+
  {{%}} svn update
  
 
Note that SVN, unlike CVS, doesn't need to be told to prune removed files or create new directories. This is automagic.
 
Note that SVN, unlike CVS, doesn't need to be told to prune removed files or create new directories. This is automagic.
  
 
=== Making a diff ===
 
=== Making a diff ===
Diffs, or patches, are text files which include all the changes done in the working copy. If you suggest a new feature in [[MediaZilla:|Bugzilla]] and like to suggest a change which fixes it, upload a patch.
+
Diffs, or patches, are text files which include all the changes done in the working copy.  
 +
If you suggest a new feature or like to suggest a change, send a patch to the mailing-list with [PATCH] in the subject.
  
 
To create a diff from the current repository, use the following command:
 
To create a diff from the current repository, use the following command:
  
  svn diff
+
  {{%}} svn diff
  
 
Normally, unlike CVS, you don't have to tell SVN which files you changed; however, you may like to diff only a part of the repository. To do that, specify the files to diff:
 
Normally, unlike CVS, you don't have to tell SVN which files you changed; however, you may like to diff only a part of the repository. To do that, specify the files to diff:
  
  svn diff includes/SpecialMyAwesomePage.php
+
  {{%}} svn diff modules/gui/qt4/qt4.hpp
  
 
Note that SVN defaults to the "unified" diff format, so the "-u" option doesn't have to be passed.
 
Note that SVN defaults to the "unified" diff format, so the "-u" option doesn't have to be passed.
  
 
=== Applying a diff ===
 
=== Applying a diff ===
Subversion does not contain a built in command to apply diffs to the current working copy (for example, to review or commit diffs published in Bugzilla); instead, you can use the regular [[:en:Patch (Unix)|patch]] unix utility:
+
Subversion does not contain a built in command to apply diffs to the current working copy (for example, to review or commit diffs published in Bugzilla); instead, you can use the regular [[wikipedia:patch (Unix)|patch]] unix utility:
  patch -p0 < patch
+
  {{%}} patch -p0 < patch
  
 
TortoiseSVN has a built-in support for applying a diff.
 
TortoiseSVN has a built-in support for applying a diff.
 +
 +
=== .cvsignore / Ignoring files ===
 +
You can ignore some files, using metadata:
 +
{{%}} svn propedit svn:ignore mydirectory
  
 
=== Changing file structure ===
 
=== Changing file structure ===
 +
 +
==== Add a file ====
 
You can add files or folders to the working copy, to be included in the next diff or commit, using the command:
 
You can add files or folders to the working copy, to be included in the next diff or commit, using the command:
  svn add file.name
+
  {{%}} svn add file.name
 +
 
 +
If file.name is a text-based document, you should do
 +
{{%}} svn propset svn:eol-style native file.name
  
 
If you add a folder, it will add all the files included in the folder, except for files in the ignored list.
 
If you add a folder, it will add all the files included in the folder, except for files in the ignored list.
  
 +
==== Delete a file ====
 
You can delete files or folders from the working copy, to be deleted in the next commit or marked as such in the next diff, using the command (which will automatically '''delete''' the files from the working copy, but won't delete folders in such way):
 
You can delete files or folders from the working copy, to be deleted in the next commit or marked as such in the next diff, using the command (which will automatically '''delete''' the files from the working copy, but won't delete folders in such way):
  svn delete file.name
+
  {{%}} svn delete file.name
  
 
Make sure the file or folder do not have local modifications, else they won't be deleted unless you force the deletion.
 
Make sure the file or folder do not have local modifications, else they won't be deleted unless you force the deletion.
 +
 +
==== Move a file ====
 +
You no longer create new files from scratch when moving files!
 +
{{%}} svn mv file1 file2
 +
 +
You can also do it with entire folders.
  
 
=== Reverting your changes ===
 
=== Reverting your changes ===
 
If your changes in the working copy are not useful in your opinion, you can revert them using the following command:
 
If your changes in the working copy are not useful in your opinion, you can revert them using the following command:
  svn revert
+
  {{%}} svn revert
  
 
You must use parameters for this command. To revert all your changes in the working copy, use:
 
You must use parameters for this command. To revert all your changes in the working copy, use:
  svn revert -R .
+
  {{%}} svn revert -R .
  
 
To revert the changes in a specific file, use:
 
To revert the changes in a specific file, use:
  svn revert file.name
+
  {{%}} svn revert file.name
  
 
Reverting can also remove added files (they won't be deleted, just removed and considered "unknown files", just like you didn't use <code>svn add</code> at first), and restore deleted files (both deleted by hand and deleted by <code>svn delete</code>).
 
Reverting can also remove added files (they won't be deleted, just removed and considered "unknown files", just like you didn't use <code>svn add</code> at first), and restore deleted files (both deleted by hand and deleted by <code>svn delete</code>).
Line 93: Line 112:
 
=== Checking the status of the working copy ===
 
=== Checking the status of the working copy ===
 
You can check the status of your working copy using the following command:
 
You can check the status of your working copy using the following command:
  svn status
+
  {{%}} svn status
  
 
These are several important letters in the first column of the item, which show the status:
 
These are several important letters in the first column of the item, which show the status:
Line 101: Line 120:
 
* ? = the item is not under the version control, but exist
 
* ? = the item is not under the version control, but exist
 
* ! = the item is missing (under the version control, but not exist - probably deleted without using <code>svn delete</code>) or incomplete
 
* ! = the item is missing (under the version control, but not exist - probably deleted without using <code>svn delete</code>) or incomplete
 +
 +
=== Checking out specific revision number ===
 +
You can check specific repository revision using following command :
 +
{{%}} svn checkout -r 12345 svn://svn.videolan.org/libdvbpsi/trunk libdvbpsi-trunk
  
 
== Developer use ==
 
== Developer use ==
If you have a write access for the server, you can use an SSH access instead of HTTP access. This might change later.
+
If you have a write access for the server, you can use an SSH access instead of HTTP access.
 
 
=== Create SSH key ===
 
Follow the instructions in [https://sourceforge.net/docs/F02/ Sourceforge] to create an SSH key when requested. Remember the passphrase, keep the private key, and send the public key.
 
 
 
=== URLs ===
 
Replace the server name <code>http://svn.wikimedia.org</code> to <code>svn+ssh://your_user_name@svn.wikimedia.org</code> in all the commands (e.g. svn checkout), then you will be able to use the normal functions, when you will have to enter your passphrase for a functions require web access. Sometimes you will be required to enter your passphrase more than once. If you will make a mistake in the passphrase, you will be requested to type it again.
 
 
 
For example, to check out the latest trunk as an anonymous, you use:
 
svn checkout http://svn.wikimedia.org/svnroot/mediawiki/trunk/phase3 wiki
 
 
 
To check it out as a developer, use:
 
svn checkout svn+ssh://your_user_name@svn.wikimedia.org/svnroot/mediawiki/trunk/phase3 wiki
 
 
 
=== Auto properties ===
 
See [[Subversion/auto-props]] for how to enable automatic line-ending conversion for files you add. Every developer should use it.
 
  
 
=== Commits ===
 
=== Commits ===
 
Commits, or check ins, are the action of applying your changes from the working copy to the web repository. Use the following command to do that:
 
Commits, or check ins, are the action of applying your changes from the working copy to the web repository. Use the following command to do that:
  svn commit
+
  {{%}} svn commit
  
 
Using the command without the parameters will fail, unless you've configured an editor, because you have to enter a comment for the file logs. You can use one of the following forms:
 
Using the command without the parameters will fail, unless you've configured an editor, because you have to enter a comment for the file logs. You can use one of the following forms:
  svn commit --message="This is the log comment."
+
  {{%}} svn commit --message="This is the log comment."
  svn commit --file=file_with_log_comment
+
  {{%}} svn commit --file=file_with_log_comment
 
 
== Converting a CVS checkout to SVN ==
 
Assuming you don't want to keep any local changes to files in the repository, it's easy to just overwrite everything with a fresh checkout. This will keep your local files, such as LocalSettings.php and custom skins.
 
 
 
svn co <nowiki>http://svn.wikimedia.org/svnroot/mediawiki/trunk/phase3</nowiki> temp-checkout
 
rsync -a temp-checkout/ /path/to/phase3/
 
 
 
The following works if you didn't delete any directories:
 
 
 
svn revert -R /path/to/phase3
 
 
 
And if you want to get rid of the old CVS dirs:
 
  
find . -type d -name CVS -print0 | xargs -0r rm -rf
+
=== Other commands ===
  
Be careful with that one. ;)
+
{{%}} svn export
 +
{{%}} svn propedit
  
== See also ==
+
Are documented in the [http://svnbook.red-bean.com/en/1.2/index.html SVN Book] that you should definitively read.
* [[Download from SVN]]
 
  
 
== External links ==
 
== External links ==
* [http://svn.wikimedia.org/viewvc/mediawiki Subversion Web access]
+
* [http://svn.videolan.org Subversion Web access]
 
* [http://svnbook.red-bean.com/en/1.2/index.html Version Control with Subversion] book (SVN version 1.2)
 
* [http://svnbook.red-bean.com/en/1.2/index.html Version Control with Subversion] book (SVN version 1.2)
  
[[Category:MediaWiki Misc]]
+
[[Category:Building]] [[Category:Coding]]

Latest revision as of 07:37, 12 March 2019

This page is obsolete and kept only for historical interest. It may document features that are obsolete, superseded, or irrelevant. Do not rely on the information here being up-to-date.
Replaced with Git

Introduction to SVN

Some VideoLAN's repositories are using Subversion, which is a classical VCS, like CVS. It also provides a better control over the repository compared to CVS.

Note that some project, like VLC media player or x264 are using Git. You can read more about VideoLAN's git repository in our Git wiki page.

Currently the Subversion repositories are discontinued on VideoLAN.

How to use it

To use it, you have to download the official command line Subversion client. You can also use alternative clients, such as the graphical TortoiseSVN for Windows.

When using Cygwin as compilation environment it is recommended to use the SVN package that comes with it (using the Cygwin setup). Using an "external" SVN application might otherwise cause problems with so called DOS versus UNIX "line endings" when creating files.

Subversion's command-line interface is generally pretty similar to CVS. This is a basic and partial guide of the most useful commands. For a complete guide, use the book Version Control with Subversion. If you have a write access to the server, it's very recommended that you read it and know about the advanced features of Subversion, because you might use them sooner or later.

Anonymous use

If you don't have a write access to the repository, you have to access it anonymously, via regular SVN. However, most of the techniques shown here may be useful also for developer use, so please read it even if you don't have to access the server anonymously.

Check out

First, you have to check out the code of libdvbpsi. Use the following syntax:

% svn checkout svn://svn.videolan.org/libdvbpsi/trunk libdvbpsi-trunk

You can browse the code structure using on the SVN webviewer Use the three folders there for different purposes:

  • trunk is the main development branch.
  • The branches are used for stable versions and for the development of complex features.
  • The tags are used to track the released versions.

The URL structure is:

transport 
svn://svn.videolan.org
project repository 
/libdvbpsi
branch/tag 
/trunk, or /branches/0.8.6, or /tags/0.8.5
files 
/README

You can also checkout a portion of the SVN using the URL.

Don't leave off the "trunk" or branch part! If you leave that off you check out every revision of every file in the repo, which is pretty silly.

Projects on VideoLAN's SVN

All projects from VideoLAN SVN are moved to gitlab on code.videolan.org.

Updating the working copy

To update your working copy and get the latest files, use the following command:

% svn update

Note that SVN, unlike CVS, doesn't need to be told to prune removed files or create new directories. This is automagic.

Making a diff

Diffs, or patches, are text files which include all the changes done in the working copy. If you suggest a new feature or like to suggest a change, send a patch to the mailing-list with [PATCH] in the subject.

To create a diff from the current repository, use the following command:

% svn diff

Normally, unlike CVS, you don't have to tell SVN which files you changed; however, you may like to diff only a part of the repository. To do that, specify the files to diff:

% svn diff modules/gui/qt4/qt4.hpp

Note that SVN defaults to the "unified" diff format, so the "-u" option doesn't have to be passed.

Applying a diff

Subversion does not contain a built in command to apply diffs to the current working copy (for example, to review or commit diffs published in Bugzilla); instead, you can use the regular patch unix utility:

% patch -p0 < patch

TortoiseSVN has a built-in support for applying a diff.

.cvsignore / Ignoring files

You can ignore some files, using metadata:

% svn propedit svn:ignore mydirectory

Changing file structure

Add a file

You can add files or folders to the working copy, to be included in the next diff or commit, using the command:

% svn add file.name

If file.name is a text-based document, you should do

% svn propset svn:eol-style native file.name

If you add a folder, it will add all the files included in the folder, except for files in the ignored list.

Delete a file

You can delete files or folders from the working copy, to be deleted in the next commit or marked as such in the next diff, using the command (which will automatically delete the files from the working copy, but won't delete folders in such way):

% svn delete file.name

Make sure the file or folder do not have local modifications, else they won't be deleted unless you force the deletion.

Move a file

You no longer create new files from scratch when moving files!

% svn mv file1 file2

You can also do it with entire folders.

Reverting your changes

If your changes in the working copy are not useful in your opinion, you can revert them using the following command:

% svn revert

You must use parameters for this command. To revert all your changes in the working copy, use:

% svn revert -R .

To revert the changes in a specific file, use:

% svn revert file.name

Reverting can also remove added files (they won't be deleted, just removed and considered "unknown files", just like you didn't use svn add at first), and restore deleted files (both deleted by hand and deleted by svn delete).

Checking the status of the working copy

You can check the status of your working copy using the following command:

% svn status

These are several important letters in the first column of the item, which show the status:

  • M = the item was modified by you
  • A = the item was added by you (using svn add)
  • D = the item was deleted by you (using svn delete)
  •  ? = the item is not under the version control, but exist
  •  ! = the item is missing (under the version control, but not exist - probably deleted without using svn delete) or incomplete

Checking out specific revision number

You can check specific repository revision using following command :

% svn checkout -r 12345 svn://svn.videolan.org/libdvbpsi/trunk libdvbpsi-trunk

Developer use

If you have a write access for the server, you can use an SSH access instead of HTTP access.

Commits

Commits, or check ins, are the action of applying your changes from the working copy to the web repository. Use the following command to do that:

% svn commit

Using the command without the parameters will fail, unless you've configured an editor, because you have to enter a comment for the file logs. You can use one of the following forms:

% svn commit --message="This is the log comment."
% svn commit --file=file_with_log_comment

Other commands

% svn export
% svn propedit

Are documented in the SVN Book that you should definitively read.

External links