// Original address: http://hi.baidu.com/xublog/blog/item/8eab160264428f094afb512b.html
5.4.9 process concurrent updates to the same file
First, we will discuss the next suggested Association for modification operations.
Discussion. When using resources in a workspace, your operations are independent of the CVS resource library. Because changes in the resource library may occur without your knowledge, it is very important
If you have not checked whether any updates in the resource library have replaced your changes, do not submit any changes. Team |
Update... The operation updates the local copy of the project with any changes in the resource library that have replaced your changes. For text files (including Java classes), team |
Update... The operation automatically merges any changes (from the resource library to the workspace), even if these changes may cause conflicts. In case of a conflict, the merge operation will be identified by the specific CVS markup text
File to help you identify conflicting rows. Marking text is not compatible with any types of files. For example, it may cause compilation errors.
Update...
Operation is a very powerful operation. We must be careful when practicing. In the following example, Pat and Lynn update a simple text file. You don't need to know about it.
The row starting with "C" is updated. The marked text identifies the conflicting lines and the version number (1.2) that has introduced the conflict. For a complex Java file with numerous conflicts, you may
It is difficult to solve the conflicts.
A is for Apple
<Sample.txt
B is for bird (Updated by Pat
)
C is for crow (Updated by Pat
)
========
B is for Bobcat (Updated by Lynn
)
C is for cow (Updated by Lynn
)
>>>>>>>> 1.2
D is for dog
E is for excellent
F is for farm
G is for goat...
Team | synchronize
Repository... The Operation also supports updates, but the operation is not automatically updated. After performing this operation, the synchronize view is displayed, and the copies of the workspace and the most
The inconsistent resources between new resources. In the synchronize view, you can check these differences and decide the action to take. Because Team |
Synchronize with repository... This operation gives you more control, so we recommend that you use this operation instead of update... Operation.
The following summarizes the basic rules for concurrent File Updates:
You must use all changes in the resource library to update Resources in the workspace before modifying the files in. For security, use team | synchronize
Repository... Operation. In the synchronize view, you can perform update operations, submit changes, and coordinate conflicts.
5.4.10 Watch/edit support using CVS to avoid parallel updates to the same file
CVS
The watch/edit support of is provided by ECLIPSE itself. If you agree to use the watch/edit support of CVs, you and other members of the group
Conflicts can be avoided. After the watch/edit support of CVS is enabled, your project team can better understand who is updating files in all specific projects. On the contrary,
The CVS annotate view shows the previous changes and who made the changes. Watch/edit support of CVS is enabled at the project level. If you are in a team |
On the preference settings page of CVS> Watch/edit, select configure projects to use Watch/edit on.
When the check box is checked out, watch/edit support is automatically activated. You can also enable the CVS attribute of a project on an existing project managed by CVS.
Watch/edit support. When the watch/edit feature of CVS is enabled, files in the project are read-only. In this case, if you open a file in the editor and try
File, the CVS server will be asked. When editing a file, if another person is editing the file, a dialog box appears to notify other members in your group that the file is being edited.
(See Figure 5-9 ). At this time, you can continue to edit the file, but you need to manage conflicts when submitting the file. Check the tag modifier when the file is modified.
Will be added to this file.
Figure 5-9 shows the dialog box in which others are editing the same file
Execute team on projects, folders, and files |
After the show editors operation, the CVS editors view is displayed. CVS
The editors view lists all resources being updated by others (see Figure 5-10 ). Whether or not you are under the control of watch/edit, you can
To use the team | show editors operation. However, Team | show
The editors operation only identifies the project resources supported by Watch/edit.
Figure 5-10 lists the users who are updating the CVS editors view of files in the folder.
You can use team |
The Edit operation explicitly notifies the CVS server that you want to update the file. You can also use team |
The unedit operation notifies the CVS server that you do not want to edit the file. In this way, any changes you make will be checked out from the CVS resource library. Table 5-3 provides information about
Operation information. After submitting changes to CVS, the resources in the watch/edit list are implicitly deleted.
Watch/edit is a very useful tool. However
Some rules should be followed for the use of the tool, and some considerations should be taken into consideration. First, to make the watch/edit function efficient, each member in the group must enable
Watch/edit. Second, you must connect to the CVS server. If you are not connected to the CVS server and want to update a file, you have to explicitly
The read status (which can be obtained from the file's properties page) is canceled. Of course, this support is now in the middle of the fold. This is because no one knows about the update and there is a potential conflict in the submission process. If
If you delete a project and the watch/edit preference settings of the project resources are not enabled, the CVS server will not be notified and the CVS server will continue to report that you are
Resources. If your group plans to use Watch/edit support, it is wise to enable all members in the group to be labeled as configure projects.
To use Watch/edit on Checkout's CVS Watch/edit preference settings.
5.4.11 restore deleted files
Sometimes, after the file is deleted and the changes are submitted to CVS
You may need to restore the deleted files. Fortunately, CVS does not remove the deleted file from the resource library where the file is located. You can use team | restore from
Restore the deleted file. If the deleted file exists in the resource library, you will see a dialog box. In this dialog box, you can select the file to be restored
Revision (see Figure 5-11 ). The latest version of the file is a reference to the deleted file. This is because file deletion is a CVS revision operation.
Figure 5-11 shows the restore from repository dialog box for recoverable deleted files
When a file is restored to a workspace, the file is considered as a new file. Before submitting the file or when submitting the file, you must add the new file to version control.
5.4.12 other CVS user interface elements 1. Checkout wizard
In the new wizard dialog box, check out items in the CVS wizard. Generally, you use the CVS repositories view to check out the project. However, some CVS resource libraries cannot be browsed. In this case, the check out wizard may be useful. However, in this case, you must know the name of the project in advance.
2. CVs memo form
To open the cheat sheet selection dialog box, select help | cheat sheets... Command. For CVS tasks, the memo sheet is used to help branch and merge operations.