wiki:pm-svn-cmds

Version 4 (modified by andreasw, 14 years ago) (diff)

intermediate save

Basic Subversion Commands

Below we list the subversion command line commands that a typical developer has to know about. Online help is available using svn help. A detailed description of each command can be found in the "Subversion Complete Reference" chapter of the subversion book, at http://svnbook.red-bean.com/nightly/en/svn.ref.html

svn help

Lists all available svn commands. Help for a specific command cmd can be obtained with svn help cmd.

svn checkout (short form: svn co)

Checks out a directory plus all subdirectories from a subversion repository. The COIN repositories are available from the URL https://www.coin-or.org/svn. For each COIN package, say Pkg, you obtain everything in the package (including all branches and tags) by specifying "svn co https://www.coin-or.org/svn/Pkg/"; if you only want a part of the code, such as the current official release (by convention in the subdirecory {{{trunk, you type svn co https://www.coin-or.org/svn/Pkg/trunk. Usually, you should specify the target directory where you want your local copy of the code to be stored (such as Coin-Pkg). If the target directory is omitted, the source code will be installed in a subdirectory with the name of the last directory in the URL, i.e., trunk in the example above.

If you want to specify a specific revision that you want to check out, you can do this using the -r N flag, where N is the revision number.

By default, svn checkout will download files from other subversion repositories, if svn externals are defined for directories in the specified URL, and will recurse to further locations if externals are defined there. If you don't want to download any externals, specify the --ignore-externals flag.

The COIN svn repository is set up in a way, so that everybody can download files, without having to provide a password. You will have to provide your id and password once, if you want to do a write action, such as svn submit.

svn update (short form: svn up)

Updates the local copy to the current version of the current directory and subdirectories, or of a specific directory, if this directory is given as argument (e.g., svn up subdir). If you have made changes in your local copy, subversion will try to merge the difference between the previously checked-out version and the new one. If it has trouble doing that, it will notify you of a conflict. You should then have a look at the files for which a conflict occured and fix it; the location of a conflict is marked by <<< and >>> strings. It is important that you resolve the conflict, either by using svn resolved or svn revert, because you will otherwise not be able to commit your changes.

The -r N flag allows you to update your local copy to a specific revision number (N). To avoid recursion into subdirectories during the update, use the -N flag. The --ignore-externals flags tells subversion to ignore the externals.

svn status (short form: svn st)

If you want to find out the status of the files in your local copy, you use this command. This will tell you, which files and directories in your local copy have local modifications, which files are marked for addition or deletion, etc. To see a list of the symbol that show up for the files, type "svn help status", or look read about it in the subversion book.

svn commit (short form: svn ci)

This command it used to commit your local modifications to the subversion repository. If add enter a file or directory name as argument, only the files or the directory (and everything below it) will be committed. If you omit this argument, the current directory and everything below it will be submitted. To suppress the recursion into subdirectories, you can specify the -N flag.

You should enter a message that describe the changes that you made, so that later on you can see in the subversion history what has been going on. You can enter the message on the command line, using the "-m" flag, followed by the message (in quotes). If you omit the -m flag, you default editor will open for you to enter the message.

Note: For most COIN packages, we use subversion externals to obtain dependencies. The commit command does not automatically recurse into externals; therefore, you have to do a commit by hand. Make sure you are not committing code to an external with a specified version number in the externals definition'''

svn diff (short form: svn di)

To see the details of local modifications in your working copy, you use this command. You can specify a file or directory name as argument, to narrow down, which modifications you want to have shown. Again, the -N flag can be used to suppress recursion into subdirectories. You can also see the differences of your local copy with respect to a particular revision in the repositry, by using the "-r N" flag, where N is the specific revision number.

svn revert

If you want to restore the current version in the repository and undo your local modifications, you use this command. By default, it reverts the modifications only made to a file or directory given to the command as argument; if the argument is omitted, only the current directory is reverted. If you want to revert more than just one file or directory, you can use the "-R" to enable the recursive action of the command.

svn resolved

This command is necessary to tell subversion that you resolved a conflict that occured earlier during an update or a merge. Unless you resolve those conflicts, you will not be able to commit local changes of the files and directories, for which the conflict occurred. A conflict is also resolve automatically, if you use the revert command.

svn add

You use this command to add new files and directories to the repository. You need to give subversion the name of the file or directory as argument. Note that the command acts recursively on directories, unless you use the "-N" flag.

svn remove (short form: svn rm)

svn copy (short form: svn cp)

svn mkdir

svn merge

svn export

svn proplist (short form: svn plist)

svn propget (short form: svn pget)

svn propset (short form: svn pset)

svn propdel (short form: svn pdel)