SVN View Historical Information
Using the svn command, you can revert to past versions based on time or revision number, or view specific changes made in a particular version. The following four commands are used to view svn history:
-
svn log: Used to display svn version author, date, path, etc.
-
svn diff: Used to show line-by-line details of specific changes.
-
svn cat: Retrieves a file from a specific version to display on the current screen.
-
svn list: Displays files that exist in a directory or a specific version.
1. svn log
It can display all information. If you only want to view information between specific versions, you can use:
root@tutorialpro:~/svn/tutorialpro01/trunk# svn log -r 6:8
------------------------------------------------------------------------
r6 | user02 | 2016-11-07 02:01:26 +0800 (Mon, 07 Nov 2016) | 1 line
change HelloWorld.html first.
------------------------------------------------------------------------
r7 | user01 | 2016-11-07 02:23:26 +0800 (Mon, 07 Nov 2016) | 1 line
change HelloWorld.html second
------------------------------------------------------------------------
r8 | user01 | 2016-11-07 02:53:13 +0800 (Mon, 07 Nov 2016) | 1 line
SVN readme.
------------------------------------------------------------------------
If you only want to view version modification information for a specific file, you can use svn log with the file path.
root@tutorialpro:~/svn/tutorialpro01# svn log trunk/HelloWorld.html
------------------------------------------------------------------------
r7 | user01 | 2016-11-07 02:23:26 +0800 (Mon, 07 Nov 2016) | 1 line
change HelloWorld.html second
------------------------------------------------------------------------
r6 | user02 | 2016-11-07 02:01:26 +0800 (Mon, 07 Nov 2016) | 1 line
change HelloWorld.html first.
------------------------------------------------------------------------
r5 | user01 | 2016-11-07 01:50:03 +0800 (Mon, 07 Nov 2016) | 1 line
------------------------------------------------------------------------
r4 | user01 | 2016-11-07 01:45:43 +0800 (Mon, 07 Nov 2016) | 1 line
Add function to accept input and to display array contents
------------------------------------------------------------------------
r3 | user01 | 2016-11-07 01:42:35 +0800 (Mon, 07 Nov 2016) | 1 line
------------------------------------------------------------------------
r2 | user01 | 2016-08-23 17:29:02 +0800 (Tue, 23 Aug 2016) | 1 line
first file
If you want to get the information about the directory, add -v.
If you want to display limited N records of directory information, use svn log -l N -v.
root@tutorialpro:~/svn/tutorialpro01/trunk# svn log -l 5 -v
------------------------------------------------------------------------
r6 | user02 | 2016-11-07 02:01:26 +0800 (Mon, 07 Nov 2016) | 1 line
Changed paths:
M /trunk/HelloWorld.html
change HelloWorld.html first.
------------------------------------------------------------------------
r5 | user01 | 2016-11-07 01:50:03 +0800 (Mon, 07 Nov 2016) | 1 line
Changed paths:
M /trunk/HelloWorld.html
------------------------------------------------------------------------
r4 | user01 | 2016-11-07 01:45:43 +0800 (Mon, 07 Nov 2016) | 1 line
Changed paths:
M /trunk/HelloWorld.html
Add function to accept input and to display array contents
------------------------------------------------------------------------
r3 | user01 | 2016-11-07 01:42:35 +0800 (Mon, 07 Nov 2016) | 1 line
Changed paths:
A /trunk/HelloWorld.html (from /trunk/helloworld.html:2)
D /trunk/helloworld.html
------------------------------------------------------------------------
r2 | user01 | 2016-08-23 17:29:02 +0800 (Tue, 23 Aug 2016) | 1 line
Changed paths:
A /trunk/helloworld.html
first file
------------------------------------------------------------------------
2、svn diff
Used to check the details of historical modifications.
Check local modifications
Compare the working copy with the repository
Compare the repository with the repository
(1) If you use svn diff without any parameters, it will compare your working files with the cached "original" copy in .svn.
root@tutorialpro:~/svn/tutorialpro01/trunk# 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
(2) Compare the working copy with the repository
Compare your working copy with the file rule.txt at revision 3 in the repository.
svn diff -r 3 rule.txt
(3) Compare the repository with the repository
Pass two revision numbers separated by a colon through -r(revision), and these two revisions will be compared.
Compare the changes in the file between revisions 2 and 3 in the svn working version.
svn diff -r 2:3 rule.txt
3、svn cat
If you just want to check a past version without viewing their differences, you can use svn cat.
svn cat -r revision_number rule.txt
This command displays the contents of the file at the specified revision number.
---
## 4、svn list
**svn list** allows you to view the contents of a directory without downloading files to your local directory:
$ svn list http://192.168.0.1/tutorialpro01 README branches/ clients/ tags/ ```