Quantcast
Channel: Adamlu's Blog
Viewing all articles
Browse latest Browse all 10

Subversion Basics

$
0
0

 

Subversion Basics

In order to use these commands the following lines need to be added to /etc/bashrc on the machine that will access the repository:
export svnroot=svn+ssh://cvs.msc.tamu.edu/home/svn
export SVN_SSH="ssh -l $USER"

If you are intending to operate as root use su instead of su -

Common svn commands

Command Action
svn co $svnroot/project/trunk targetdir Checks out the trunk of the project into the targetdir.
also checkout
svn ci [filename] Commit the changes to the working copy or filename. VIM will be launched allowing you to enter a meaningful log message.
also commit
svn up Bring the current working copy up-to-date with the repository. Merges any changes in the repository with the working copy.
svn resolved Sometimes a merge or update will have a conflict. Files will be produced which share part of the filename with the conflicted file. Use those files and information inserted into the conflicted file to put the file in a workable state and use this command to let subversion know you fixed the problem. Then commit.
svn merge -rBASE:PREV [target] Reverts target back to the previous revision in a way that may be committed. PREV may be any previous revision number. This is only one small use of the merge command. See the next command for a more efficient operation.
svn cp -r489 $svnroot/project/trunk/target ./target Copies the target file or directory to the working copy with history from revision 489.
svn st Check the status of the working copy
also stat, status
svn diff [filename] Displays an inline diff of all the modifications to the working copy or to filename.
also di
svn revert target [target] Reverts targets back to a pristine copy of the repository. target may be . * or any filename.
svn cp file newfile Make a (cheap) copy of file.
also copy
svn mv file newfile Move or rename file to newfile.
also move, ren, rename
svn cp $svnroot/project/trunk $svnroot/project/tags/1.0

svn cp . $svnroot/project/tags/1.0

Tag version 1.0 of the project
1) from the current revision of the trunk.
2) from the current working copy.
In both cases the wc will not point to the new tag. (see svn sw)
svn cp $svnroot/project/trunk $svnroot/project/branches/experimental Branch the current revision of the trunk into the experimental branch.
The working copy will not point to the new branch. (see svn sw)
svn sw $svnroot/project/branches/experimental Switches the working copy to the experimental branch.
svn export $svnroot/project/tags/1.0 product Put a pristine copy of version 1.0 without administrative directories (no committing) into the product directory.

External Scripts

Command Action
svnchangesince Displays the log messages of all the changes to the repository since your last update
svnlastlog Displays the last log message that pertains to the current working copy.
svnlastchange Displays the last log message and a unified diff of the changes made in the last commit
svn-clean Removes all the files and directories that are not in Subversion

通过Subversion Basics.



Viewing all articles
Browse latest Browse all 10

Trending Articles