clearcase introduction ii - sandbox

40
Introduction to ClearCase II v 1.2 Vít Hrachový Prague, 26 September 2007

Upload: others

Post on 06-Jan-2022

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Clearcase introduction II - Sandbox

Introduction to ClearCase II

v 1.2

Vít Hrachový

Prague, 26 September 2007

Page 2: Clearcase introduction II - Sandbox

Running X Applications

Running Remote Applications

X server (your PC) - start X (Xfre86e, Reflection) - get IP (/sbin/ifconfig, ipconfig)

X clientset display to your IP, e.g.- export DISPLAY=<IP_ADDRESS>:0

1) Start X server (if needed)

2) get your local IP address

3) log in to the remote machine - via: telnet, ssh, rsh ...

4) set the DISPLAY variable

5) run your favourite GUI application :-)

Page 3: Clearcase introduction II - Sandbox

X settings

X Server settings

• edit ~/.Xdefaults to suit your needs (colors, fonts)

• create script to automatically update ~/.display when you boot/login to your PC

Reflection

• set it to run /usr/local/bin/xterm

• and on UNIX: export COLORTERM=yes

• set keys: BackSpace to generate ^HDelete to generate ^[[3~ (or ^?)

Page 4: Clearcase introduction II - Sandbox

Working with ClearCase CLI

1. Log in to the ClearCase host

2. (if not automated by your rc scripts)Set your DISPLAY, add PATH /usr/atria/bin, create the 'ct' shortcut, e.g.:

➢ bash

➢ export DISPLAY=158.234.174.114:0

➢ export PATH=$HOME/bin:/usr/atria/bin:$PATH

➢ mkdir -p ~/bin

➢ ln -s /usr/atria/bin/cleartool ~/bin/ct

3. (if not automated by your rc scripts)Set your view

➢ ct setview VIEW_NAME # the same as our login name

Page 5: Clearcase introduction II - Sandbox

ClearCase - Getting Help

1. GUI Help

➢ xclearcase/ClearCase Explorer/ClearCase Home➢ menu Help (requires web browser, same source as 3.)

2. CLI Help

➢ ct <command> -h # short online help

➢ ct man <command / or something:-)>➢ (e.g.: cleartool ci config_spec findmerge mkbrtype)

3. WWW

➢ Documentation is available in form of web pages

Page 6: Clearcase introduction II - Sandbox

directory elementversions

file element

view-private

files

checked-out

version

View/VOB concept

View

VOB

Config spec / MVFS

Page 7: Clearcase introduction II - Sandbox

Creating new Element

1. Ensure, that your config-spec is correct➢ ct setcs -default # set the default - only for Training purposes➢ ct catcs # print current CS

2. Check out the directory➢ cd /data/ccase/training/`whoami`/➢ ct co -c 'adding new index.html' .

3. Make an element, edit it➢ ct mkelem -nc index.html➢ vi index.html

4. Check in the directory and the element

➢ ct lsco # list the checked-out files/directories )

➢ ct ci . index.html

Page 8: Clearcase introduction II - Sandbox

Removing Element

• ct rmname – removes element references from actual directory version

– Check out the directory

➢ cd /vobs/training/`whoami`/➢ ct co -c 'CR12345 – remove obsolete files' .

– Remove the files, links, directories

➢ ct rmname -nc obsolete-file obsolete_link obsoleteDir

– Check in the directory

➢ ct ci -nc .

• ct rmelem – destroys complete element with all its history

– DON'T use rmelem at all, unless you really know what you're doing!!!

Page 9: Clearcase introduction II - Sandbox

Information about Elements

1. Information about the current version of a file➢ ct describe index.html➢ ct describe -g index.html # GUI version - most commands

accept -g

2. History of an element➢ ct lshist index.html

3. Version tree➢ ct lsvtree [ -g ] index.html

4. What is the current version?

➢ ct ls

➢ ct ls -d /data/ccase/training # -d = directory itself, not contents

Page 10: Clearcase introduction II - Sandbox

Test 1

1. Change the index.html file. Add your name to it.

➢ Tip:➢ checkout the file➢ edit it➢ check it in

ct co -nc index.htmlvi index.htmlct ci -c 'name added' index.html

( ct describe index.html )

Page 11: Clearcase introduction II - Sandbox

Branches

Branches are used for:

1.The default stream for a product / component(e.g. “HAB_0.1”); - stable branch

2.Customer specific files, differentlanguages, etc.(e.g. “HAB_0.1_German”)

3.Task branches - to be merged to the default stream as soon as they are stable.(e.g. “XSLT_fix_HABD0123456”or “Lizard_HABD0123456”) - Remedy ticket no.

4.Bug fixes of an old version(e.g. “Rel_1.0_Fixes”, with Lizard_HABD012346 sub-branches)

Page 12: Clearcase introduction II - Sandbox

Creating Branches

1. Create a branch type➢ ct mkbrtype BRANCH_NAME

2. Set your CS, so you can see the branch (latest version on it)

3. and if wanted - set your CS, so the branch is automatically created during a check-out

➢ ct edcs # edit config spec

4. The branch on a specific file will be created when you➢ ct mkbranch -nc BRANCH_NAME index.html # or➢ ct co index.html # or➢ ct mkelem new_file

element * CHECKEDOUTelement * .../BRANCH_NAME/LATESTelement * /main/LATEST -mkbranch BRANCH_NAME

Page 13: Clearcase introduction II - Sandbox

Test 2

1. Create a German version of index.html on a branch “HAB_0.1_German” and

2. Create a new file “default.css” (on the same branch)

➢ Tip:➢ don't forget to checkout the dir

ct mkbrtype HAB_0.1_Germanct edcs # see belowct co -nc index.htmlvi index.htmlct ci -nc index.html

ct co .ct mkelem default.cssvi default.cssct ci -nc . default.csselement * CHECKEDOUTelement * .../HAB_0.1_German/LATESTelement * /main/LATEST -mkbranch HAB_0.1_German

Page 14: Clearcase introduction II - Sandbox

Test 3

1. Set config. spec to show the latest version of the main branch.

2. List the directory contents

3. Where did the 'default.css' file go ?

➢ Tip:➢ save your current config spec to a file:

ct catcs > ~/branch_config_spec.cs(you can reuse it later by: ct setcs FILE)

ct edcs # edit CSls#or: ct setcs -default#the file is in a different version of the current directory

element * CHECKEDOUTelement * /main/LATEST

Page 15: Clearcase introduction II - Sandbox

Merge

• Merging changes

– set config spec to the target versionct edcs

– create a batch filect findmerge . -fver .../Lizard_PSADjirkat/LATEST -print

– or run graphical mergect findmerge . -fver .../Lizard_PSADjirkat/LATEST -gmerge

– or run merge manuallyct co best.cct merge -g -to index.html \ index.html@@/main/HAB_0.1_German/LATEST

element * CHECKEDOUTelement * /main/LATEST

Page 16: Clearcase introduction II - Sandbox

Merge

• Merge result

– check inct ci index.html

Page 17: Clearcase introduction II - Sandbox

Labels

Label is a symbolic name of a certain version of an element

– There must be a label type defined, before the label can be used.

# make a label type

• ct mklbtype Stable_1

# place it on the current versions of the elements

• ct mklabel Stable_1 default.css index.html .

# look at the version tree

• ct lsvtree -g index.html

Page 18: Clearcase introduction II - Sandbox

Labels

In config. spec, you can refer to a version using a label

element * CHECKEDOUT# for all elements under /vobs/cm/training# show the version labeled “Stable_1”element /vobs/cm/training/... Stable_1element * /main/LATEST -mkbranch BRANCH_NAME

Page 19: Clearcase introduction II - Sandbox

Miscellany

–Both branch type objects and label type objects can be locked to prevent unwanted reusal.

– 'cleartool find' is a powerful tool

–AdminVob – concept of centralized label and branch type administration

–MultiSite – concept of VOBs synchronized across the globe

• branch masterships

• deltas / packet synchronization

ct lock lbtype:Stable_0.8

Page 20: Clearcase introduction II - Sandbox

ClearCase

Questions, comments?

Page 21: Clearcase introduction II - Sandbox

1

Introduction to ClearCase II

v 1.2

Vít Hrachový

Prague, 26 September 2007

Page 22: Clearcase introduction II - Sandbox

2

Running X Applications

Running Remote Applications

X server (your PC) - start X (Xfre86e, Reflection) - get IP (/sbin/ifconfig, ipconfig)

X clientset display to your IP, e.g.- export DISPLAY=<IP_ADDRESS>:0

1) Start X server (if needed)

2) get your local IP address

3) log in to the remote machine - via: telnet, ssh, rsh ...

4) set the DISPLAY variable

5) run your favourite GUI application :-)

Page 23: Clearcase introduction II - Sandbox

3

X settings

X Server settings

• edit ~/.Xdefaults to suit your needs (colors, fonts)

• create script to automatically update ~/.display when you boot/login to your PC

Reflection

• set it to run /usr/local/bin/xterm

• and on UNIX: export COLORTERM=yes

• set keys: BackSpace to generate ^HDelete to generate ^[[3~ (or ^?)

Page 24: Clearcase introduction II - Sandbox

4

Working with ClearCase CLI

1. Log in to the ClearCase host

2. (if not automated by your rc scripts)Set your DISPLAY, add PATH /usr/atria/bin, create the 'ct' shortcut, e.g.:

➢ bash

➢ export DISPLAY=158.234.174.114:0

➢ export PATH=$HOME/bin:/usr/atria/bin:$PATH

➢ mkdir -p ~/bin

➢ ln -s /usr/atria/bin/cleartool ~/bin/ct

3. (if not automated by your rc scripts)Set your view

➢ ct setview VIEW_NAME # the same as our login name

Page 25: Clearcase introduction II - Sandbox

5

ClearCase - Getting Help

1. GUI Help

➢ xclearcase/ClearCase Explorer/ClearCase Home➢ menu Help (requires web browser, same source as 3.)

2. CLI Help

➢ ct <command> -h # short online help

➢ ct man <command / or something:-)>➢ (e.g.: cleartool ci config_spec findmerge mkbrtype)

3. WWW

➢ Documentation is available in form of web pages

Page 26: Clearcase introduction II - Sandbox

6

directory elementversions

file element

view-private

files

checked-out

version

View/VOB concept

View

VOB

Config spec / MVFS

• For a snapshot view, the user would just be seeing a local copy of each element, so just the top rectangle showing the file system as seen by the user would depict this.

Page 27: Clearcase introduction II - Sandbox

7

Creating new Element

1. Ensure, that your config-spec is correct➢ ct setcs -default # set the default - only for Training purposes➢ ct catcs # print current CS

2. Check out the directory➢ cd /data/ccase/training/`whoami`/➢ ct co -c 'adding new index.html' .

3. Make an element, edit it➢ ct mkelem -nc index.html➢ vi index.html

4. Check in the directory and the element

➢ ct lsco # list the checked-out files/directories )

➢ ct ci . index.html

Page 28: Clearcase introduction II - Sandbox

8

Removing Element

• ct rmname – removes element references from actual directory version

– Check out the directory

➢ cd /vobs/training/`whoami`/➢ ct co -c 'CR12345 – remove obsolete files' .

– Remove the files, links, directories

➢ ct rmname -nc obsolete-file obsolete_link obsoleteDir

– Check in the directory

➢ ct ci -nc .

• ct rmelem – destroys complete element with all its history

– DON'T use rmelem at all, unless you really know what you're doing!!!

Page 29: Clearcase introduction II - Sandbox

9

Information about Elements

1. Information about the current version of a file➢ ct describe index.html➢ ct describe -g index.html # GUI version - most commands

accept -g

2. History of an element➢ ct lshist index.html

3. Version tree➢ ct lsvtree [ -g ] index.html

4. What is the current version?

➢ ct ls

➢ ct ls -d /data/ccase/training # -d = directory itself, not contents

Page 30: Clearcase introduction II - Sandbox

10

Test 1

1. Change the index.html file. Add your name to it.

➢ Tip:➢ checkout the file➢ edit it➢ check it in

ct co -nc index.htmlvi index.htmlct ci -c 'name added' index.html

( ct describe index.html )

Page 31: Clearcase introduction II - Sandbox

11

Branches

Branches are used for:

1.The default stream for a product / component(e.g. “HAB_0.1”); - stable branch

2.Customer specific files, differentlanguages, etc.(e.g. “HAB_0.1_German”)

3.Task branches - to be merged to the default stream as soon as they are stable.(e.g. “XSLT_fix_HABD0123456”or “Lizard_HABD0123456”) - Remedy ticket no.

4.Bug fixes of an old version(e.g. “Rel_1.0_Fixes”, with Lizard_HABD012346 sub-branches)

Page 32: Clearcase introduction II - Sandbox

12

Creating Branches

1. Create a branch type➢ ct mkbrtype BRANCH_NAME

2. Set your CS, so you can see the branch (latest version on it)

3. and if wanted - set your CS, so the branch is automatically created during a check-out

➢ ct edcs # edit config spec

4. The branch on a specific file will be created when you➢ ct mkbranch -nc BRANCH_NAME index.html # or➢ ct co index.html # or➢ ct mkelem new_file

element * CHECKEDOUTelement * .../BRANCH_NAME/LATESTelement * /main/LATEST -mkbranch BRANCH_NAME

Page 33: Clearcase introduction II - Sandbox

13

Test 2

1. Create a German version of index.html on a branch “HAB_0.1_German” and

2. Create a new file “default.css” (on the same branch)

➢ Tip:➢ don't forget to checkout the dir

ct mkbrtype HAB_0.1_Germanct edcs # see belowct co -nc index.htmlvi index.htmlct ci -nc index.html

ct co .ct mkelem default.cssvi default.cssct ci -nc . default.csselement * CHECKEDOUTelement * .../HAB_0.1_German/LATESTelement * /main/LATEST -mkbranch HAB_0.1_German

Page 34: Clearcase introduction II - Sandbox

14

Test 3

1. Set config. spec to show the latest version of the main branch.

2. List the directory contents

3. Where did the 'default.css' file go ?

➢ Tip:➢ save your current config spec to a file:

ct catcs > ~/branch_config_spec.cs(you can reuse it later by: ct setcs FILE)

ct edcs # edit CSls#or: ct setcs -default#the file is in a different version of the current directory

element * CHECKEDOUTelement * /main/LATEST

Page 35: Clearcase introduction II - Sandbox

15

Merge

• Merging changes

– set config spec to the target versionct edcs

– create a batch filect findmerge . -fver .../Lizard_PSADjirkat/LATEST -print

– or run graphical mergect findmerge . -fver .../Lizard_PSADjirkat/LATEST -gmerge

– or run merge manuallyct co best.cct merge -g -to index.html \ index.html@@/main/HAB_0.1_German/LATEST

element * CHECKEDOUTelement * /main/LATEST

Page 36: Clearcase introduction II - Sandbox

16

Merge

• Merge result

– check inct ci index.html

Page 37: Clearcase introduction II - Sandbox

17

Labels

Label is a symbolic name of a certain version of an element

– There must be a label type defined, before the label can be used.

# make a label type

• ct mklbtype Stable_1

# place it on the current versions of the elements

• ct mklabel Stable_1 default.css index.html .

# look at the version tree

• ct lsvtree -g index.html

Page 38: Clearcase introduction II - Sandbox

18

Labels

In config. spec, you can refer to a version using a label

element * CHECKEDOUT# for all elements under /vobs/cm/training# show the version labeled “Stable_1”element /vobs/cm/training/... Stable_1element * /main/LATEST -mkbranch BRANCH_NAME

Page 39: Clearcase introduction II - Sandbox

19

Miscellany

–Both branch type objects and label type objects can be locked to prevent unwanted reusal.

– 'cleartool find' is a powerful tool

–AdminVob – concept of centralized label and branch type administration

–MultiSite – concept of VOBs synchronized across the globe

• branch masterships

• deltas / packet synchronization

ct lock lbtype:Stable_0.8

Page 40: Clearcase introduction II - Sandbox

20

ClearCase

Questions, comments?