I. Introduction to SVN, tortoisesvn, and subclipse
Team Development Technology:
(1) unit test;
(2) version control;
(3) project automation;
SCM: Software Configuration Management, including SVN;
SVN is the successor of CVs and a version control system;
In short, version control is to enable team members to quickly unify code and enhance communication;
SVN is composed of clients and servers. The server is the project repository, that is, the place where the project is stored; the client is a local copy, that is, it is managed by SVN, it can be submitted to the project warehouse and obtained from the project warehouse;
SVN purpose: Everything is a directory;
Tortoisesvn is the svn client, because if it is a traditional subversion client, the task needs to be completed through the command line, and tortoisesvn is completed through the GUI;
Subclipse is a plug-in eclipse. In short, it is also a SVN client, just to facilitate eclipse development, so it can be submitted and imported in eclipse;
:
SVN: https://sourceforge.net/projects/win32svn/files/1.6.17/svn-win32-1.6.17.zip/download
Tortoisesvn: https://downloads.sourceforge.net/project/tortoisesvn/1.7.6/Application/TortoiseSVN-1.7.6.22632-win32-svn-1.7.4.msi? R = & TS = 1331344321 & use_mirror = cdnetworks-kr-2
Subclipse online installation address: http://subclipse.tigris.org/update_1.6.x
Note: You must configure the environment variables When configuring SVN;
(1) Path = C:/subversion/bin;
(2) svn_editor = notepad; set the default editor.
II. Introduction to SVN commands
Detected version: SVN -- version and svnadmin -- version
Create a project Repository: svnadmin create d: \ svn-Repos
Import the files in the tmpdir directory to sesame/trunk, that is, add rather than modify:
D: \ svnworkspace \ tmpdir> SVN import-M "Import SESAME project". File: // D:/SVN-repos/sesame/trunk
-M indicates that some comments can be provided;. indicates that files in the current directory are imported;
Note: Only the project repository URL is required during import, and no URL is required for diff or commit;
In svnworkspace checkout, specify the latest project and name it Sesame: D: \ svnworkspace> SVN Co file: // D:/SVN-repos/sesame/trunk Sesame
Project of the specified version (the first version here) in checkout: SVN checkout-R 1 SVN: // xiazdong-PC/sesame/trunk test3
View File status: SVN status day.txt
Check whether the project repository is updated: SVN status -- show-Updates
Note:
(1) M: modified locally, but not submitted;
(2) c (conflict): conflicts exist during updates;
(3) g (gather): the local version and the project warehouse version are merged;
(4) U (update): the local version is successfully updated;
(5) A (ADD): Add a new file to the work copy;
(6) D (delete): The file is deleted in the project warehouse, so the file is also deleted in the work copy;
View changes to locally copied files (if the project warehouse is changed, it cannot be checked): SVN diff day.txt
View the differences between the project repository and local copy: SVN diff-rhead number.txt
View the differences between the two versions: SVN diff-R2: 4 number.txt
View recent changes: SVN diff-r PREV: Base number.txt
Update local copy: SVN update
Update a specified directory or file: SVN update number.txt dir1/dir2/
Note: when a conflict occurs, a prompt is displayed for modification;
Select: (p) postponed, (DF) show all differences, (e) edit,
(MC) My version, (TC) others' version,
(S) show all options:
Submit changes: D: \ svnworkspace \ sesame> SVN commit-M "comment"
Note: commit only submits changes. If you create an object in a local copy, you need to add the svn file before this.
If the conflict is not resolved during submission, the submission fails;
Obtain the log of a file: D: \ svnworkspace \ sesame> SVN log day.txt
Obtain the detailed log of a file: D: \ svnworkspace \ sesame> SVN log -- verbose day.txt
Obtain the logs between the two versions: SVN log-r day.txt
Display logs by PAGE: SVN log | more
Note: SVN log is not necessarily the latest log, because the working copy version may be different from the project repository version. SVN log can only display logs of working copy versions.
Note: * indicates an update;
Obtain the sesame copy information: SVN info Sesame
Copy file: SVN copy number.txt copy.txt
Note: After the copy is completed locally, you must submit the update project repository;
Rename the file: SVN move copy.txt copy. py
Rename Directory: SVN move dir1 dir2
Directly rename the Directory D: \ svnworkspace \ test3> SVN move-M "RENAME" SVN: // xiazdong-PC/sesame/trunk/number.txt SVN: // xiazdong-PC/sesame/trunk/dest.txt
Display the latest version of each line of the file and who changed it: SVN blame number.txt
File Restoration: SVN merge-r number.txt network access methods:
(1) svnserve
(2) SSH
(3) Apache
Start svnserve: Start svnserve -- daemon -- root D: \ svn-repos for a specific project Repository
Use svnserve to check out the file: SVN Co SVN: // xiazdong-PC/sesame/trunk visuppliers
By default, the project repository managed by svnserve is read-only, that is, it can only be checked out and cannot be submitted. Add the following in/CONF/svnserve. conf:
Anon-access = read // anonymous user read-only
Auth-access = write // authorized user writable
Passowrd = passwd // configure it in the passwd file
In the passwd file, configure xiazdong = 12345 to indicate that the user name is xiazdong and the password is 12345.
Note: The svnserve. conf and passwd files must be configured with the top level; otherwise, the configuration is invalid;
Attribute: metadata of the file;
Set the checked-by attribute to xiazdong: SVN propset checked-by "xiazdong" number.txt for number.txt.
Edit the checked-by attribute in number.txt (you need to configure svn_editor to set the Default Editor): SVN propedit checked-by number.txt
List all attributes of number.txt: SVN proplist number.txt
Obtain an attribute: SVN propget checked-by number.txt
Common attributes:
(1) SVN: Ignore: ignore certain files; *. Java indicates ignoring java files
(2) SVN: EOL-style: Set the line break, which is generally native, indicating that it changes with the operating system;
(3) SVN: mime-type: sets the MIME type of the file;
(4) SVN: Needs-lock: sets File Locking.
Generally, we can configure autoprops in the file and set it automatically;
1. Search for the config file:
(1) echo % appdata %
(2) \ subversion \ config
2. Set enable-auto-Props = true
3. Find [auto-Props] And set Automatic attributes.
File lock
Strictly lock: only one person is allowed to change one file;
Optimistic Locking: for example, a and B Both checkout a file at the same time. java, and modified them at the same time. A first submits. When B wants to submit, it must first SVN update and change its directory to the latest one before submission, there are two situations during the update:
(1) If a and B modify different rows, they will be merged normally;
(2) If a and B change the same line, a conflict will be marked in the source code:
By default, the Subversion adopts Optimistic Locking;
For text files, you can merge them to solve conflicts, but for binary files, you need to lock the files;
Enable file lock for a file: add the svn: Needs-lock attribute for a file and commit it to the File Repository;
File lock: SVN lock day.txt-M "Lock"
Force unlock (although someone else has a lock, another person can force unlock the lock, but does not get the lock): SVN unlock -- force SVN: // xiazdong-PC/sesame/trunk/day.txt
Force lock (whether there is a lock or not, all of them are grabbed): SVN lock -- force day.txt
Switch to another directory: SVN switch SVN: // xiazdong-PC/sesame/branches/B1
Conflict:
<. Mine
Original code
========
Project repository code
>>>>>>>. R4
Branch and Tag: replication of a work copy;
Develop on the branch:
(1) Create the branches directory in the project repository; SVN mkdir SVN: // xiazdong-PC/sesame/branches
(2) copy the trunk to the B1 directory in the project repository; SVN copy SVN: // xiazdong-PC/sesame/trunk SVN: // xiazdong-PC/sesame/branches/B1
(3) Use the B1 directory checkout to copy a job. SVN Co SVN: // xiazdong-PC/sesame/branches/B1 B1
(4) Submit;
Iii. Introduction to tortoisesvn
If you know the terms in SVN, this tool is very easy to get started and use;
1. Checkout
2. Conflict
Iv. Introduction to subclipse 1. Checkout
2. Commit, etc.