SVN command line

Source: Internet
Author: User
Tags diff patch svn update

SVN operation:

1. if the local default Lang environment variable is zh_CN.UTF-8, the generated patch contains the "version number", so that uploading the patch on the review board will fail due to format problems, it is best to set Lang to English, export lang = "en_US.UTF-8"

2. SVN patch Problems

SVN diff> trip_refactor01_review.diff
Patch-P1 <trip_refactor01_review.diff

Can't find file to patch at input line 5
Perhaps you used the wrong-P or -- strip option?
The text leading up to this was:
--------------------------
| Index: src/TR/COM/daodao/CMS/daodaotripgraphicsparamstore. Java
| ================================================ ======================================
| --- Src/TR/COM/daodao/CMS/daodaotripgraphicsparamstore. Java (Revision 7406)
| ++ Src/TR/COM/daodao/CMS/daodaotripgraphicsparamstore. Java (working copy)
--------------------------
File to patch:

.....

By default, the diff generated by SVN is P0, and the-P0 option needs to find src/TR/COM/daodao/CMS/from the current directory /......
So the correct patch command for diff generated by SVN: patch-P0 <trip_refactor01_review.diff

The-P1 option is required when git generates diff patch.
View the patch to see the difference
SVN patch:
Index: src/TR/COM/daodao/CMS/daodaotripgraphicsparamstore. Java
========================================================== ======================================
--- Src/TR/COM/daodao/CMS/daodaotripgraphicsparamstore. Java (Revision 7406)
++ Src/TR/COM/daodao/CMS/daodaotripgraphicsparamstore. Java (working copy)

Patch generated by git:
Index 0335ea1... 1031223 100644
--- A/src/TR/COM/daodao/CMS/daodaotripgraphicsparamstore. Java
++ B/src/TR/COM/daodao/CMS/daodaotripgraphicsparamstore. Java

Therefore, the GIT patch requires-P1 to remove a/, B/from the front on SVN, so that src/... will be found in the current directory /......

Report the reversed (or previusly applied) patch detected during the patch process! Assume-r?
The fastest solution: Direct CP coverage

3. SVN command to generate DIFF:
SVN diff has three different usage methods:

Check local SVN diff Modification
Compare the working copy with the version library SVN. Real diff-r 7160 file1 [file2..]
Compare the version library with the version library SVN diff-r7406: 7407 file1 [file2...] to see which changes have been made in version 7407 compared with version 7406

4. The local code is updated to a specific version, but the code in the code library is not rolled back.
SVN Upate R 7406

5. SVN repository code rollback
Many people use VPs as a Subversion server to manage code. In subversion, how does one cancel an error check in? SVN merge is generally used to achieve the goal. For example, if we have a wrong checkin, we want to roll back to the correct version. First, make sure that we get the latest code and run SVN update, which is assumed to be version 28. Find the exact version to undo:

SVN log contacts. Java

According to the log, it is suspected that version 27 has been changed. For a comparison, see:

SVN diff-r 26:27 contacts. Java

It was found that version 27 was a bad thing. Revoke changes to version 27:

SVN merge-r 27:26 contacts. Java

For the sake of insurance, confirm the merger result again:

SVN diff contacts. Java

The change has been correctly revoked and submitted. Submit changes

SVN commit-M "revert wrong change from r27"

The submitted version is changed to 29.

6. The main difference between SVN checkout and SVN export is that the former has version control. Checkout is used to check the code of the remote repository to the local device. A little like git clone

7. After the svn patch is completed, you can use SVN revert file1, file2 or SVN revert directory1. in addition to the patch-R. 8. The meaning of the header in SVN status:
U: indicates that the file has been updated on the slave server.
G: indicates that the local files and server files have been updated and merged successfully.
Others are as follows:
A: a file or directory is added to the working directory.
R: indicates that the file or directory has been replaced.
C: indicates that the local modification of the file conflicts with the modification on the server.
9. View SVN server information through the command line: SVN info is obtained through SVN checkout URL at first. Reference: SVN basic instructions

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.