2008年6月3日 星期二

Linux Command - cvs

When you try to commit a code, sometimes it will happen conflict like following conditions.

# cvs -q up test.c
user@cvs-server's password:
[omit]
retrieving revision 1.1.1.1 ==> retrieve the version 1.1.1.1, I don't know why need to retrieve this version, why not retrieve the version 1.1
retrieving revision 1.2 ==> retrieve the version 1.2
Merging differences between 1.1.1.1 and 1.2 into test.c ==> I don't understand why here is merge the difference of 1.1.1.1 and 1.2
rcsmerge: warning: conflicts during merge
cvs update: conflicts found in test.c
C test.c

In the test.c, you will find...
<<<<<<< a="b+1;"> the new modified in the working directory but not yet update to the cvs server.
=======
a=c+1; ==> the latest (newest) version code existed in the cvs server. We must resolve the conflicted part between the modified code which is existed in the working directory with this newest one which is existed in the cvs server.
>>>>>>> 1.2


If the CVS/Entries appear the follwoing line, it means that it is a new added but not yet commited file

/a.cfg/0/dummy timestamp//
normally file will like the following one
/b123.c/1.3/Mon Apr 21 06:36:39 2008//

How to create a cvs branch

# cvs rtag -b branch_name module_name

2.1 Creating a Branch
Branches can be added to the repository tree in order to allow different development paths to be tried, or to add parallel development of code to different base versions. To create a branch, you can use

cvs tag (從目前的Working Directory 切branch)

or

cvs rtag (從Repository 的 main trunk 切出 branch)

with the -b option.

Do not be fooled! Even though the same commands can be used to create tags, branches are completely different than tags.

2.1.1 rtag
To create a branch from the main trunk of my_module at the revision that was last committed, use the command
cvs rtag -b Branchname my_module

To create a branch from a tagged revision of my_module, use the command
cvs rtag -r Tagname -b Branchname my_module

Both commands immediately create a branch in the repository without requiring a cvs commit to enact. You do not need to be in a checked-out working directory to do this.
2.1.2 tag
If you are in a working directory, you can create a new branch in the branch or trunk from which you checked out your working directory (not including the changes you've made to your working directory since the last commit) by using the command
cvs tag -b Branchname

Like rtag, the change is immediate, and does not wait for a commit command.

Your working directory remains on the old branch, at a point after the branch you just created. To move your working directory to the new branch, use the command
cvs update -r Branchname When you are finished making changes to your working directory, save it as the next revision on the new branch with
cvs commit
2.1.3 Both rtag and tag
Note that both rtag and tag work directly on the repository and take effect immediately without a commit command. Rtag takes effect at the specified place (the end of the main trunk by default), while tag takes effect at the place where the working directory was checked out or last committed.
==>根據這邊的說明, 建議在切CVS branch時, 不要利用tag, 盡量利用rtag, 因為working directory 有可能每一個檔案它的revision, branch 都不同, 利用tag 切會容易有confuse, 結果可能不是我們想要的


How to removing a empty directory from working directory. Simply type the following commands
# cvs -q up -P

Removing directories

In concept removing directories is somewhat similar to removing files--you want the directory to not exist in your current working directories, but you also want to be able to retrieve old releases in which the directory existed.

The way that you remove a directory is to remove all the files in it. You don't remove the directory itself; there is no way to do that. Instead you specify the `-P' option to cvs update, cvs checkout, or cvs export, which will cause CVS to remove empty directories from working directories. Probably the best way to do this is to always specify `-P'; if you want an empty directory then put a dummy file (for example `.keepme') in it to prevent `-P' from removing it.

Note that `-P' is implied by the `-r' or `-D' options of checkout and export. This way CVS will be able to correctly create the directory or not depending on whether the particular version you are checking out contains any files in that directory.


cvs login ==> this command can use to login to the CVS Server for SSO (Single Sign On)
cvs -d :ssh:uer@IP-Address:/home/cvs login

Frequency Questions.

Q.
# cvs -q up -d
cvs [update aborted]: could not chdir to XXXX/loadfile: Not a directory

A. The problem was existed on the client (CVS client) end. There is a file called
'XXXX/loadfile' in the way of creating that directory?

Try deleting it then rerun the "cvs update -A" command?

沒有留言: