Friday, November 5, 2010

Useful SVN commands

svn add
svn add - Add files and directories to your working copy and schedule them for addition to the repository. They will be uploaded and added to the repository on your next commit.
svn add --non-recursive testDir - You can add a directory without adding its contents 
svn add * --force - If you want to add every unversioned object in your working copy

svn update 
svn up | svn update - Update your working copy.
svn up -r8000 update your working copy to an older revision (revision 8000)

svn checkout
svn co | svn checkout -  Check out a working copy from a repository.
svn co https://wso2.org/repos/wso2

svn delete
svn del | svn delete - Delete an item from a working copy or the repository.
svn del testDir

svn mkdir
svn mkdir Create a new directory under version control.
svn mkdir testDir

svn commit
svn ci | svn commit - Send changes from your working copy to the repository.
svn ci -m "Added new functionality." 

svn move 
svn move | svn mv — Move a file or directory
$svn mv parentDir/test.txt parentDir/subDir
A         parentDir/subDir/test.txt
D         parentDir/test.txt


svn cleanup
svn cleanup - Recursively clean up the working copy, removing locks resuming unfinished operations. If you ever get a “working copy locked” error, run this command to remove stale locks and get your working copy into a usable state again.

svn blame 
svn blame — Show author and revision information in-line for the specified files or URLs. (This is only for files)
As an example 

svn blame https://wso2.org/repos/wso2/trunk/carbon/core/samples/pom.xml


 15686    saminda <project xmlns="http://maven.apache.org">
 15686    saminda     <parent>
 15686    saminda         <groupId>org.wso2.carbon</groupId>
 15686    saminda         <artifactId>carbon-parent</artifactId>
 72444    ruwan         <version>3.1.0-SNAPSHOT</version>
 15686    saminda     </parent>
 15686    ruwan     <modelVersion>4.0.0</modelVersion>
 15686    saminda     <artifactId>samples</artifactId>
 15686    saminda     <packaging>pom</packaging>
 15686    saminda     <name>samples</name>
 15686    saminda     <description>samples</description>
 15686    saminda     <url>http://wso2.org</url>
 15686    saminda     <modules>
 15687    saminda         <module>org.wso2.carbon.sample</module>
 15686    saminda     </modules>
 15686    saminda </project>

svn diff
svn diff - Display the differences between two paths.
svn diff trunkDir - Compare repository and your working copy.
svn diff  -r 3900 trunkDir - working copy's modifications compare against an older revision
svn diff https://wso2.org/repos/wso2/trunk/carbon/pom.xml@3000  https://wso2.org/repos/wso2/trunk/carbon/pom.xml@3010 - Compare revision 3000 to revision 3010 using “@” syntax

svn cat
svn cat -  Output the contents of the specified files or URLs.
$svn cat https://wso2.org/repos/wso2/trunk/test/readme.txt - you can view readme.txt in your repository without checking it out

svn log
svn log - Display commit log messages.
svn log - sample log is shown below.

------------------------------------------------------------------------
r121 | pradeeban | 2010-10-17 01:13:37 +0530 (Sun, 17 Oct 2010) | 2 lines
Applying the patch for ARCHITECTURE-25 provided by kasunw. BPS loan approval demo was added with necessary documentation with minor change to Account Service client, in this patch. 
------------------------------------------------------------------------
r119 | lahiru | 2010-10-16 23:09:01 +0530 (Sat, 16 Oct 2010) | 2 lines
applying patch from kasun for https://wso2.org/jira/secure/ManageAttachments.jspa?id=25441.
------------------------------------------------------------------------
r118 | lahiru | 2010-10-16 23:07:56 +0530 (Sat, 16 Oct 2010) | 2 lines
applying patch from kasun.
------------------------------------------------------------------------
r117 | lahiru | 2010-10-16 22:42:04 +0530 (Sat, 16 Oct 2010) | 2 lines
adding patch given by kasun.
------------------------------------------------------------------------
r116 | kasunw | 2010-10-15 00:44:58 +0530 (Fri, 15 Oct 2010) | 2 lines
changes to platform demo, using carbon studio, and minor feature adding like automating using ant.

svn revert
svn revert - Undo all local edits.
svn revert foo.java 
svn revert testDir --recursive - If you want to revert a whole directory of files, use the --recursive flag.

svn resolved
svn resolved - Once you've resolved the conflict, run svn resolved to let your working copy know you've taken care of everything

svn list
svn list - List directory entries in the repository.
svn list https://wso2.org/repos/wso2/trunk/carbon
components/
core/
dependencies/
features/
orbit/
pom.xml
products/


No comments: