SVN sub-command diff three main usage explanations

Source: Internet
Author: User
Tags svn update

Main introduction to the use of SVN subcommand diff


Check the details of history changes:
The SVN subcommand diff-uses the standard difference file format to show the difference between the local working copy and the repository before it is submitted.


In fact, the SVN subcommand diff has three different uses:
1. Check for local modifications
2. Compare working copy with repository
3. Comparing Repository to Repository


Compare local Modifications:
As we see, when called without any parameters, SVN diff will compare your working files with the "original" copies cached in. SVN:
$ svn diff
Index:rules.txt
===================================================================
---rules.txt (revision 3)
+ + + rules.txt (working copy)
@@ -1,4 +1,5 @@
Be Kind to others
Freedom = Responsibility
Everything in moderation
-chew with your mouth open
+chew with your mouth closed
+listen when others is speaking
[/pre] Compare working copy and repository


If you pass a--revision (-r) parameter, your working copy will be compared to the specified version.
$ svn diff-r 3 rules.txt
Index:rules.txt
===================================================================
---rules.txt (revision 3)
+ + + rules.txt (working copy)
@@ -1,4 +1,5 @@
Be Kind to others
Freedom = Responsibility
Everything in moderation
-chew with your mouth open
+chew with your mouth closed
+listen when others is speaking


SVN subcommand diff compare repository to Repository
If two version numbers separated by colons are passed by--revision (-R), the two versions are compared.
$ svn diff-r 2:3 rules.txt
Index:rules.txt
===================================================================
---rules.txt (revision 2)
+ + + rules.txt (Revision 3)
@@ -1,4 +1,4 @@
Be Kind to others
-freedom = Chocolate Ice Cream
+freedom = Responsibility
Everything in moderation
Chew with your mouth open


A more convenient way to compare to the previous revision is to use--change (-c):
$ svn diff-c 3 rules.txt
Index:rules.txt
===================================================================
---rules.txt (revision 2)
+ + + rules.txt (Revision 3)
@@ -1,4 +1,4 @@
Be Kind to others
-freedom = Chocolate Ice Cream
+freedom = Responsibility
Everything in moderation
Chew with your mouth open


Finally, even if you do not have a working copy on this computer, you can compare the revision of the repository by simply entering the appropriate URL on the command line:
$ svn diff-c 5 http://svn.example.com/repos/example/trunk/text/rules.txt ...


Browse the Repository
With SVN cat and SVN list, you can view the contents of files and directories without modifying the work revisions, and you don't even need to have a working copy.


SVN Sub-command cat
If you just want to check a past version and don't want to see the difference, use SVN cat:
$ svn cat-r 2 rules.txt
Be Kind to others
Freedom = Chocolate Ice Cream
Everything in moderation
Chew with your mouth open


You can redirect output to a file:
$ svn cat-r 2 rules.txt > Rules.txt.v2


SVN list
SVN list can view the files in the directory without downloading the files to the local directory:
$ SVN List http://svn.collab.net/repos/svn
readme,branches/,clients/,tags/,trunk/


If you want to see more information, you can use the--verbose (-V) Parameter:
$ svn list-v http://svn.collab.net/repos/svn
20620 Harry 1084 Jul 2006 README
23339 Harry 01:40 branches/
21282 Sally 09:41 developer-resources/
23198 Harry Jan 17:17 tags/
23351 Sally Feb 13:26 trunk/


These columns tell you the last modified version of the file and directory, the user who made the changes, the size of the file if the file, and finally the date and the name of the item.


Warning:
The SVN subcommands with no parameters List command defaults to the repository URL of the current working copy, rather than the directory of the local working copy. After all, if you want to list local directories, you only need to use LS (or any reasonable non-UNIX equivalent).
To get the old repository snapshot, in addition to the commands above, you can use the SVN update and SVN checkout with parameter--revision to "go back to the past" for the entire working copy [8]:
$ svn checkout-r 1729 # Checks out a new working copy at r1729 ...
$ svn update-r 1729 # Updates an existing working copy to r1729 ...


Tips:

Many subversion novices use the previous SVN update instance to "fallback" the modification, but you cannot commit the modification, and you get a stale working copy with a new revision that is useless.


Finally, if you build a version and want to package files from subversion, but you don't want to have a nasty. SVN directory, you can export a subset of the repository's files without the. SVN directory. Just like SVN update and SVN checkout, you can also pass the--revision option to SVN export:
$ SVN Export HTTP://SVN.EXAMPLE.COM/SVN/REPOS1 # Exports latest revision ...
$ SVN Export Http://svn.example.com/svn/repos1-r 1729
# Exports revision r1729.


This article is from the Oscar blog, so be sure to keep this source http://4526621.blog.51cto.com/4516621/1585223

SVN sub-command diff three main usage explanations

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.