In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
With regard to version controllers, they can be roughly divided into centralized and distributed types.
A centralized version controller usually has a central server, which is mainly used to store the version library. (not to mention the branch here) before we work, we first need to get the latest version of the code from the central server. after the modification, push it to the central server again. The biggest disadvantage of the centralized version controller is that it has to be connected to the network to work. At the same time, once the central server is down, the whole project will collapse, but it is really more convenient to use.
The advantage of the distributed version controller is obvious. for the distributed version controller, there is no central server, and everyone who joins the version controller has a complete version library on their computer. At the same time, it also avoids the disadvantage of networking. When local changes are made, as long as they are pushed to each other, their respective changes can be seen. For convenience, the usual distributed version controller also has a machine similar to the CPU, just to make it more convenient for everyone to push each other, even if a server down is down, only one more version library needs to be copied, and the disaster tolerance is much better.
For these two versions of controllers, SVN is the representative of centralized, Git is the representative of distributed, both have their own advantages and disadvantages, in Internet companies, both have certain applications. What we want to talk about here is the construction and operation of SVN.
Environment: CentOS6.5
Before operation: install svnserver and install it directly using yum. In some cases, the computer automatically installs svn and git.
Start the operation:
1. The establishment of SVN warehouse.
Create the project directory dir and initialize the warehouse
Mkdir / svn_repo
Svnadmin create / svn_repo
B. Modify the contents of three files under the conf folder under the warehouse directory. There is no space at the beginning of each line.
Authz: permission related information
[/] # directory where the warehouse is located
Muhui = rw # give the muhui user rw permission
* = # other users do not have any permissions
Passwd: user name and password related information
User = passswd
Svnserver.conf: related configuration path
Anon-access = none anonymous user rights
Auth-access = write authorized user has write permission
Password-db = passwd password file, no path specified, indicating the current directory
Authz-db = authz permissions file
Realm = / svn_repo/httpd directory where the version library is located
2. SVN project directory
A. Create the main working directory manager
[root@bogon svn_test] # tree
.
└── manager
└── httpd
├── branched # subbranch directory
├── tags
└── trunk # main branch directory
Go to the manager directory, and 3 synchronize the manager directory structure to the repository. Under the httpd project directory, you have these three folders.
Svn import httpd svn://127.0.0.1/httpd-m "init httpd"
B. create a user and check out the code of the main branch locally.
Mkdir-p / svn_test/dev1
Cd / svn_test/dev1
Svn co svn://127.0.0.1/httpd/trunk httpd
C. File modification and submission
[root@bogon httpd] # vim main.cpp
[root@bogon httpd] # ls
Main.cpp
[root@bogon httpd] # svn st
? Main.cpp #? Indicates that the file is not under version control
[root@bogon httpd] # svn add main.cpp # add add this file to version control
A main.cpp
[root@bogon httpd] # svn ci-m "dev1 modify" # submit changes to the server
Add main.cpp
Transfer file data.
The submitted version is 2.
3. Multi-person cooperation
It is important to note that multi-person collaboration and multi-branch operation are two concepts. There can be multiple user operations on a branch, which refers to multi-user operations under the main branch.
Create a user dev2, drop down the code and submit it again.
[root@bogon httpd] # pwd
/ svn_test/dev2/httpd
[root@bogon httpd] # vim main.cpp
[root@bogon httpd] # svn st
M main.cpp
[root@bogon httpd] # svn up # update the code to prevent the remote library code from being changed
Version 2.
[root@bogon httpd] # svn log # View submission log information
.
[root@bogon httpd] # svn diff # View modification information
.
[root@bogon httpd] # svn ci-m "dev2 write sub" # submit code to warehouse
.
B. Conflict resolution
Cause of conflict: multiple users drop down a code to modify at the same time, and do not update svn up again before submission, and multiple users modify a version at the same time, resulting in conflict.
[root@bogon httpd] # svn ci-m "dev1--complict" # submission failed and there is a conflict
Sending main.cpp
Transfer file data .svn: failed to submit (details are as follows):
Svn: the file "/ trunk/main.cpp" is out of date
[root@bogon httpd] # svn up
Conflict found in "main.cpp".
Select: (P) postpone, (df) show all differences, (e) edit
(mc) my version, (tc) someone else's version
(s) display all options: P # p option for delay
C main.cpp
Update to version 4.
Summary of conflicts:
Text conflict: 1
# there are many temporary files for each version of the source file
[root@bogon httpd] # svn resolve-- the parties to the accept working main.cpp # conflict negotiate to modify the source file, after which the temporary file is deleted
The conflict state of "main.cpp" has been resolved
[root@bogon httpd] # svn ci-m "deal complict" # submit again, conflict resolution
4. Branch operation
A, branch creation
[root@bogon dev3] # svn copy svn://127.0.0.1/httpd/trunk svn://127.0.0.1/httpd/branched/branch2-m "add new branch2" is submitted for version 6.
# the process of creating a svn branch is actually a copy of the main branch
B. check how many branches there are.
[root@bogon dev3] # svn list svn://127.0.0.1/httpd/branched-v 6 muhui May 28 09:38. / 6 muhui May 28 09:38 branch2/
C. Check out the code from the branch branch2 branch to the current working directory and see which branch it currently belongs to
[root@bogon dev3] # svn co svn://127.0.0.1/httpd/branched/branch2 httpd A httpd/main.cpp take out version 6. [root@bogon httpd] # svn info path:. URL: svn://127.0.0.1/httpd/branched/branch2 version Library UUID: 39c9dc13-9f79-4073-bb0e-2b58c9b71fbb version: 6 Node Category: directory scheduling: normal Last modified author: muhui Last modified version: 6 Last modified time: 2017-05-28 09:38:49 + 0800 (Day) 2017-05-28)
D, branch merge operation, to merge in the main branch directory
The user on the branch modifies the contents of the file and checks in to the branch
[root@bogon httpd] # svn ci-m "branch2 modify" is sending main.cpp transfer file data. The submitted version is 7.
Get the version number when viewing the branch
[root@bogon httpd] # svn log-- verbose-- stop-on-copy-R6 | muhui | 2017-05-28 09:38:49 + 0800 2017-05-28) | 1 line changed path: a / branched/branch2 (from / trunk:5) add new branch2
Get the latest version number of the backbone directory
[root@bogon httpd] # svn up version 7.
Branch merging
[root@bogon httpd] # svn merge-r 6:7 svn://127.0.0.1/httpd/branched/branch2
5. Version fallback
1. Only modify the source file, but the ci operation has not been performed yet
[root@bogon httpd] # svn revert main.cpp
2. The modified result has been commit.
[root@bogon httpd] # svn up # get the latest version of the version library [root@bogon httpd] # svn log # find the version number [root@bogon httpd] # svn merge-r 9:8 main.cpp # merge to be rolled back, 9 indicates the current version number, and 8 indicates the version number to be rolled back to
-muhuizz finishing
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.