volvo information technology 1 1 16/10/2015 xml presentation clearcase basics

69
Volvo Information Technology XML presentation 1 1 20/06/22 ClearCase Basics

Upload: jordan-bishop

Post on 01-Jan-2016

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 1

1 20/04/23

ClearCase Basics

Page 2: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 2

2 20/04/23

Contents

• Introduction • ClearCase Concepts• Simple ClearCase Use Case• ClearCase GUI and CLI• Version Control of Directories• Config Spec • Labels, Branches, Merge• Comparing Files and Folder versions• Version extended pathnames

Page 3: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 3

3 20/04/23

Introduction – The CM Nightmare

Foo.c include head.h …………..

Foo.c include header2.h …………..

Foo.bak

Foo.c include header.h hello…………..

C:\dev\Foo.c

Foo.c include header.h when…………..

C:\dev\new\Foo.cFoo.old

Which of these went into release 2?Which of these has bug 34 corrected?Who made that change on line 54? Where are Joe’s changes?

Which of these went into release 2?Which of these has bug 34 corrected?Who made that change on line 54? Where are Joe’s changes?

Page 4: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 4

4 20/04/23

Introduction – ClearCase basic Functions

• Version Control

VOB

• Workspace Management

View

• Process Control

Trigger

• Release Management

Label, attribute

src/src/

bar.c

foo.cfoo.h

REL1.0 TESTED=”yes”

Page 5: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 5

5 20/04/23

ClearCase Concepts some keywords

VOB - Version Object Base

View – Workspace

Element - file or directory

Branch – A way to make parallel development possible.

Label – Tag

Attribute - Name/value pair

Page 6: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 6

6 20/04/23

ClearCase Concepts – A VOB is…

• Version Object Base

• A file system where ClearCase stores all version controlled files and directories.

• Contents of a VOB is accessed using views

• A VOB is visible on a client if mounted

Page 7: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 7

7 20/04/23

ClearCase Concepts – An Element is…

• A file or a directory that is version controlled in ClearCase.

• Each element has a version tree.

Page 8: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 8

8 20/04/23

ClearCase Concepts – A Branch is…

• A way of making parallel development possible

• Used to organize the different versions of files and directories

• An object that specifies a linear sequence of versions of an element

• The entire set of an elements versions and branches are called a versiontree.

Page 9: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 9

9 20/04/23

ClearCase Concepts – A Version Tree

Page 10: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 10

10 20/04/23

ClearCase Concepts – A View is…

• A workspace

• Selects one version of each element in every mounted/selected VOB, presented in a directory structure.

• Two types of Views– Dynamic– Snapshot

Page 11: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 11

11 20/04/23

ClearCase Concepts – Attribute and label is

• Label – is a ”tag” to mark certain versions of a file, directory or a hole ”product structure”. E.g. to ”freeze” code at a specific release.

• Attribute – a name/value pair used to describe a ClearCase object. E.g. TESTED=”yes”

Page 12: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 12

12 20/04/23

ClearCase Concepts – Elements in a VOB

sourcemod.java

Public class

{

Public void…

getA()

-

}

Public class

{

Public void…

Int getA()

-

}

Public class

{

Public void…

Int getA(int i)

Int getB()

-

}

Page 13: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 13

13 20/04/23

ClearCase Concepts – VOB & View

View private storage

Visible versions are filtered by config spec rulesConfig Spec

Checked out version

Workspace

VOB

View

Page 14: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 14

14 20/04/23

View Configuration

sourcemod.java

Config

1C

onfig 2

Page 15: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 15

15 20/04/23

Working a view

• Checking out a file– Actually creates a copy in

the view

• Undo Checkout for file, can leave a *.keep file as a view private file.

Page 16: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 16

16 20/04/23

Simple ClearCase Use Case

Check-out fileMark and right click Checkout

Foo.c include header.h …………..

Edit file

Checkin FileMark and right click Checkin

Access ClearCase:Start View, Mount VOB

Page 17: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 17

17 20/04/23

Simple ClearCase Use Case #1

Bar.c1

2

REL2

Jane’s ViewJoe’s ViewVOB REL1

Foo.c

3

4

1

2

REL2

Page 18: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 18

18 20/04/23

Simple ClearCase Use Case #2

Bar.c1

2

REL2

Jane’s ViewJoe’s ViewVOB

CheckoutCheckout

REL1

Foo.c

3

4

1

2

REL2

Page 19: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 19

19 20/04/23

Simple ClearCase Use Case #3

Bar.c1

2

REL2

Jane’s ViewJoe’s ViewVOB

Edit fileEdit file

Foo.c include header.h …………..

REL1

Foo.c

3

4

1

2

REL2

Page 20: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 20

20 20/04/23

Simple ClearCase Use Case #4

Bar.c1

2

REL2

Jane’s ViewJoe’s ViewVOB

CompileCompile

Foo.c include header.h …………..

Foo.exe

Foo.o

REL1

Foo.c

3

4

1

2

REL2

Page 21: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 21

21 20/04/23

Simple ClearCase Use Case #5

Bar.c1

2

REL2

Jane’s ViewJoe’s ViewVOB

Checkin fileCheckin file

Foo.exe

Foo.o

REL1

Foo.c

3

4

1

2

REL2

Page 22: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 22

22 20/04/23

Simple ClearCase Use Case #6

Bar.c1

2

REL2

Jane’s ViewJoe’s ViewVOB

Checkin fileCheckin file

Foo.exe

Foo.o

REL1

Foo.c

3

4

1

2

REL2

5

Page 23: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 23

23 20/04/23

Simple ClearCase Use Case #7

Bar.c1

2

REL2

Jane’s ViewJoe’s ViewVOB

Foo.exe

Foo.o

REL1

Foo.c

3

4

1

2

REL2

5

Page 24: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 24

24 20/04/23

Working in ClearCase

• ClearCase Explorer

• Windows Explorer

• ClearCase CLI: cleartool

• Tool integration

Page 25: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 25

25 20/04/23

Windows Explorer

• The Windows Explorer is used to work in ClearCase– Access files– NO ClearCase move– NO ClearCase remove– NO ClearCase rename– Entire filesystem

Page 26: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 26

26 20/04/23

ClearCase Explorer

• Use the ClearCase explorer to work in ClearCase:– Access files

– ClearCase move

– ClearCase rename

– ClearCase remove

Page 27: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 27

27 20/04/23

ClearCase GUI

Context menu

Menues

ToolBox

Help

Page 28: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 28

28 20/04/23

ClearCase GUI

Version Tree

View

VOB

Elements

Page 29: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 29

29 20/04/23

ClearCase CLI interface:cleartool

1

Same Syntax as UNIX ClearCaseSame Syntax as UNIX ClearCase

Page 30: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 30

30 20/04/23

Working in a view

• Storing files in a view – Does not share these files to everybody working in the VOB. – These files are View-private and only seen by those working in that

particular view.

• Not seen by others until they are put under source control

Page 31: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 31

31 20/04/23

Creating and Changing Elements

• Version controlled elements are created using ”Add to source control” command

• In order to edit an element, it has to be “Checked Out”

• Changes are committed using the “Check in” command

Page 32: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 32

32 20/04/23

Find Checkouts

• In order to find checked out elements

Page 33: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 33

33 20/04/23

ClearCase GUI – Version Tree

element * CHECKEDOUT

element * \main\LATEST

Page 34: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 34

34 20/04/23

Version tree – How to look at other versionThe eye shows

which version is selected in

view

The eye shows which version is selected in

viewTo look at other

version mark it and use the Windows ”Send To” menu

To look at other version mark it and use the Windows ”Send To” menu

Page 35: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 35

35 20/04/23

Version Control of Directories

When is a new directory version created?

• Adding a new element

• Removing an element

• Renaming an element

• Moving an element

Page 36: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 36

36 20/04/23

Version Control of DirectoriesClearCase automatically checks out/in the directory when using the Windows GUI:s.

Removed

config.cs Removed

config.cs

ClearCase

5

6

5

6

ConfigSpec

2

3 Added config.cs

Added config.cs

Drag and drop

Example: Moving a file from ClearCase to ConfigSpec

Page 37: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 37

37 20/04/23

The Config SpecElement type Filename Version Selector element * CHECKEDOUTelement * /main/LATEST

Element type– E.g. Element (= all element types) , element -file , element -directory

Filename– Pathname to file: \project_vob\src\hello.c– Pathname pattern: * or \project_vob\...

Version Selector – /main/4, /main/LATEST, /main/br1/LATEST, BUILD_45, RELEASE2

Page 38: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 38

38 20/04/23

The Config Specelement * CHECKEDOUT

element *.doc /main/LATEST

element *.vsd /main/LATEST

element *.mmap /main/LATEST

element *.ppt /main/LATEST

element *.mdl /main/LATEST

element *.pdf /main/LATEST

element *.xls /main/LATEST

element *.zip /main/LATEST

element *.exe /main/LATEST

element .../ReqPro/... /main/LATEST

element .../tools/clearcase/... /main/LATEST

element ".../NPP Project/..." /main/LATEST

element ".../NPP System/1_Business Modeling/..." /main/LATEST

element ".../NPP System/2_Requirements/..." /main/LATEST

element ".../NPP System/3_Design and Usability/..." /main/LATEST

element ".../NPP System/4_Analysis and Design/..." /main/LATEST

element ".../NPP System/6_Test/..." /main/LATEST

element ".../NPP System/8_Enviroment/..." /main/LATEST

element ".../NPP System/9_Config and Change Mgmt/..." main/LATEST

element * CLEARCASE_CURRENT -nocheckout

element * BUILD_SCRIPTS_CURRENT -nocheckout

element * /main/npp_got_rel1/LATEST

element * /main/LATEST -mkbranch npp_got_rel1

Page 39: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 39

39 20/04/23

Setting the Config Spec

• To set the Config Spec in ClearCase you can use the command line, the GUI or script.

• The command line can be used to read an existing text file or to edit it manually.

• The GUI is used to edit it manually.

Page 40: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 40

40 20/04/23

Setting the Config Spec – the GUIIn ClearCase ExplorerRight-click on the view and select properties of view

Select the Config Spec tab

And press Edit

When done editing save your changes by pressing OK

Page 41: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 41

41 20/04/23

Setting the Config Spec – the cmd

For editing an existing Config Spec use cleartool edcs

An tmp file is opened where you can edit the Config Spec.

When done, close the tmp file and answer “y” in the cmd if you like to set the new Config Spec

Page 42: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 42

42 20/04/23

Setting the Config Spec – the cmd

• cleartool setcsis a good command to use if you for example have a text file with the Config spec to use.You just write

cleartool setcs path_to_file_to_use.txt

Page 43: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 43

43 20/04/23

A Label…

• Is a user-defined name that can be attached to a version.

• Identify specific versions of elements

• Can be used in config spec rules to identify branching points or to mark all versions that where used in a build.

Page 44: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 44

44 20/04/23

Apply Label

Page 45: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 45

45 20/04/23

Apply Label

Select your view

Press Next

Page 46: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 46

46 20/04/23

Apply LabelSelect where to apply the label

Press Add>>

Press Next

Page 47: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 47

47 20/04/23

Apply Label

Browse for the label you would like to apply

Page 48: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 48

48 20/04/23

Apply LabelSelect which label to apply

Or create a new label

NOTE:Remember that label names shall be all UPPER CASEPress OK

Page 49: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 49

49 20/04/23

Apply Label

Press Finish

Page 50: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 50

50 20/04/23

Apply Label – the Version Tree

Label on specific file version can be seen in the Version Tree

Page 51: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 51

51 20/04/23

Apply Label – the Version TreeA label can also be applied from the version tree

•Right click on the version•Select Apply Label…•Mark the label you would like to apply•Press OK

Page 52: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 52

52 20/04/23

Select LabelsClick on ”Element with Labels”Select path and the Label.

ClearCase Reports

Page 53: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 53

53 20/04/23

ClearCase reports -example

Page 54: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 54

54 20/04/23

Working on branch

1. CM/Administrator defines branch type ”branch1”2. Use View with config spec like pattern below<joe_bugfix>% cleartool catcs element * CHECKEDOUT 1 element * /main/branch1/LATEST 2element * LABEL -mkbranch branch1 3

LABEL

3

foo.c

LABEL

1

bar.c foobar.c

LABEL

2

Page 55: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 55

55 20/04/23

How to set up the branch

In order to start working on a branch this is necessary:

• The branch type must be defined in ClearCase.

• The config spec must be written so it selects the correct version and creates the branch when necessary.

Page 56: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 56

56 20/04/23

Working on branch - continuedBefore Checkout

After Checkout After Checkin

Checkout a file

Page 57: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 57

57 20/04/23

Deliver/Merge

• If using parallel development, there will be need for synchronizing the content at given times.

• Then a merge is performed between specified branches

Page 58: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 58

58 20/04/23

Before Merge - Generic Version Tree

1

21

Base

”From” version”To” version

Branch

Merge Result

Page 59: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 59

59 20/04/23

Graphical merge tool

Merge Result

Base From To

Page 60: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 60

60 20/04/23

Algorithm for Automatic Merging

1

21

Base

”From””To”

Merge Result

#include ”he.h” #include ”he.h” #include ”he.h” #include ”he.h”

#include ”bo.h" #include ”bo.h"

int main() { int main() { int main() { int main() {

/* Say Hello W */ /* Say Hello W */

printf(”Hello World!”);

printf(”Hello World!”);

printf(”Hello to World!”);

printf(”Hello to World!”);

return 0; return 1; return 2;

} } } }

deleted

? conflict

inserted

changed

Base ”From” ”To”

deleted

Merge Result

Page 61: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 61

61 20/04/23

Merge Conflicts

• When merging, ClearCase does an automatic merge.

• If the merge detects conflicts, the user needs to resolve these.

Page 62: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 62

62 20/04/23

Merge

Main

rel_1

dev_1

(1) Base version

(2) Contributor 1”Merge from”

(3) Contributor 2”Merge to”

Result version(Checked out)

Merge

Page 63: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 63

63 20/04/23

Merge one File

1

TO version

FROM version

Page 64: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 64

64 20/04/23

After Merge

After Merge

Recompile and test...

Checkin Now everybodyelse sees it...

Result is in the checked out version

Result is in the checked out version

Page 65: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 65

65 20/04/23

Comparing Versions - Text File example

Compare with previous version

Changed

Page 66: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 66

66 20/04/23

Comparing Versions - Word Example

1

2

The same principle as ”Track changes” in Word

Page 67: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 67

67 20/04/23

Comparing Versions – Directory Example

1

2File ClearCaseInstallationGuide.docdoes not exist

File ClearCaseInstallationGuide.docdoes exist

Page 68: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 68

68 20/04/23

Version extended pathnames

In ClearCase you access a version of a file

You can choose what version to access

In order to do this, ClearCase use version extended pathnames

Version extended pathnames are a way to specify exact the version of interest

Page 69: Volvo Information Technology 1 1 16/10/2015 XML presentation ClearCase Basics

Volvo Information Technology

XML presentation 69

69 20/04/23

Version extended pathnames

Some examples:

• foo.c@@ -specifies an element

• foo.c@@main - specifies a branch

• foo.c@@main/branch1 - specifies a branch

• foo.c@@main/branch1/2 - specifies a version