Routine SVN usage skills and VIM profile configuration

Source: Internet
Author: User
Tags svn update superuser permission

Although there are many SVN clients for visual management of SVN, such as small turtles in Windows, it is very good. However, it is not very convenient or convenient to use.

In Linux or Mac, the combination of SVN and Linux Command lines can play a very powerful role, efficient and fast.

1. Many times we use SVN checkout to put a directory in our own project on the Internet, or copy a directory in another project (managed by SVN) to the existing Directory.

A conflict is prompted during the (SVN add)/(svn ci) process. The reason is that each directory managed by SVN contains a. SVN directory to manage the files in this directory, where there is an entries file,

It contains the corresponding directory file information, version number, and SVN server address information. If you do not know the svn server from which the current directory file is checked, you can view the file.

The above message indicates a conflict because the. SVN directory indicates that the files in the current directory are not in the current project during the update submission of the outer layer. The solution is to delete the. SVN directory in this directory.

Rm-RF. SVN. We recommend that you use multiple directories.Find.-Name. SVN | xargs Rm-RFDelete the. SVN folder in all directories under the current directory. If permission issues occur,

AvailableSudo Find.-Name. SVN | xargs Rm-RFObtain the superuser permission to delete it. Then, use SVN add again to submit the update normally.

2. Add a file or directory to SVN version control.

Mkdir testsvnsvn add testsvnsvn CI testsvn.-M "add testsvn" #### note-M "must be added; otherwise, the submission fails (Linux)

To add a file/directory, commit (svn ci) is required to be submitted to the server. SVN add puts the file in an intermediate state. In xcode, QT creator, and other tools, you can clearly see that there is a "A" in front of the file ", after svn ci, it is successfully added to SVN version control.

3.SVN cleanup

Many times, when we use SVN update, the network speed may be slow, SVN update is not executed, and CTRL + C is used to send a signal to forcibly terminate it. When SVN update is used again, the prompt is that the folder is locked. To this extent, you can use SVN cleanup to solve the problem. Then there will be no problem in SVN update.

4. view the Update log of the current directory

SVN log. ### view the update logsvn log file in the current directory ### view the Update log of the file File

In this way, you can clearly see the update history of a file and a brief description of the update. This gives you a general understanding of file changes.

However, when usingSvn ci.-M "this is a test commit"After submitting the file, you can immediately use SVN log to view the log of the current directory. You must use SVN update to update the file.

5. Conflict Resolution

Under normal circumstances, before programming every day, it is best to use SVN update to ensure that your code is up-to-date. Every time you complete a small function, after testing, the code must be committed to the server in a timely manner. To reduce conflicts. However, in projects developed by many people, conflicts are inevitable. Before submitting a file, SVN update is required to update the current file. When a conflict occurs, you can use the merge method or the Code of another person or your own code to solve the conflict (when a conflict occurs, the terminal will prompt you how to proceed ). Of course, for a single conflicting file, you can also use SVN diff FILENAME>/tmp/1 to view the differences between the file and the server. After modification, submit the file.

We also recommend a vi-D file1 file2 command. This command can open two files at the same time, one on the left and one on the right, and highlight them at the same time, so that you can easily see the differences between the two files. It is very helpful for checking for conflicts.

6. Ignore the modification/restoration of the file to the specified version on SVN.

SVN revert filename### Discard changes to the current file

SVN Update-R 500### Restore to the state when the reversion is 500. If a file name is added, a file is restored to the specified reversion state.

7. delete a file or directory

Svn rm filename ### multiple files or directories can be followed

Svn ci. -M "Remove FILENAME" ### same as SVN add, commit is required after deletion. you need to add comments (-M "***") When performing a commit operation, or do not allow the submission of ### in Linux. Such restrictions are also convenient to maintain good habits.

 

Others:

SVN repository construction and permission management are not discussed in this article. There are also a lot of related information on the Internet, which may involve configuration and permission management similar to Apache.

SVN has many commands, but not many are commonly used. I saw an article on the Internet, which is clear and well-formed. The link is: http://www.php-oa.com/2008/03/12/svnminglingzailinuxxiadeshiyong.html describes some common commands and their usage. If you are interested, you can check it out.

There is a PDF of SVN on the Internet, which is easy to find. The above details all aspects of SVN, but many of them are not available. You can refer to it for further understanding.

Finally, I will share a Vim profile configuration. I have been using this configuration for a long time. It is quite helpful. However, if you have a personal habit, you can customize a profile for yourself.

"Yytong edit set nu" show numbersyntax on "syntax highlightset cursorline" have cursorlineset cindent "set smartindent" set autoindent "set hlsearch" highlight search wordset shiftwidth = 4 "set tabstop = 4" tab = 4map <silent> <F10>: tlisttoggle <CR> "use <FN> to open/close tlist" Let tlist_auto_open = 1 "each time the tlistlet tlist_show_one_file = 1" tag of multiple files is displayed at the same time, only show the current file's let tlist_exit_onlywindow = 1 "if the taglist window is the last window, exit Vim "Let tlist_use_right_window = 1". The taglist window set showmatch is displayed in the right window. "set to automatically check whether the brackets match set incsearchset rulerset laststatus = 2" display current file name autocmd bufreadpost * \ if line ("'\" ")> 0 & line ("'\" ") <= line (" $ ") | \ exe "normal G' \" "| \ endif" automatically jumps to the location where the last file was opened "set OFDM = Syntax" for qtset nocpfiletype plugin onset tags + =/home/yytong/work /idong/Qt-src/qt-everywhere-opensource-src-4.6.3/include/tagsset tags + =/home/yytong/work/idong/Qt-src/qt-everywhere-opensource-src-4.6.3/src/tags "for Qt end

In the last few lines, you can configure the ctags-related items. You can use the automatic complementing feature of the Code in VI. Syntax highlighting is also configured, which is very practical.

You only need to edit ~ /. Vimrc, copy the above content, or use some code. Because it is stored in the $ home working directory of the current user,

It takes effect immediately after you log out without restarting. This is really a good thing. VIM + ctags can implement similar ide functions, but Mac ctags are not standard ctags.

In addition, you can use one or more of the preceding statements in the VI command mode for temporary control. For example: Set Nu is to open the row number: Set Nonu is to close the row number

The screen command is also very useful. You can open multiple tabs in a terminal window, but it is not the content of this article. You have time to sort out a utility document!

 

By yytong 2011-11-25 20:48:02

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.