In the previous article, we introduced the Webrev tool based on Git. In fact, the Webrev tool also supports HG and SVN. It's inevitable to use SVN in recent work, so here's a summary of how to create Webrev on Linux based on SVN. by the way, a slot, no web version of the code, with svn diff is simply slash and burn nascent Ah! Skilled and skillful old driver, also jiabuzhu let you on the freeway to drive the towing machine orz!
Used to work on the version management tool mercurial (command for Hg), personal learning to use git, but never used Subversion (command for SVN, etc.). So, here's a quick introduction to how to build an SVN server and initialize a code repository. In contrast, mercurial-based code warehouse initialization is simply too easy and requires only one command (HG init.) Get.
1. Build an SVN server
1.1 Create a project Venus
mkdir svnadmin create Venus
1.2 Configuration item Venus
root# Tree Venus/confvenus/conf├──authz #<--permissions-related configuration ├──hooks-env.tmpl├──passwd #<--account-related configuration └── svnserve.conf #<--Resource Library related configuration 0 directories, 4 files
1.2.1 Configure account e.g. Add user Veli, password is Veli (see line 9th)
root# cat-n passwd 1### This file is a example password file for Svnserve. 2### its format was similar to that of svnserve.conf. As shown in the 3### example below it contains one section labelled [Users]. 4### the name and password for each user follow, one account per line. 5 6[users] 7# Harry = Harryssecret 8# sally = Sallyssecret 9veli = Veli
1.2.2 Configure permissions e.g. Veli to the user can read and write (see lines 34th and 35)
root# cat-n Authz 1 # # # # This file is a example authorization file for Svnserve. 2 # # # Its format was identical to that of MOD_AUTHZ_SVN authorization 3 # # files. ... [/] VELI=RW
1.2.3 Configure the Repository e.g. set the root directory of the CODEBASE (see Line 48th) (line 19,20,27,36 only need to remove the corresponding comment symbol)
root# cat-n svnserve.conf 1 # # # # This file controls the configuration of the Svnserve daemon, if you 2 # # # Use the it to allow access to this repository. (If you are only allow 3 # # access through http:and/or file:urls, then this file is ... anon-access = Read auth-access = write ... password-db = passwd... authz-db = Authz... - realm =/var/tmp/ducert/venus ...
1.3 Starting Svnserver (e.g. svnserve-d-R Venus)
root# Cd/var/tmp/ducert &&pkill svnserveroot# svnserve -D- R Venusroot#PS-ef |grepVenus |grep-VgrepRoot6960 2233 0 One: in?xx:xx:xxSvnserve-d-R venusroot# Netstat-an |grep 3690TCP0 0 0.0.0.0:3690 0.0.0.0:* LISTEN
1.4 Test SVN server "Venus" to work properly
1.4.1 Checkout
veli$ ifconfig -A | egrep " inet addr:.*255.255.255.0 " inet addr: 192.168 . 228.128 bcast:192.168 . 228.255 mask:255.255 . 255.0 veli$ SVN co svn: //192.168.228.128--username=veli--password=veli Checked out Revision 0 .veli$ ls -A.SVN
1.4.2 Add some files
mkdirmkdir Demoa demoveli$ cd demoveli$ svn add foo.ca foo.cveli$ svn add bar.pya bar.pyveli$ svn add Makefilea makefileveli$ svn statusa . A Makefilea bar.pya foo.c
1.4.3 Commit
svn commit-m "05/15/2017:init Demo" Adding . Adding makefileadding bar.pyadding file1.
At this end, an SVN server is set up and can work smoothly. Next, use the Webrev tool to create a code-comparison page. Because in the previous section has described how to download the Webrev tool, here will not say more, direct use is good.
2. Use Webrev to create a code comparison page
2.1 Checkout the demo code in the SVN repository
RM mkdir /tmp//tmp/sandboxveli$ SVN co svn://192.168.228.128--username=veli-- Password=veliA Demoa demo/bar.pya demo/Makefilea Demo/ 1.
2.2 Modifying files
veli$ cd/tmp/sandbox/demoveli$ vi foo.cveli$ SVN diff foo.cindex:foo.c============================================== =====================---foo.c (Revision 1) + + + foo.c (working copy) @@ -3,7 +3,7 @@ -3,7 Main (int argc, char *ar Gv[]) {-(void) printf ("Hello world!\n"); + printf ("Hello world!\n"); return 0; }veli$ vi bar.pyveli$ SVN diff bar.pyindex:bar.py================================================================== =---bar.py (Revision 1) + + + bar.py (working copy) @@ -4,9 +4,9 @@ -4,9 Main (argc, argv): print "Hello worl d! " + return 0 if __name__ = = ' __main__ ':-argv = SYS.ARGV-ARGC = Len (sys.argv) + argc, argv = Le N (sys.argv), sys.argv sys.exit (Main (argc, argv)) veli$ vi makefileveli$ SVN diff makefileindex:makefile=========== ========================================================---Makefile (Revision 1) + + Makefile (working copy) @@ -1,7 +1,7 @@ CC = gcc CFLAGS =-g-wall-m32-all:foo+alL:foo Bar FOO:FOO.O $ (cc) $ (CFLAGS)-O [email protected] $<@@ -9,7 +9,12 @@ FOO.O:FOO.C $ (cc) $ (c FLAGS)-C $<+bar:bar.py+ CP $< [email protected]+ chmod +x [email protected]+ clean:r M-f *.o clobber:clean-rm-f foo+ rm-f foo bar+cl:clobber
2.3 Creating Webrev
export Path=/var/tmp/webrev/bin: $PATH Webrev Warning:codereview (1) not found. SCM detected:subversion File list from:svn status ... Done. Workspace:/tmp/sandboxcompare against: output to:/tmp/sandbox/webrev output Files: demo/makefile Patch cdiffs udiffs wdiffs sdiffs frames old New demo/bar.py patch cdiffs udiffs wdiffs sdiffs frames Old NEW
DEMO/FOO.C Patch cdiffs udiffs wdiffs sdiffs frames old New generating PDF:Skipped:no output available index . Html:done.
2.4 Viewing via browser
O
o foo.c.frames.html
o bar.py
o Makefile
Create Webrev on Linux (cont) [Based on SVN]