How to use Ubuntu under SVN guide

Source: Internet
Author: User
Tags create directory diff subversion client svn update

How to use Ubuntu under SVN guide

Install Subversion client under Ubuntu:

sudo apt-get install subversion subversion-tools

For details, see http://www.subversion.org.cn/svnbook/1.1/index.html SVN subcommand

1. Check out

SVN CO/HTTPPath (full path to directory or file) [local directory full path]--usernameUser name--password passwordSVN co svn://Path (full path to directory or file) [local directory full path]--usernameUser name--password password
SVN checkout/HTTPPath (full path to directory or file) [local directory full path]--usernameUser name
svn checkout svn://Path (full path to directory or file) [local directory full path]--usernameUser name
Note: If you do not transfer the password with the--password parameter, you will be prompted to enter the password, it is recommended not to use the Clear text--password option.
Among them username and password before is two short-term, not one.
Does not specify a local directory full path, it is checked out to the current directory.
Example:
SVN co svn://192.168.0.3/Test Tools/home/testtools --username wzhnsc
SVN CO/HTTP192.168.0.3/test/testapp--username WZHNSC
svn checkout svn://192.168.0.3/Test Tools/home/testtools --username wzhnsc
SVNCheckout/ http192.168.0.3/test/testapp --username wzhnsc

2. Export (
Export a clean directory tree without the. SVN folder)
SVN export [-R version number]/HTTP path (full path to directory or file) [local directory full path]--username user name
SVN export [-R version number] svn://path (full path to directory or file) [local directory full path]--username user name
SVN export locally checked out (i.e. with. SVN folder) directory full path to export local directory full path
Note: The first way to export a clean working directory tree from the repository is to specify the URL,
If a revision number is specified, the corresponding version is exported.
If no revision is specified, the latest export is exported to the specified location.
If omitted
Local Directory full path, the last part of the URL is the name of the local directory.
The second form is to specify the local checked-out directory full path to the local directory full path to be exported, and all local modifications will be preserved.
However, files that are not under version control (that is, new files that are not submitted because the. SVN folder does not have information records associated with it) are not copied.
Example:
SVNExportsvn://192.168.0.3/Test Tools/home/testtools --username wzhnsc
SVNExport/ http192.168.0.3/test/testapp --username wzhnsc
SVNExport/home/TestApp/home/testtools

3.
Add a new file
SVN addFilename
Note: Tell SVN server to add files, but also use SVN commint-m real upload up!
Example:
SVN addtest.php<-Add test.php
SVN commit-m"Add my test with test.php" test.php
SVN add*.php<-Add all PHP files in the current directory
SVN commit-m"Add my test with all PHP files" *.php

4.
Submit
SVN commit-m"Submit Notes Information text"[-n] [--no-unlock]Filename
svn ci- M"Submit Notes Information text"[-n] [--no-unlock]Filename
Must be taken with the-m parameter, the argument can be empty, but must be written on-m
Example:
SVN commit-m"Submit all files under version control in the current directory" *<-Note This * indicates all files
SVN commit-m"Submit my Test with test.php" test.php
SVN commit-m"Submit my Test with test.php"- N--no-unlocktest.php<-Keep the lock on and use the –no-unlock switch.
SVN ci-m"Submit all files under version control in the current directory" *<-Note This * indicates all files
SVN ci-m"Submit my Test with test.php" test.php
SVN ci-m"Submit my Test with test.php"- N--no-unlocktest.php<-Keep the lock on and use the –no-unlock switch.

5.
update File
SVN update
SVN update-r
Fix version file name
SVN updateFilename
Example:
SVN updatethere is no directory behind <-, and all files under the current directory and subdirectories are updated to the latest version by default
SVN update-rTest.cpp<-restore a file from the repository to a test.cpp version (revision) 200
SVN updatetest.php<-the update synchronizes with the repository.
Prompt for expiration conflict when submitting, need update to modify file first,
Then remove the SVN resolved and commit the commit again.

6.
Deleting Files
SVN Delete svn://Path (full path to directory or file)- M"Delete Note Information text"
The following actions are recommended:
SVN Delete Filename
SVN ci-m "Delete Note Information text"
Example:
SVN Delete svn://192.168.1.1/testapp/test.php- M"Delete test file test.php"
The following actions are recommended:
SVN Deletetest.php
SVN ci-m"Delete test file test.php"

7.Locking/Unlock
SVN lock-m"Lock Note Information text"[--force]Filename
svn unlockFilename
Example:
SVN lock-m"Lock letter Test with test.php file" test.php
svn unlocktest.php

8.
Compare Differences
SVN diffFilename
SVN diff-rFixed version number M:Fixed version number n Filename
Example:
SVN difftest.php<-Compare the modified file to the base version
SVN diff-r200:201 test.php<-Difference between revision number 200 and revision number 201

9.
view file or directory status
SVN StDirectory Path/Name
SVN statusDirectory Path/Name<-Status of files and subdirectories under directory, normal status not displayed
"?: not in SVN control; M: Content has been modified; C: conflict;
A: To be added to the repository; K: Locked
svn-vDirectory Path/Name
SVN status-vDirectory Path/Name<-displaying file and subdirectory status
"The first column remains the same, the second column shows the work version number,
The third and fourth columns show the last modified version number and the modified person "
Note: The SVN status, SVN diff, and SVN revert three commands can be executed without a network,
The reason is that SVN retains the original copy of the local version in the Local. SVN.

10.View Logs
SVN logFilename
Example:
SVN logtest.php<-Shows all changes to the file, and its version number

11.View File Details
SVN infoFilename
Example:
SVN infotest.php

12.SVN Help
SVN Help<-All features Options
SVN HelpCi<-Description of specific functions

13.view a list of files and directories under the repository
SVN listsvn://Path (full path to directory or file)
SVN lssvn://Path (full path to directory or file)
Example:
SVN list svn://192.168.0.3/test
svn ls svn://192.168.0.3/test<-Showsvn://All files and directories in the 192.168.0.3/test directory that are part of the repository

14.to create a new catalog under the included version control
SVN mkdirDirectory Name
SVN mkdir-m"New Directory Notes text"/ httpDirectory full path
Example:
SVN mkdirNewdir
SVN mkdir-m"Making a new dir."/ http192.168.0.3/test/newdir
Note: After adding subdirectories, be sure to go back to the root directory update, or the file will be submitted in this directory would prompt "commit failed"
SVN update
Note: If you create a new folder Newsubdir manually in the checkout directory,
Re-useSVN mkdirAfter the Newsubdir command, SVN will prompt:
SVN: Try using "svn add" or "svn add--non-recursive" instead?
SVN: Unable to create directory "Hello": File already exists
At this point, use the following command to resolve:
   svn add--non-recursiveNewsubdir
When you enter this Newsubdir folder, you can see all the directories and files below it with ls-a:. SVN directory
Then use the SVN mkdir-m "Add Hello Function module file" Svn://192.168.0.3/test/newdir/newsubdir command,
SVN tip:
Svn:file already Exists:filesystem '/data/svnroot/test/db ', transaction ' 4541-1 ',
Path '/newdir/newsubdir '

15. Restore Local Modifications
svn revert[--recursive]file name
Note: The notebook command will not access the network and will release the conflicting condition. However, it does not restore the deleted directory.
Example:
svn revertFoo.c<-Discard changes to a file
svn revert--recursive.<-Restore a whole directory of files,. For the current directory

16. Update the work copy to another URL
SVN switch/HTTP /Directory full path local directory full path
Example:
SVN switch/HTTP /192.163.0.3/test/456.<-(formerly 123 Branch) is currently located in the directory branch to192.163.0.3/test/456

17. Conflict Resolution
SVN resolved[Local directory full path]
Example:
$ SVN update
C foo.c
Updated to revision 31.
If you get a conflict during the update, your working copy will generate three new files:
$ ls
Foo.c
Foo.c.mine
Foo.c.r30
Foo.c.r31
When you have resolved the FOO.C conflict and are ready to submit, run SVN resolved and let your working copy know that you have done everything.
You can just delete the conflicting files and commit, but SVN resolved in addition to deleting the conflicting files, and also fixed some records in the work copy management area of the record data, so we recommend you use this command.

18, not checkout and view the content of the output specific file or URL
SVN cat/HTTPFile full path
Example:
SVN cat/HTTP192.168.0.3/test/readme.txt


SVN usage Guide under Ubuntu

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.