+ All Categories
Home > Documents > 07_scm271_ecc_s05

07_scm271_ecc_s05

Date post: 30-May-2018
Category:
Upload: jagadeesh
View: 213 times
Download: 0 times
Share this document with a friend

of 24

Transcript
  • 8/9/2019 07_scm271_ecc_s05

    1/24

    Copyright IBM Corp. 2003 5 - 1

    Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

    Module 5Working with Snapshot Views

    1

    IBM Software Group

    Essentials of Rational ClearCase

    Module 5: Working with Snapshot Views

    Topics

    Objectives............................................................................................................ 5-2Types of Views Review .................................................................................... 5-3Locating Your View Storage Directory ................................................................... 5-6Load Rules ........................................................................................................... 5-7Updating a Snapshot View.................................................................................... 5-8Developer Workflow: Working Offline ................................................................. 5-9Creating a Snapshot View................................................................................... 5-10Hijacking Files.................................................................................................... 5-15Resolving Hijacked Files ..................................................................................... 5-19Changing Elements Loaded into a Snapshot View ............................................... 5-21Working in a Snapshot View While Connected................................................... 5-22

  • 8/9/2019 07_scm271_ecc_s05

    2/24

    Essentials of Rational ClearCase

    5 - 2 Copyright IBM Corp. 2003

    Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

    Objectives

    2

    Objectives

    Create a snapshot view

    Work in a snapshot view

    Resolve hijacked files

    Edit load rules

    Upon completing this module, you should be able to:

  • 8/9/2019 07_scm271_ecc_s05

    3/24

    Module 5 - Working with Snapshot Views

    Copyright IBM Corp. 2003 5 - 3

    Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

    Types of Views Review

    3

    Types of Views Review

    Dynamic views use the ClearCase multiversion file system (MVFS) to provideimmediate, transparent access to files and directories stored in VOBs. ClearCase mapsa dynamic view to a drive letter in Windows Explorer.

    Snapshot views copy files and directories from VOBs to a directory on your computer.

  • 8/9/2019 07_scm271_ecc_s05

    4/24

    Essentials of Rational ClearCase

    5 - 4 Copyright IBM Corp. 2003

    Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

    Use a Snapshot View When

    4

    Use a Snapshot View When You are using ClearCase LT

    Your computer OS does not support dynamic views

    You want to work offline

    You want to access a view from a computer that is

    not a ClearCase host

    You want to optimize build performance

    Your project does not require ClearCase build

    auditing and build avoidance features

    ClearCase LT users work in snapshot views only.

    One of the main reasons to use snapshot views is if you want to work disconnectedfrom the network.

  • 8/9/2019 07_scm271_ecc_s05

    5/24

    Module 5 - Working with Snapshot Views

    Copyright IBM Corp. 2003 5 - 5

    Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

    Structure of a Snapshot View Review

    5

    Structure of a Snapshot View Review

    View root directory a directory into which ClearCase loads (copies) files anddirectories. In a snapshot view, the view root directory is typically located on your localcomputer or storage device.

    View tag the name of the view.View storage directory keeps track of information such as which files are loadedinto your view and which versions are checked out to it.

    Load rules rules that determine which elements are loaded into the view. They arepart of the config spec.

  • 8/9/2019 07_scm271_ecc_s05

    6/24

    Essentials of Rational ClearCase

    5 - 6 Copyright IBM Corp. 2003

    Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

    Locating Your View Storage Directory

    6

    Locating Your View Storage Directory

    Company may have policies about where to locate

    view storage directories

    If you are going to disconnect from the network, the

    view storage directory must be located on a machine

    that remains connected to the network

    Every snapshot view has a view storage directory in addition to the directory tree ofsource files that it loads from VOBs. ClearCase uses the snapshot view storage directoryto keep track of information such as which files are loaded into your view and which

    versions are checked out to it.

    On ClearCase LT systems, the software locates all view storage directories in a serverstorage location, which is a directory on the ClearCase server host.

    In ClearCase, your ClearCase administrator usually sets up a server storage location. Bydefault, ClearCase locates snapshot view storage directories in the server storagelocation. If there is not a defined location, you can choose to locate the view storagedirectory under the root directory of the snapshot view or in another local directory.

    If you choose to locate the view storage directory locally, be aware of the followingrecommendations:

    Do not choose this configuration if you use the view when disconnected from the

    network. You can corrupt the data in the view storage directory if you disconnect itfrom the network while the view's view_server process is running. Make sure the view storage directory is accessible to any data backup schemes your

    organization institutes.

  • 8/9/2019 07_scm271_ecc_s05

    7/24

    Module 5 - Working with Snapshot Views

    Copyright IBM Corp. 2003 5 - 7

    Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

    Load Rules

    7

    Load Rules

    Part of the config spec

    Determine which elements are copied into thesnapshot view

    Base config spec selectsparticular versions of theloaded elements

    Load rules selectelements to load

    Load rules are part of your view configuration specification. Load rules determinewhich elements are loaded into the view.

    The first rule of a snapshot view base config spec must beelement * CHECKEDOUT.

  • 8/9/2019 07_scm271_ecc_s05

    8/24

    Essentials of Rational ClearCase

    5 - 8 Copyright IBM Corp. 2003

    Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

    Updating a Snapshot View

    8

    Updating a Snapshot View

    Periodically update your snapshot view to load the

    most recent versions of elements.

    The rules in your snapshot view config spec select a discrete set of versions from theVOB. When other developers check in new versions from their views, your snapshotview may become out of date or inconsistent with the versions in the VOB. To make

    sure that your view contains the set of versions the config spec selects, you must updateit.

    When you start an update operation, ClearCase compares the version of the elementsloaded in the view with the version the config spec selects in the VOB. If the configspec selects a version in the VOB that is different from the version loaded in your view,ClearCase copies the version from the VOB into your view.

    Be sure to update your snapshot view periodically to make sure that you have thecorrect versions of all loaded elements and directories.

    An update operation copies versions of elements from a VOB to your view. (Only thecheckin operation copies changes from your view back to a VOB.)

  • 8/9/2019 07_scm271_ecc_s05

    9/24

    Module 5 - Working with Snapshot Views

    Copyright IBM Corp. 2003 5 - 9

    Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

    Developer Workflow: Working Offline

    9

    Developer Workflow: Working Offline

    Snapshot views allow you to work disconnected from the network.

    The workflow is the same, except for these additions:

    Before you disconnect from the network, it is a good idea to update your view sothat you begin with a clear checkpoint.

    On Windows, deactivate ClearCase Network Operations before you disconnectfrom the network and reactivate them when you reconnect. If you do notdeactivate ClearCase, your computer will have difficulty starting ClearCaseprocesses since you are no longer connected to the network.

    After disconnecting from the network, you can work on the files checked out to yoursnapshot view. While disconnected, your computer does not distinguish a snapshotview from any other standard directory tree.

    When you reconnect to the network and reactivate ClearCase network operations, youupdate your view, resolve hijacked files, and check in files as usual.

  • 8/9/2019 07_scm271_ecc_s05

    10/24

    Essentials of Rational ClearCase

    5 - 10 Copyright IBM Corp. 2003

    Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

    Creating a Snapshot View

    10

    Creating a Snapshot View

    1

    Click View > Create.

    3

    Type path or browse toselect view location.

    This is where you will workon files.

    4

    Click to change thelocation of the viewstorage directory.

    2

    Select Type: Snapshot.

    CLI Procedure

    Usage:

    mkview -snapshot [-tagsnapshot-view-tag] [-tcommenttag-comment] [-tmodetext-mode] [-cachesizesize] [-ptime] [-streamstream-selector] [ -stglocview-stgloc-name | -colocated_server [-hosthostname -hpathhost-snapshot-view-pname-gpathglobal-snapshot-view-pname] | -vwsview-storage-pname [-hosthostname-hpathhost-stg-pname -gpathglobal-stg-pname]

    Example:

    /vobs/Hardware/src% cleartool mkview -tagpats_2_snapshot_view -snapshot ~pat/myviewsSelected Server Storage Location "viewstore".Created view.Host-local path: butanone:/ccdata/viewstore/pat/myviews.vwsGlobal path:

    /net/butanone/ccdata/viewstore/pat/myviews.vwsIt has the following rights:User : pat : rwxGroup: users : r-xOther: : r-xCreated snapshot view directory "/homes/pat/myviews".

  • 8/9/2019 07_scm271_ecc_s05

    11/24

    Module 5 - Working with Snapshot Views

    Copyright IBM Corp. 2003 5 - 11

    Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

    Creating a Snapshot View (cont.)

    11

    Creating a Snapshot View (cont.)

    5

    Confirm the data, andthen click Continue.

  • 8/9/2019 07_scm271_ecc_s05

    12/24

    Essentials of Rational ClearCase

    5 - 12 Copyright IBM Corp. 2003

    Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

    Creating a Snapshot View: Loading Elements

    12

    Creating a Snapshot View: Loading ElementsAfter you create the snapshot view, load elements by

    editing the config spec.

    Add the VOB directoriesas shown here.

    Edit the config spec.

    In snapshot views, you must select the elements that you want loaded into the view.

    To edit your view config spec, use the cleartool edcs command.

    If you select a directory to load, all of its files and subdirectories are loaded into the

    view.

    If you select a file, only the selected version of the file is loaded into the view.However, in the snapshot view, ClearCase creates the entire directory path from theVOB-tag to the element even though the directories will be empty. This is necessary tomaintain the elements path in the VOB.

  • 8/9/2019 07_scm271_ecc_s05

    13/24

    Module 5 - Working with Snapshot Views

    Copyright IBM Corp. 2003 5 - 13

    Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

    Checking Out Files

    13

    Checking Out FilesCheck out the files you want to work on.

    When you check out to a snapshot view, a read/write copy of the file is availablelocally.

  • 8/9/2019 07_scm271_ecc_s05

    14/24

    Essentials of Rational ClearCase

    5 - 14 Copyright IBM Corp. 2003

    Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

    Working on Files

    14

    Working on FilesRead-only copies of loaded files are on your local

    drive

    When checked out, the copies become read/write

    hello.c and hello.h arechecked out, so they are

    read/write

  • 8/9/2019 07_scm271_ecc_s05

    15/24

    Module 5 - Working with Snapshot Views

    Copyright IBM Corp. 2003 5 - 15

    Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

    Hijacking Files

    15

    Hijacking Files

    A hijacked file is a loaded file that you modify without

    checking out

    To hijack a file, add the write bit to the file

    Example:

    chmod +w util.c

    When ClearCase loads a file element into a snapshot view, it applies the file systemread-only attribute to the file. If you change this attribute and modify a loaded filewithout checking out, ClearCase considers the file hijacked. Only loaded files can be

    hijacked.

  • 8/9/2019 07_scm271_ecc_s05

    16/24

    Essentials of Rational ClearCase

    5 - 16 Copyright IBM Corp. 2003

    Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

    Updating the View

    16

    Updating the View

    Click View >Update snapshot view.

    It is a good idea to update your view before you check in files. The update ensures thatyou have the most up-to-date versions of elements loaded into your view. This can beimportant if you want to test the work youve done before you check in the files.

    CLI Procedure

    Usage:

    update [ -print ] [-force ] [ -overwrite | -noverwrite | -rename ][ -ctime | -ptime ] [ -logpname ] [ pname ... ]

    Example:

    /homes/pat/SnapshotViews/tmp/Hardware% cleartool update .

    Processing dir "tmp/ Hardware".

    Processing dir "tmp/project_student/bin".

    End dir "tmp/project_student/bin".

    Done loading "/tmp/project_student" (9 objects, copied 35KB).

    Log has been written to "/homes/pat/myviews/update.28-Jan-3.12:22:00.updt".

  • 8/9/2019 07_scm271_ecc_s05

    17/24

    Module 5 - Working with Snapshot Views

    Copyright IBM Corp. 2003 5 - 17

    Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

    Snapshot View Update Window

    17

    Snapshot View Update Window

    Screenshot of snapshot view update window

    with full report

    There are options for handlinghijacked files when starting theupdate.

    You can configure the Update Tool to deal with hijacked files during the updateprocess. You can:

    Leave hijacked files in place and complete the update

    Rename the hijacked files and load the version from the VOB Overwrite hijacked files with the version the config selects in the VOB

  • 8/9/2019 07_scm271_ecc_s05

    18/24

    Essentials of Rational ClearCase

    5 - 18 Copyright IBM Corp. 2003

    Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

    Snapshot View Update Window

    18

    Snapshot View Update Window

    The update window displays asummary of elements thatwere added, changed, hijackedor removed.

  • 8/9/2019 07_scm271_ecc_s05

    19/24

    Module 5 - Working with Snapshot Views

    Copyright IBM Corp. 2003 5 - 19

    Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

    Resolving Hijacked Files

    19

    Resolving Hijacked Files

    Compare the hijacked file withthe latest version in the VOB.

    Check out thehijacked file.

    After check out, you can either

    Preserve changes, or

    Overwrite hijacked copy with the latestversion in the VOB.

    A hijacked file is a file loaded to your view that you modify without checking out.When you update your view, ClearCase notifies you if you have hijacked files.

    ClearCase detects hijacked files by comparing file size and time stamps. WhenClearCase loads a version into a snapshot view, it records in the view database the filesize and last-modified time stamp (as reported by the UNIX file system). ClearCasemodifies these values each time you check out a file, check in a file, or load a newversion into the view.

    When you update a view, ClearCase compares the current size and last-modified timestamp of a non-checked-out file with the size and time stamp that it recorded in theview database. If either value is different from the value in the view database,ClearCase considers the file hijacked.

    When resolving hijacked files, you have several options.

    If you want to keep the modifications you have made to the hijacked file, you can

    check out the file. ClearCase treats the checked-out hijacked file as it does any othercheckout.

    If you do not want to save the modifications, you can undo the hijack. ClearCaseoverwrites the hijacked file with the version that was loaded in the view.

    You can use the Diff Merge tool to see how the hijacked file differs from the checked-inversion of the file.

  • 8/9/2019 07_scm271_ecc_s05

    20/24

    Essentials of Rational ClearCase

    5 - 20 Copyright IBM Corp. 2003

    Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

    Checking In Files

    20

    Checking In FilesOnce you have resolved hijacked files, check in files.

    Check in files as usual.

  • 8/9/2019 07_scm271_ecc_s05

    21/24

    Module 5 - Working with Snapshot Views

    Copyright IBM Corp. 2003 5 - 21

    Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

    Changing Elements Loaded into a Snapshot View

    21

    Changing Elements Loaded into a Snapshot View

    Edit load rules by editing the

    view config spec.

    To make changes to the elements loaded into your snapshot view, you can edit theview load rules.

  • 8/9/2019 07_scm271_ecc_s05

    22/24

    Essentials of Rational ClearCase

    5 - 22 Copyright IBM Corp. 2003

    Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

    Working in a Snapshot View While Connected

    22

    Working in a Snapshot View While Connected

    Snapshot views can also be used while you are

    connected to the network.

    Hijacking files is unnecessary

    Remember to update the view regularly

    This slide shows the typical workflow you use when working in a snapshot view whileconnected to the network. Its important to update your view regularly so that youalways have up-to-date versions loaded into your view.

  • 8/9/2019 07_scm271_ecc_s05

    23/24

    Module 5 - Working with Snapshot Views

    Copyright IBM Corp. 2003 5 - 23

    Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

    Module Review

    23

    When might you choose to use a snapshot view?

    What are load rules?

    What does it mean to update a view?

    What is a hijacked file?

    How do you resolve hijacked files?

    How do you change the elements loaded into yoursnapshot view?

    Module Review

  • 8/9/2019 07_scm271_ecc_s05

    24/24

    Essentials of Rational ClearCase

    5 - 24 Copyright IBM Corp. 2003

    Module Lab

    24

    In this lab, you perform the following tasks:

    Create a snapshot view and load elements

    Work in a snapshot view

    Disconnect from the network

    Hijack a file

    Update view

    Resolve a hijacked file

    Module Lab