Tuesday, February 22, 2005

[Tech] อีกวันกับ CVS

ก็ศึกษาต่อกันมาเรื่อยๆก็พบว่ามีฟีทเจอร์ที่น่่าสนใจอยู่นั่นก็คือ
1. Add Contents
2. Tagging
3. Braching
4. Merge from branches
5. Revision number control
6. Annotate

1. Add Contents
Starting from adding a directory to CVS, we can add all of its contents recursively to ourCVS repository buy using 'Add Contents' in Tortoise CVS interface.

2. Tagging
I guess this is for naming and clarification purpose only. The result, however, will appear in a revision graph and look really nice. One of the main use is to make a tag to several files at the same time. This can make a meaningful custom revision number. For example, if we have three files: file1, file2 and file3 and their revision number 1.11, 1.5 and 1.4 respectively and we want to make note that those three files with the revision numbers are in the same release or at the same milestone in our development, we can issue the same tagg to all the three files.

Note for TortoiseCVS: If we want to update by tag name reference, we sometimes need to update the tag lists before it's available in the GUI. To get the copy by another method such as graph or history, 'update list' is generally unnecessary.

3. Annotate
I am still unable to fully understand it, but this can show us history of each line!!! It displays developer's name whose contributes to each line and revision number that makes the latest change on the line.

4. Branching/Merging
This feature is so confusing. But the guideline of usage is that we can create a branch and then merge it back and commit. If we commit before merging, it will go to the main development line (line before we make a branch). I, however, cannot stop branching and merge everything back to the HEAD development line. In addition, the revision number counting is strange. It show four numbers, not three. Sth. must wrong.

Hey, after some study, I found that the number is correct. If we make a brach from revision 1.5, we will get a branch with revision number 1.5.2.1. The number is in this way because there is internal running number too (main version may be 1.5.1.1).

Another noteworthy stuff is that if we make a mistake about a file and cannot do anything useful with that, we can delete it and use cvs update in the directory to get the file back with fresh start. If the result from the update is not satisfactory, we may use 'update spacial' to specify a branch name for that file. BEWARE: If we use update special to a directory with 'clean copy' option, every file that is not related to the branch in update special command will be deleted.

Then, how to go back to the main development line? When we finish doing something in a branch, we want to go back and make a new revison in the main line. To go back, first make sure we commit any good change to the repository. Second, use 'update special' to get the main branch copy. Third, merge the branch and solve conflict if any. Then, we will see that the file is modified after the merge. If everything is okay, we can commit the change safely. Note that if we make a merge when we are on the branch, the later commit will appear on the branch, not on the main line. In other word, if we want to make new revision at any development line, use update special to get the line and issue commit when appropriate.

No comments: