Download, submit, update, view, copy, and import project code from the SVN server in linux

Source: Internet
Author: User
Tags commit mkdir php file svn svn client svn update

For details about the svn client command svn in linux, you can use-help to view the specific usage. The most common commands are checkout (co), commit (ci), update (up), and list (ls). These commands are very important, in the future, shell or other scripts are required for automation. The help content is as follows:

[Root @ servermanager svndata] # svn -- help
Usage: svn subcommond [options] [args]
Subversion command-line client, version 1.7.14.
Type 'svn help' for help on a specific subcommand.
Available subcommands:
Add
Blame (praise, annotate, ann)
Cat
Changelist (cl)
Checkout (co)
Cleanup
Commit (ci)
Copy (cp)
Delete (del, remove, rm)
Diff (di)
Export
Help (?, H)
Import
Info
List (ls)
Lock
Log
Merge
Mergeinfo
Mkdir
Move (mv, rename, ren)
Patch
Propdel (pdel, pd)
Propedit (pedit, pe)
Propget (pget, pg)
Proplist (plist, pl)
Propset (pset, ps)
Relocate
Resolve
Resolved
Revert
Status (stat, st)
Switch (sw)
Unlock
Update (up)
Upgrade
 
Subversion is a tool for version control.
For additional information, see http://subversion.apache.org/
The svn command format is as follows:
Svn subcommond [options] [args] its subcommands are shown as above. Here are some examples to illustrate.
1. Download data from the svn server to the local server.

[Root @ servermanager svndata] # svn co svn: // 59.46.xx.xx/demo/data/svndata -- username = 21 yunwei -- password = xxxxxx
 
-----------------------------------------------------------------------
ATTENTION! Your password for authentication realm:
 
& Lt; svn: // 59.46.80.248: 3690 & gt; 2d5821a4-0759-41c1-95b7-251f2fbabe15
 
Can only be stored to disk unencrypted! You are advised to configure
Your system so that Subversion can store passwords encrypted, if
Possible. See the documentation for details.
 
You can avoid future appearances of this warning by setting the value
Of the 'store-plaintext-password' option to either 'yes' or 'no' in
'/Root/. subversion/servers '.
-----------------------------------------------------------------------
Store password unencrypted (yes/no )? Yes
A test
A alltask. bat
A alltask. vbs
A addtest.txt
A backup. bat
Checked out revision 9.
[Root @ servermanager svndata] # ll
Total 32
-Rw-r --. 1 root 0 Aug 29 addtest.txt
-Rw-r --. 1 root 8 Aug 29 alltask. bat
-Rw-r --. 1 root 20671 Aug 29 alltask. vbs
-Rw-r --. 1 root 8 Aug 29 backup. bat
Drwxr-xr-x. 2 root 6 Aug 29 test
2. The linux client submits data to the svn server.
Create a svnlinux. Php file and submit it to the svn server.

[Root @ servermanager svndata] # vim svnlinux. php
[Root @ servermanager svndata] # svn add svnlinux. php
A svnlinux. php
[Root @ servermanager svndata] # svn ci-m "svn data add test"
Adding svnlinux. php
Transmitting file data.
Committed revision 17.
After submission, we can use TortoiseSVN to view the updates:
1
Submitted and updated successfully.

3. Update data from the svn server to the local server.

[Root @ servermanager svndata] # svn update svn: // 59.46.xx.xx/demo/data/svndata -- username = 21 yunwei -- password = xxxxxx
Skipped 'svn: // 59.46.80.248/sadoc'
A/home/svndata/testlinux
Updated to revision 14.
Summary of conflicts:
Skipped paths: 1
Of course, you can also copy data locally from svn on the local server:

[Root @ niaoyun43442 home] # svn co file: // application/svndata/sadoc/
A sadoc/test
A sadoc/testlinux
A sadoc/alltask. bat
A sadoc/alltask. vbs
A sadoc/addtest.txt
A sadoc/backup. bat
A sadoc/21yunweitest. jnt
A sadoc/addtest-subscript .txt
Checked out revision 15.
 
[Root @ niaoyun43442 home] # ll demo/
Total 48
-Rw-r -- 1 root 4544 Aug 30 08:12 21yunweitest. jnt
-Rw-r -- 1 root 0 Aug 30 08:12 addtest.txt
-Rw-r -- 1 root 0 Aug 30 08:12 addtest-subscript .txt
-Rw-r -- 1 root 8 Aug 30 08:12 alltask. bat
-Rw-r -- 1 root 20671 Aug 30 08:12 alltask. vbs
-Rw-r -- 1 root 8 Aug 30 08:12 backup. bat
Drwxr-xr-x 3 root 4096 Aug 30 test
Drwxr-xr-x 3 root 4096 Aug 30 testlinux
4. View the svn server content from the client and how to view the specified file content

[Root @ servermanager svndata] # svn ls svn: // 59.46.xx.xx/demo
21yunweitest. jnt
Addtest-subscript .txt
Addtest.txt
Alltask. bat
Alltask. vbs
Backup. bat
Test/
Testlinux/
Addtest.txt
Alltask. bat
Alltask. vbs
[Root @ servermanager svndata] # svn cat svn: // 59.46.xx.xx/demo/addtest.txt
Hello svn, add test.
Note: If you want to view detailed file attributes, you can add the parameter-verbose to display the following:

[Root @ servermanager svndata] # svn ls svn: // 59.46.xx.xx/demo -- verbose
16 21 yunwei Aug 30 ./
15 21 yunwei 4544 Aug 30 21yunweitest. jnt
16 21 yunwei 9 Aug 30 08:26 addtest.txt
16 21 yunwei 9 Aug 30 08:26 addtest.txt. bak
8 21 yunwei 8 Aug 30 08:11 alltask. bat
6 21 yunwei 20671 Aug 30 alltask. vbs
9 21 yunwei 8 Aug 30 backup. bat
9 21 yunwei Aug 30 08:12 test/
14 21 yunwei Aug 30 08:07 testlinux/
 
5. How to import project data from the client to the SVN server version Library Project

First, create a project directory and upload some data:

[Root @ servermanager svndata] # mkdir-p/home/svndata/{trunk, branch, tag}
Create a new project 21yunweinew and import the data directory to the version Library:

[Root @ servermanager svndata] # svnadmin create/svndata/21 yunweinew
[Root @ servermanager svndata] # svn import/home/svndata/file: // svndata/21 yunweinew/-m "import project discuz"
Adding/home/svndata/trunk
Adding/home/svndata/tag
Adding/home/svndata/branch
The project is imported successfully.
1

6. How to copy a version library from the client to another version library project on the SVN server

[Root @ servermanager 21 yunweinew] # svn copy svn: // 59.46.xx.xx/21 yunweinew/trunk svn: // 59.46.xx.xx/21 yunweinew/branch/branch_21yunwei_20160830-m "cp 21 yunweinew trunk to branch" -- username = 21 yunwei -- password = xxxxxx
Successfully copied Committed revision 3.
Use a tool to synchronize data to a local device:

1
Of course, there are some delete operations in the back, and so on. Here we will not demonstrate them one by one. You can perform the test on your own.

Related Article

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.