Using vimdiff as the svndiff code viewing tool in linux, it is very difficult to directly use the svndiff command to view the code modification, so I found a good solution on the Internet, vimdiff is used as the svndiff code viewing tool, especially for those who are used to vim...
Using vimdiff as the svn diff code viewing tool in linux, it is very difficult to directly use the svn diff command to view the code modification, so I found a better solution on the Internet, vimdiff is used as the svn diff code viewing tool, especially for those who are used to vim. When you use the svn diff command to compare the changes of a file, for example, run the following command: $ svn diff-r4420 ngx_http_limit_req_module.c, the following command is actually sent to the default diff program: www.2cto.com-u-L ngx_http_limit_req_module.c (revision 4420)-L ngx_http_limit_req_module.c (working copy ). svn/tmp/tempfile. tmp ngx_http_limit_req_module.c
Explanation of svn diff in the svn official FAQ
(Chinese: http://subversion.apache.org/faq.zh.html?diff-=,
English http://subversion.apache.org/faq.html#diff-cmd): When using an external diff command, Subversion generates a very complex command line. The first parameter is the specific -- diff-cmd, and then the specific -- extensions (although the extension is ignored when the blank -- symbol is used ), or if -- extensions or -- extensions is not specified, the '-U' parameter is added. For the third and fourth parameters, the Subversion will pass a "-L" label with the first File (for example, "project_issues.html (revision 11209 )").
The fifth and sixth files are the tags of the other "-L" and the second files. The seventh and eighth parameters are the names of the first and second files, for example, ". svn/text-base/project_issues.html.svn-base" and ". svn/tmp/project_issues.html.tmp "). After learning about the diff internal call command, it is easier to use vimdiff as the diff program. When comparing two files, vimdiff only needs to know the path and file name of the two files, that is, the 7th and 8th parameters in the preceding diff internal commands; www.2cto.com also shows that calling vimdiff directly with -- diff-cmd is not feasible due to too many diff internal command parameters (the command is as follows ). $ Svn diff -- diff-cmd vimdiff-r4420 ngx_http_limit_req_module.c. Therefore, we need to write another script to use it as the diff program and obtain the diff internal commands, then, take only 7th and 8th of the parameters and pass them to vimdiff. This solves the problem of many parameters. The script (diffwrap. sh) is as follows :#! /Bin/sh # Remove the first five parameters shift 5 # use vimdiff to compare vimdiff "$ @". In addition, svn also provides the function of modifying the default diff program in the configuration file, in this way, you do not need to specify -- diff-cmd every time you use svn diff. Modify ~ /. Subversion/config, find the following configuration line: www.2cto.com # diff-cmd = diff_program (diff, gdiff, etc .)
Add the path of the above script, for example, diff-cmd =/usr/local/bin/diffwrap. sh, the svn diff command will open vimdiff by default to compare two files. :
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.