Under Linux SVN command Encyclopedia and add email notification to SVN __linux

Source: Internet
Author: User
Tags diff mkdir prev svn svn update perl script

1, checkout the file to the local directory
SVN checkout Path (path is a directory on the server)
For example: SVN checkout Svn://192.168.1.1/pro/domain
Shorthand: SVN Co

2, add new files to the version library
SVN Add File
For example: SVN add test.php (add test.php)
SVN add *.php (Add all php files under current directory)

3, the change of the file submitted to the version of the library
SVN commit-m "LogMessage" [-n] [--no-unlock] PATH (use the –no-unlock switch if you choose to keep the lock)
For example: SVN commit-m "Add test file for my test" test.php
Shorthand: svn ci

4, lock/unlock
SVN lock-m "Lockmessage" [--force] PATH
For example: SVN lock-m "lock test File" test.php
SVN unlock PATH

5. Update to a version
SVN update-r m path
For example:
SVN update If there is no directory behind it, the current directory and all files under the subdirectory are updated to the latest version by default.
SVN update-r test.php (restores the file test.php in the version library to version 200)
SVN update test.php (update, sync with version library). If the prompt expires at the time of submission, it is because of the conflict, you need to update, modify the file, then clear the SVN resolved, and then commit the commit.
Shorthand: SVN up

6. View file or directory status
1 SVN status Path (the state of the files and subdirectories under the directory, not shown in the normal state)
"?: not in the control of SVN; M: Content modified; C: conflict; A: scheduled to join repository; K: Locked
2 svn status-v path (displaying file and subdirectory status)
The first column remains the same, the second column displays the working version number, and the third and fourth columns display the last modified version number and the modified person.
Note: SVN status, SVN diff, and SVN revert these three commands can also be performed without a network, because SVN is local. SVN retains the original copy of the local version.
Shorthand: SVN St

7, delete the file
SVN delete path-m "Delete test Fle"
For example: SVN delete svn://192.168.1.1/pro/domain/test.php-m "Delete test file"
Or simply svn delete test.php and then svn ci-m ' delete test file ', recommend using this
Shorthand: SVN (del, remove, RM)

8, view the log
SVN log path
For example: SVN log test.php shows all the changes to this file, and its version number

9. View File Details
SVN info Path
For example: SVN info test.php

10, compare the difference
SVN diff path (compares the modified file to the base version)
For example: SVN diff test.php
SVN diff-r m:n Path (diff for version M and version N)
For example: SVN diff-r 200:201 test.php
Shorthand: SVN di

11. Merge the differences between the two versions into the current file
SVN merge-r m:n Path
For example, SVN merge-r 200:205 test.php (merges the differences between version 200 and 205 into the current file, but generally conflicts and needs to be addressed)

12, SVN help
SVN help
SVN help CI
——————————————————————————

The above is the common command, below write a few commonly used

——————————————————————————

13, File and directory list under the version library
SVN list Path
Show all files and directories that belong to the version library under the path directory
Shorthand: SVN ls

14. Create a new directory under version control
SVN mkdir: Create a new directory under version control.
Usage: 1, mkdir PATH ...
2, mkdir URL ...
Create a directory for version control.
1. Each directory specified in the working copy PATH will be created on the local side and added
Schedule to be submitted for the next time.
2. Each directory specified as a URL will be created by submitting it immediately to the warehouse.
In both cases, all intermediate directories must exist beforehand.

15. Restore Local Modifications
SVN revert: Restores the original unchanged working copy file (restores most of the local modifications). Revert
Usage: revert PATH ...
Note: The notebook command does not access the network and will remove the conflicting status. But it won't recover.
The deleted directory


16. Code Base URL Change
SVN switch (SW): Updates the working copy to a different URL.
Usage: 1, switch URL [PATH]
2. Switch–relocate from to [PATH ...]

1, update your working copy, map to a new URL, its behavior and "SVN update" is similar, will also
The file on the server is merged with the local file. This corresponds to a branch or tag in the same warehouse where the working copy is
Method.
2, rewrite the working copy of the URL metadata to reflect the simple URL changes. When the root URL of the warehouse changes
(for example, schema name or host name change), but the working copy is still mapped to the same directory in the same warehouse.
This command updates the working copy's correspondence with the warehouse.
My example: SVN switch--relocate http://59.41.99.254/mytt Http://www.mysvn.com/mytt

17. Conflict Resolution
SVN resolved: Removes the conflicting state of a working copy's directory or file.
Usage: Resolved PATH ...
Note: The notebook command does not resolve the conflict according to syntax or remove the conflict token; it simply removes the conflicting
Related files, and then allow PATH to be submitted again.

18, output the contents of the specified file or URL.
SVN cat Target [@ VERSION] ... If a version is specified, the lookup is started from the specified version.
SVN cat-r PREV filename > filename (PREV is the previous version, can also write specific version number, so that the output can be submitted)

19, Find all legacy log files in a working copy, delete locks in a process .

When subversion changes your working copy (or. Any information in SVN, it will be as careful as possible, before modifying anything, it writes intent to the log file, executes the command in log file, and deletes the log file, which is similar to the file system architecture of the ledger. If the subversion operation is interrupted (for example: The process is killed, the machine dies), the log file is saved on the hard disk, and by the time the log file is rerun, subversion can do the last operation and your work copy can return to a consistent state.

This is what svn cleanup does: It looks for all the remaining log files in the working copy and deletes the locks in the process. If subversion tells you that a part of your work copy has been "locked", you need to run the command. Similarly,SVN status will use L to display locked items:

$ SVN status
L Somedir
M

$ svn cleanup
$ SVN status
M somedir/foo.c

20, Copy the user's version of an unpublished directory tree to the repository.

SVN import a command is the fastest way to copy a versioned directory tree from a user to a repository, and it also creates mediation files if needed.

$ svnadmin Create/usr/local/svn/newrepos $ svn import mytree file:///usr/local/svn/newrepos/some/project adding mytree/ FOO.C adding mytree/bar.c adding Mytree/subdir adding mytree/subdir/quux.h committed Revision 1.

In the previous example, you will copy the directory mytree to the some/project of the version library:

$ svn list file:///usr/local/svn/newrepos/some/project bar.c foo.c subdir/

Note that after the import, the original tree has not been converted to a working copy, and in order to get started, you still need to run svn checkout to export a working copy.

Additional: Email notification for SVN
You can add the mailing list feature to SVN by using the Subversion hook script
After the subversion has been installed in the source code under the tools have a comm-email.pl perl script, in your file directory has a hooks directory, into the hooks directory to Post-commit.tmpl Change the name to Post-commit and give it permission to execute.
Change the Post-commit script to add the comm-email.pl to the script, or SVN could not find the comm-email.pl

Repos= "$"
rev= "$"
/usr/local/svn/resp/commit-email.pl "$REPOS" "$REV" email@address1.com email@address2.com
#log-commit.py--repository "$REPOS"--revision "$REV"

The last line is for logging. I didn't use this function, so I commented out.

SVN tips:

1. View only code that has been modified

SVN st-q

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.