Wednesday, January 12, 2011

How to move a tag to the tip of a branch?

CVS allows an existing tag to be moved to the tip of a branch in one operation (tag -F) so with this method we don't have to execute an additional “cvs rtag –d” operation to clean out the tag and then “cvs tag”.

Step 1: View the current Graph Selection: Right click on file2.txt file -> click on Graph selection…


Step 2: Update file2.txt and commit it to version 1.2.2.2

Step 3: Repeat Step 1 – Note that we want to move R-0-1-1 to version 1.2.2.2.

Step 4: Moving R-0-1-1: Admin -> Command Line … -> Enter “cvs tag –F R-0-1-1” in Command line settings window -> click on OK button in Command line settings window.

Step 5: Verify Changes:
cvs tag -F R-0-1-1
T file2.txt

*****CVS exited normally with code 0*****
Or repeat Step 1:

How to remove files or directories in CVS?

To remove files, you first schedule the files for removal, and then commit the change:

1. Select the file or files that you want to remove.
2. Click the right mouse button on the selection, and choose the Remove selection menu item. (See the Note below if you can’t find the Remove select menu item.)
3. As the files are only marked for removal, you have to commit them to remove them from the repository. See Sending Your Changes to CVS if you don't know how to commit.

Note: If you can’t find the Remove selection menu item, then: Right click on any file -> Select “Customize this menu…” -> Add the “Remove selection” item on Customize menus window. -> Click OK.

The files will now be removed from the repository. Note that files are not physically removed, but rather marked as "dead". By this way it will still be possible to retrieve the files if you choose to check out an old version of the module.

Removing directories is another story. CVS will optionally remove empty directories when you update one of its parent directories. If you want to get rid of an empty directory, do the following:
1. Select the parent directory of the empty directory you want to remove.
2. Click the right mouse button on the selection, and choose the Update selection menu item.
3. Select the Globals tab.
4. Make sure Prune (remove) empty directories is checked (it is by default).
5. Press the OK button.

The directory will be removed if all its files were previously removed from your local copy and from the repository.

Using Branch with WinCVS

How to setup a fix branch?


Step 1: Initial Situation: Let’s suppose
A. R-0-1-0 installed in production.
B. The current version of file1.txt is 1.3.
C. We have a production issue now. Meaning we have a bug in release R-0-1-0.

Step 2: Setup fix branch, F-0-1-0, for R-0-1-0 in CVS server.

A. Create -> Select the “Create a branch by module” menu item. -> In Create branch settings window, enter a tag/branch name “F-0-1-0” in the “New branch name” input field. Enter “CVSBranchTest” in the “Module to fork:” field. -> Under “Optionally use this revision/tag/date to create the branch”, check “Fork from this rev./tag” and enter “R-0-1-0”

B. Uncheck “Checkout read-only” option in Globals tab window.

C. Press the OK button

D. Verify the branch creatation: Within CVSBranchMain tree, right click on the file, file1.txt, and select “Graph select” option -> In Local setting window, click on OK button. -> Verify that “F-0-1-0” created as below:

Step 3: Selecting the Fix Branch to Work on:

To start working on a branch instead of the default development line, you have to bind your local copy to the branch. This is needed to make sure that actions such as updates, commits etc. work on the branch rather than on the main line of development.

To prepare your local copy to another branch, do the following:
A. Following Checkout Initial Release Module to checkout CVSBranchTest into CVSBranchF010 directory.
B. Verify F-0-1-0 checkout.
C. After working on file1.txt, right click on file1.txt file and select “Commit selection…” -> Enter the commit comment in the Commit settings window, and then click on OK button.

Step 4: Verify fixed version of the updated file: Right click on file1.txt stored in CVSBranchF010 directory -> Select “Graph selection…” -> Verify a version 1.2.2.1 is created under the F-0-1-0 branch.

Step 5: Repeating a few times for testing…

Step 6: Fix/Patch Release: Create new “R-0-1-1” tag for F-0-1-0 branch.
Create a tag by module… -> Enter the following info into Create tag settings window and then click on OK button.

Step 7: Verify Fix/Patch Release:
Right click on file1.txt stored under CVSBranchF010 folder à Select Graph select and click on OK button on the “Log settings” window.

How to merge fix branch into main?

When you are satisfied with the changes you have done on a branch, you may want those changes to be available on the main line of development. Incorporating changes from one branch to another, is known as merging. To merge from a branch, do the following:

Step 1: Right click on CVSBranchMain folder and select “Update selection…” option.

Step 2: Make sure “Create missing directories that exist in the repository” is checked.

Step 3: Select the Merge options tab -> Click the Only this rev./tag radio button -> In the Only this rev./tag input field, enter the tag/branch name,”R-0-1-1”. If you want to merge from a given timestamp in this tag, check the Date radio button and type in your preferred timestamp as well. -> Click on OK button.

Note: Any changes on the branch F-0-1-0 (or tag R-0-1-1) will now be merged into your local copy under CVSBranchMain folder.

How to merge fix branch into main?

When you are satisfied with the changes you have done on a branch, you may want those changes to be available on the main line of development. Incorporating changes from one branch to another, is known as merging. To merge from a branch, do the following:

Step 1: Right click on CVSBranchMain folder and select “Update selection…” option.
Step 2: Make sure “Create missing directories that exist in the repository” is checked.
Step 3: Select the Merge options tab -> Click the Only this rev./tag radio button -> In the Only this rev./tag input field, enter the tag/branch name,”R-0-1-1”. If you want to merge from a given timestamp in this tag, check the Date radio button and type in your preferred timestamp as well. -> Click on OK button.

Note: Any changes on the branch F-0-1-0 (or tag R-0-1-1) will now be merged into your local copy under CVSBranchMain folder.

How to resolve conflicts?

Once in a while, the CVS server will report a conflict when you update your files from the repository. A conflict occurs when two or more developers have changed the same few lines of a file. As CVS knows nothing of your project, it leaves resolving the conflicts to the developers. Whenever a conflict is reported, you should open the file in question, and search for lines starting with the string <<<<<<<. The conflicting area is marked like this:

<<<<<<< filename your changes ======= code merged from repository >>>>>>> revision
You should decide what the code should look like, do the necessary changes, remove the CVS markup, and commit your modifications to the repository.

If you would like a more graphical diff tool, there are several to go for. Download and install your preferred tool, then go to Admin -> Preferences / WinCvs menu item and check the External diff program checkbox, find your tool and click OK. Then, in the Diff -> Selection menu item, check the Use the external diff checkbox to use it.
cvs -z9 update -P -d -jR-0-1-1 (in directory C:\cygwin\home\hsual\alhsu\AlHome\CVSBranchMain\)
RCS file: /opt/cvs/CVSBranchTest/file1.txt,v
retrieving revision 1.2
retrieving revision 1.2.2.5
Merging differences between 1.2 and 1.2.2.5 into file1.txt
rcsmerge: warning: conflicts during merge

*****CVS exited normally with code 0*****

Step 5: Resolving Conflicts
Remove the lines in red below in file1.txt file: Suppose the lines in blue below are correct.
hsual@psgltpe014 $
hsual@psgltpe014 $ pwd
/home/hsual/alhsu/AlHome/CVSBranchMain
hsual@psgltpe014 $
hsual@psgltpe014 $ ls -a
./  .#file1.txt.1.8*  ../  CVS/  file1.txt*  file2.txt*  file3.txt*
hsual@psgltpe014 $
hsual@psgltpe014 $ more file1.txt
<<<<<<< file1.txt
file1 initial version.
Update this file for release R-0-1-0 (Release-Year-Month-Fix/Patch) changed for F-0-1-0 branch.
00.UPDATE 1.4
=======
file1 initial version.
Update this file for release R-0-1-0 (Release-Year-Month-Fix/Patch) changed for F-0-1-0 branch.
00. UPDATE 1.2.2.3
>>>>>>> 1.2.2.5
hsual@psgltpe014 $ edit file1.txt
hsual@psgltpe014 $ more file1.txt
file1 initial version.
Update this file for release R-0-1-0 (Release-Year-Month-Fix/Patch) changed for F-0-1-0 branch.
00. UPDATE 1.2.2.3
hsual@psgltpe014 $
After editing the file, do a Diff on file1.txt file: Right click on file1.txt file -> Diff selection… -> Select “Compare your local file with another revision/tag/branch/date:” option -> Enter “R-0-1-1” as below:
cvs -z9 diff -r R-0-1-1 file1.txt (in directory C:\cygwin\home\hsual\alhsu\AlHome\CVSBranchMain\)
 
*****CVS exited normally with code 0*****
Step 6: Right click on CVSBranchMain folder and select “Update selection…” option.

Step 7: Make sure “Create missing directories that exist in the repository” is checked.

Step 8: Select the Merge options tab -> Click the Only this rev./tag radio button -> In the Only this rev./tag input field, enter the tag/branch name,”R-0-1-1”. If you want to merge from a given timestamp in this tag, check the Date radio button and type in your preferred timestamp as well. -> Click on OK button.

Step 9: Commit update: Right click on CVSBranchMain à Select Commit selection… -> Enter comment -> click OK.

Using Tag with WinCVS

Assign R-0-0-0 tag for new project Release 0.0.0


Step 1: Create -> Create a tag by module…

Step 2: On Create tag settings window: Enter the tag name and which module to tag “R-0-0-0” into the New tag name field. Enter “CVSBranchTest” into Module to tag field. -> Click OK

Note:

1. Tag must start with a letter.
cvs rtag 0.0.0 CVSBranchTest
cvs [rtag aborted]: tag `0.0.0' must start with a letter

2. Tag must not contain the characters `$,.:;@'
cvs rtag R.0.0.0 CVSBranchTest
cvs [rtag aborted]: tag `R.0.0.0' must not contain the characters `$,.:;@'

Step 3: Check status of the source file: Right click on file3.txt -> Select “Status selection” option

Step 4: Verify “R-0-0-0” tag displayed under Existing Tags:
cvs -z9 status -v file3.txt (in directory C:\cygwin\home\hsual\alhsu\AlHome\CVSBranchTest\)
===================================================================
File: file3.txt        Status: Up-to-date

   Working revision:    1.1.1.1
   Repository revision: 1.1.1.1       /opt/cvs/CVSBranchTest/file3.txt,v
   Sticky Tag:          R-0-0-0 (revision: 1.1.1.1)
   Sticky Date:         (none)
   Sticky Options:      (none)

   Existing Tags:
   R-0-0-0                    (revision: 1.1.1.1)
   INITIAL                    (revision: 1.1.1.1)
   ALHSU                      (branch: 1.1.1)

*****CVS exited normally with code 0*****

Assign R-0-1-0 tag for CVSBranchTest project Release 0.1.0


Step 1: Following the same steps of "Assign R-0-0-0 tag for new project Release 0.0.0" to create R-0-1-0 from CVSBranchMain directory, and then following "Checkout Initial Release Module" to checkout CVSBranchTest into CVSBranchR010 directory.

Step 2: Verify R-0-1-0 checkout.

Remove a tag from module

Suppose we are going to delete R-0-1-1 tag on CVSBranchTest module. Follow the steps below via WinCVS 1.2.

Step 1: Create -> Delete a tag by module …

Step 2: On Delete tag settings windows:
Enter “R-0-1-1” in Delete tag name field -> Enter “CVSBranchTest” into Module to untag field. -> Click on OK button.

Step 3: Verify Result: Note that the R-0-1-1 tag is removed from Graph selection window.
Click on “CVSBranchMain” folder -> Right click on file1.txt file -> Select “Graphic selection…” option -> On Log settings windows, click on OK button.
cvs -z9 rtag -d R-0-1-1 CVSBranchTest

*****CVS exited normally with code 0*****

Thursday, January 6, 2011

Checkout Module with WinCVS

We are going to checkout the “CVSBranchTest” module from CVS server. If the CVSBranchTest module does not exist in CVS server, please refer to “Import Module with WinCVS” in this document.

Step 1: Create -> Checkout module…


Step 2: Type in checkout module/directory, “CVSBranchTest”, in Checkout settings window.

If the Override option is not checked and “Checkout as” is not assigned, this checkout process will create a directory named “CVSBranchTest” under the path listed in “Local folder to checkout to” text box.

Step 3: Verify checkout directory:

Right click on “AlHome” folder and select “Reload view” option -> Click on “CVSBranchTest” folder and verify the files being checked out from CVS source.
Refer to Some files get checked out read-only

Step 4: Reset File Permission: Refer to Some files get checked out read-only
hsual@psgltpe014 $ 
hsual@psgltpe014 $ pwd
/home/hsual/alhsu/AlHome/CVSBranchTest
hsual@psgltpe014 $ ll
total 3
drwxrwxrwx+   2 hsual    Users        4096 Jan 23 16:13 CVS/
-r-xr-xr-x    1 hsual    Users          22 Jan 23 16:05 file1.txt*
-r-xr-xr-x    1 hsual    Users          22 Jan 23 16:05 file2.txt*
-r-xr-xr-x    1 hsual    Users          22 Jan 23 16:05 file3.txt*
hsual@psgltpe014 $ chmod 777 *
hsual@psgltpe014 $ 
hsual@psgltpe014 $ ll
total 3
drwxrwxrwx+   2 hsual    Users        4096 Jan 23 16:13 CVS/
-rwxrwxrwx    1 hsual    Users          22 Jan 23 16:05 file1.txt*
-rwxrwxrwx    1 hsual    Users          22 Jan 23 16:05 file2.txt*
-rwxrwxrwx    1 hsual    Users          22 Jan 23 16:05 file3.txt*
hsual@psgltpe014 $
Step 5: Verify File Permission: Refer to Some files get checked out read-only

Some files get checked out read-only in WinCVS

Check your umask. Set your umask to 0001 in .bash_profile file in your Cygwin home directory.
Note:
1. If your umask is 022 your files will be 644.
2. If your umask is 02 your files will be 664.
3. If your umask is 0 your files will be 666.

Uncheck the ‘Checkout read-only’ option in WinCvs Preferences or in Checkout settings -> Globals

Import Module with WinCVS

Step 1: Create -> Import module …


Step 2: Select “module”/directory and then click on OK button.

Step 3: Click “Continue” button on the Import filter window:

Step 4: Edit Import Settings and then click on OK button. Enter “CVSBranchTest” into the text box of Select the module name and path on the remote server. Enter “ALHSU” into Vendor tag text box. Enter “INITIAL” into Release tag.

Step 5: Verify Message in Console window:
cvs import -I ! -I CVS -m "no message" CVSBranchTest ALHSU INITIAL (in directory C:\cygwin\home\hsual\alhsu\AlHome\CVSBranchTest)
N CVSBranchTest/file1.txt
N CVSBranchTest/file2.txt
N CVSBranchTest/file3.txt

No conflicts created by this import


*****CVS exited normally with code 0*****

How to reset dynamic IP address?

code:--------------------------------------------------------------------------------
@ECHO OFF
%WINDIR%\system32\ipconfig /release
echo.
echo Ip-adress released  Make sure you wait about 5 minutes for someone to take your old IP-adress.
echo.
pause
%WINDIR%\system32\ipconfig /renew
echo.
echo Ip-adress renewed
echo.
pause
exit
--------------------------------------------------------------------------------

Explanation:
%WINDIR%\system32\ipconfig /release <-- tells command prompt to look for a program named ipconfig in your \system32 folder and start it with the option /release. (which releases your ip so other people can take it, and enables you to get a new one.)

%WINDIR%\system32\ipconfig /renew <-- tells command prompt the same as above, only with the option /renew. (which renews your IP-address hoping that someone took your old. @ECHO OFF <-- tells the command prompt to hide paths (Like C:\windows\system32\ipconfig /renew wont be shown on screen.) echo. <-- tells command promt to jump a line down without displaying any text or doing anything at all. echo <-- prints a message to the screen in command prompt.

pause <-- makes you have to press a key to continue with the script.

exit <-- exits command prompt.

How to get my local IP address?

Using ipconfig, grep, and awk commands.

hsual@psgltpe014 $ ipconfig | awk '{ print NF, $0 }'
1 
4 Windows 2000 IP Configuration
1 
3 Ethernet adapter CPQTUN:
1 
6       Connection-specific DNS Suffix  . : 
15      IP Address. . . . . . . . . . . . : 0.0.0.0
15      Subnet Mask . . . . . . . . . . . : 0.0.0.0
13      Default Gateway . . . . . . . . . : 
1 
5 Ethernet adapter Local Area Connection:
1 
6       Connection-specific DNS Suffix  . : aaa.bbb.ccc.corp
15      IP Address. . . . . . . . . . . . : 10.22.10.2
15      Subnet Mask . . . . . . . . . . . : 255.255.255.0
13      Default Gateway . . . . . . . . . : 10.22.10.1


hsual@psgltpe014 $ ipconfig | grep IP.Address | grep -v 0.0.0.0 | awk '{ print $15 }'
10.22.10.2
hsual@psgltpe014 $ 

隨便彈談 - Review Play List



多聽 多看 多練習 Play it on Youtube: http://www.youtube.com/watch?v=zRAXA6Nn-mg&list=PL4C516E953A5614C6&feature=plpp_play_all

Wednesday, January 5, 2011

隨便彈談 - 鄧麗君 但願人長久 『水調歌頭』

作詞: 蘇軾 東坡居士 作曲: 梁弘志 原名: 『水調歌頭』

明月幾時有,把酒問青天
不知天上宮闕,今夕是何年

我欲乘風歸去,唯恐瓊樓玉宇,
高處不勝寒,起舞弄清影,何似在人間

轉朱閣,低綺戶,照無眠
不應有恨,何事長向別時圓 (別時圓)

人有悲歡離合,月有陰晴圓缺
此事古難全,但願人長久,千里共嬋娟

Tuesday, January 4, 2011

隨便彈談 - 張宇 囚鳥



12/16/2010:

歌名:囚鳥
作曲:張宇, 編曲:屠穎, 填詞:十一郎

我是被你囚禁的鳥
已經忘了天有多高
如果離開你給我的小小城堡
不知還有誰能依靠

我是被你囚禁的鳥
得到的愛越來越少
看著你的笑在別人眼中燃燒
我卻要不到一個擁抱

我像是一個你可有可無的影子
冷冷的看著你說謊的樣子
這撩亂的城市容不下我的癡
是什麼讓你這樣迷戀這樣的放肆

我像是一個你可有可無的影子
和寂寞交換著悲傷的心事
對愛無計可施
這無味的日子
(我的)眼淚是唯一的奢侈