"About SVN"
SVN is used for version management data and it uses a branch management system. There was a gradual substitution of CVS after CVS,SVN was introduced before it appeared.
At present git, compared to svn,git more support distributed version management, the development is very fierce, here is not detailed introduction. You can get to know the SVN first, then look at git, contrast.
PS: times are always progressing ah, need to keep up with the trend. At the same time, you need to understand why the trend, need to think about the reasons behind the trend , to understand the background history, otherwise it is blindly.
"First Installation"
Yum Install Subversion
(Of course, if you think this version does not meet the requirements, you can also compile the installation, to download the relevant package)
Specifically, install 6 packages
(1/6): apr-1.3.9-5.el6_2.i686.rpm | 129 kB 00:01 (2/6): apr-util-1.3.9-3.el6_ 0.1.i686.rpm | 89 kB 00:00 (3/6): neon-0.29.3-3.el6_4.i686.rpm | 120 kB 00:00 (4/6): pakchois-0.4-3.2.el6.i686.rpm | 21 kB 00:00 (5/6): perl-URI-1.40-2.el6.noarch.rpm | 117 kB 00:00 (6/6): subversion-1.6.11-10.el6_5.i686.rpm | 2.2 mb 00:07
"Second Configuration"
2.1. Create SVN directory
Mkdir-p/data/svndata/
2.2. Create multiple projects: ISO, Android, Web managed separately
svnadmin create /data/svndata/iossvnadmin create / Data/svndata/android svnadmin create /data/svndata/web
Note: svnadmin Create is used for creating stand-alone projects, as follows:
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/45/BA/wKioL1PqHNaCfQVdAAElRCyqElE977.jpg "title = "Create.png" alt= "wkiol1pqhnacfqvdaaelrcyqele977.jpg"/>
2.3, unified management configuration (for managing multiple projects)
2.3.1, creating a unified management-related profile
Mkdir-p/data/svndata/conf/#该目录用于管理所有项目的帐号密码, authority control, etc. cat/data/svndata/conf/svnserve.conf #svn的总控文件 [General] Anon-access = none# An authenticated user has no access to the repository auth-access = write# authenticated read-write repository password-db = passwd #使用的密码文件是同级路径的passwd文件, which is/data/ SVNDATA/CONF/PASSWD authz-db = authz# the permission control file used is the Authz file of the sibling path, which is/data/svndata/conf/authzrealm = Svndata#realm Specifies the authentication domain for the repository, which is the name of the authentication domain that is prompted at logon. The authentication domain for each project can be customized cat/data/svndata/conf/passwd #每个用户的用户名和密码 [USERS]H2O = Yj3nlmdriver = Yjh9jnj
Cat/data/svndata/conf/authz #权限管理, the unified idea of rights management is to create multiple groups, add individual users to each group, and control the permissions of each group. In the future, the rights management will be maintained in the group's dimensions, otherwise the human granularity of management, will be dead drop
[groups]develop=h2o,user1# Description Develop there are two people android=h2o,user3ios=h2o,river,user2[android:/trunk]# Description of Android Trunk-related Permissions @android = rw# indicates that the Android group has read and Write permissions @develop = rw[ios:/trunk] @ios = Rw@develop = RW
Since then, the master configuration file has been prepared.
2.3.2 Each project configuration file modification
The profile that is used by default for each project is the configuration file under the project, so it must be modified or not managed by the master profile.
Each project directory structure is as follows:
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/45/BA/wKioL1PqHQ2QySGWAABN0BRJy8Q158.jpg "title=" Back.png "alt=" Wkiol1pqhq2qysgwaabn0brjy8q158.jpg "/>
# grep-v ' # '/data/svndata/android/conf/svnserve.conf #其他项目类似, not listed here [general] anon-access = none auth-access = Writep Assword-db =.. /.. /CONF/PASSWD #说明使用总控的密码文件 authz-db =.. /.. /conf/authz #说明使用总控的权限文件 Realm = Android
"Third Start"
Svnserve-d-r/data/svndata/
"IV Data Initialization"
The existing code needs to be imported into the SVN repository as follows
SVN import/tmp/data/ios/file:///data/svndata/codes/ios/trunk-m ' init import '
"Five-Ready Library construction"
Note: This is used in Svnsync Timing Synchronization data, can also do real-time synchronization, please do their own research (general hint for the configuration hook post-commit to achieve )
5.1 Prepare library project creation (same as the main Library creation project) the following actions operate on the standby library
Mkdir-p/data/svndata/svnadmin create/data/svndata/iossvnadmin create/data/svndata/androidsvnadmin create/data/ Svndata/web
The configuration file is also the same as the main library: it is not listed in detail, including the profile of the master control and the configuration files for each purpose.
5.2 Prepare the hooks for the library (as in the case of Android projects, as in other projects) the following actions operate on the standby library
Cat/data/svndata/android/hooks/pre-revprop-change#!/bin/shexit 0chmod 755/data/svndata/android/hooks/ Pre-revprop-change
5.3Svnsync Initialization and synchronization of data
Here are examples of Android projects, similar to other projects
Note:172.16.0.185is a standby library,172.16.0.120is the main library, the user name and password of the main library and the repository are consistent, and H2O need to have the relevant permissions, see/data/svndata/conf/authz
Svnsync init svn://172.16.0.185/android svn://172.16.0.120/android--username h2o--password Yj3NlMD--no-auth-cache # Svnsync establish a master and standby relationship Svnsync sync svn://172.16.0.185/android--username H2O--password yj3nlmd--no-auth-cache #svnsync data from the main library Sync up.
If you see the following, you are successful. If you find that there is only a version number, there is no transmitting file data, please double check the Master repository configuration file for errors and omissions
Transmitting file data. Committed revision 1.Copied Properties for revision 1.Transmitting file data. Committed revision 2.Copied Properties for revision 2.Committed revision 3.Copied properties for revision 3.Transmitting F Ile data. Committed revision 4.Copied Properties for revision 4.
"Sixth timed update script"
To write timed synchronization scripts on the standby, the key is as follows
#!/bin/bashnow_time=$ (date "+%f_%t") projects= (Android iOS Web) for project in ${projects[@]};d o svnsync sync svn://172 .16.0.185/$project--username h2o--password yj3nlmd--no-auth-cache >>/home/logs/svnbak.log. $now _time 2> &1done
This article is from "H2O's Operation & Development Road" blog, reprint please contact the author!