IPnom Home • Manuals • ClearCase

 Rational ClearCase Commands Reference

ClearCase Stuff:ClearCase LinksClearCase BooksClearCase Commands ReferenceClearCase ForumsClearCase News
Keyword Live Search (10 results max):
 Type in part of a ClearCase command in the search box.
 
Commands Index:
  intro
  annotate
  apropos
  catcr
  catcs
  cc.icon
  cc.magic
  cd
  chactivity
  chbl
  checkin
  checkout
  checkvob
  chevent
  chflevel
  chfolder
  chmaster
  chpool
  chproject
  chstream
  chtype
  chview
  clearaudit
  clearbug
  cleardescribe
  cleardiffbl
  cleardiff
  clearexport_ccase
  clearexport_cvs
  clearexport_pvcs
  clearexport_rcs
  clearexport_sccs
  clearexport_ssafe
  clearfsimport
  cleargetlog
  clearhistory
  clearimport
  clearjoinproj
  clearlicense
  clearmake
  clearmake.options
  clearmrgman
  clearprojexp
  clearprompt
  cleartool
  clearviewupdate
  clearvobadmin
  comments
  config_ccase
  config_spec
  cptype
  credmap
  creds
  deliver
  describe
  diffbl
  diffcr
  diff
  dospace
  edcs
  endview
  env_ccase
  events_ccase
  export_mvfs
  exports_ccase
  file
  find
  findmerge
  fmt_ccase
  getcache
  get
  getlog
  help
  hostinfo
  init_ccase
  ln
  lock
  lsactivity
  lsbl
  lscheckout
  lsclients
  lscomp
  lsdo
  lsfolder
  lshistory
  ls
  lslock
  lsmaster
  lspool
  lsprivate
  lsproject
  lsregion
  lsreplica
  lssite
  lsstgloc
  lsstream
  lstype
  lsview
  lsvob
  lsvtree
  makefile_aix
  makefile_ccase
  makefile_gnu
  makefile_pmake
  makefile_smake
  makefile_sun
  man
  merge
  mkactivity
  mkattr
  mkattype
  mkbl
  mkbranch
  mkbrtype
  mkcomp
  mkdir
  mkelem
  mkeltype
  mkfolder
  mkhlink
  mkhltype
  mklabel
  mklbtype
  mkpool
  mkproject
  mkregion
  mkstgloc
  mkstream
  mktag
  mktrigger
  mktrtype
  mkview
  mkvob
  mount_ccase
  mount
  msdostext_mode
  mvfslog
  mvfsstorage
  mvfstime
  mvfsversion
  mv
  omake
  pathnames_ccase
  permissions
  profile_ccase
  promote_server
  protect
  protectvob
  pwd
  pwv
  query_language
  quit
  rebase
  recoverview
  reformatview
  reformatvob
  register
  relocate
  rename
  reqmaster
  reserve
  rgy_backup
  rgy_check
  rgy_passwd
  rgy_switchover
  rmactivity
  rmattr
  rmbl
  rmbranch
  rmcomp
  rmdo
  rmelem
  rmfolder
  rmhlink
  rmlabel
  rmmerge
  rmname
  rmpool
  rmproject
  rmregion
  rmstgloc
  rmstream
  rmtag
  rmtrigger
  rmtype
  rmver
  rmview
  rmvob
  schedule
  schemes
  scrubber
  setactivity
  setcache
  setcs
  setplevel
  setsite
  setview
  shell
  snapshot.conf
  softbench_ccase
  space
  startview
  type_manager
  umount
  uncheckout
  unlock
  unregister
  unreserve
  update
  version_selector
  view_scrubber
  vob_restore
  vob_scrubber
  vob_sidwalk
  vob_snapshot
  vob_snapshot_setup
  wildcards_ccase
  winkin
  xclearcase
  xcleardiff
  xmldiffmrg

query_language

Selects objects by their metadata

APPLICABILITY

ProductCommand type
ClearCasegeneral information
ClearCase LTgeneral information

Platform
UNIX
Windows

SYNOPSIS

Query primitives:
query-function (arg-list)
attribute-type-name  comparison-operator  value
Compound queries:
query && query
query || query ! query ( query )

DESCRIPTION

The query language is used to formulate queries on VOBs. It includes logical operators similar to those in the C programming language. A query searches one or more VOBs and returns the names of objects: versions, branches, and/or elements. A query may return a single object, many objects, or no objects at all.

A query primitive evaluates to TRUE or FALSE. A TRUE value selects an object, such as an element, branch, or version; a FALSE value excludes it.

A query must be enclosed in quotes if it includes spaces. You may also need to enclose a query in quotes to prevent shell-level interpretation of characters such as ( (open parenthesis). Quoting parentheses in config specs is not required.

Queries in Version Selectors

You can use a query in a version selector in these contexts:

  • Command-line options in the following cleartool commands:

    describe, merge, mkattr, mkbranch, mklabel, rmattr, rmlabel, rmver

  • Configuration rules; see the config_spec reference page
  • Version-extended pathnames in ClearCase and ClearCase LT commands; see the pathnames_ccase reference page

A query in a version selector must be enclosed in braces ( {} ).

When a query is applied to a single branch, ClearCase and ClearCase LT select the most recent version on that branch that satisfies the query. For example:

cmd-context  describe -ver '/main/{attype(QAed)}' util.c 

Using a query without a branch pathname causes an element's entire version tree to be searched. If the query returns a single version, the version-selection operation succeeds; the operation fails if the query returns no version (not found) or returns more than one version (ambiguous). For example:

cmd-context  describe -ver "{attype(QAed)}" util.c 
cleartool: Error: Ambiguous query: "{attype(QAed)}" 

Queries in the find and findmerge Commands

You can also use queries in the find and findmerge commands. In this context, the query can be enclosed in braces ({...}). The query returns the names of all matching objects. For example:

  • UNIX:

    cleartool find util.c -ver attype(QAed) -print 
    util.c@@/main/1
    util.c@@/main/3

  • Windows (notice the quotes):

    cleartool find util.c -ver "attype(QAed)" -print 
    util.c@@\main\1
    util.c@@\main\3

QUERY PRIMITIVES

The query language includes these primitives:

attribute-type-name  comparison-operator  value

comparison-operator is one of the following:

==     !=    <    <=    >    >=

Examples:

BugNum==4053
BugNum>=4000
Status!="tested"
 

This primitive is TRUE if the object itself has an attribute of that type and the value comparison is true. To test whether an object or its subobjects has a particular attribute (for example, an element or its branches and versions), use the attr_sub primitive.

Note: If no attribute named BugNum has been attached to an object, then !BugNum==671 is TRUE, but BugNum!=671 is FALSE. The second query would be true if an attribute of type BugNum existed, but had a different value.

attr_sub (attribute-type-name, comparison-operator, value)
With elementsTRUE if the element or any of its branches or versions has an attribute of type attribute-type-name that satisfies the specified comparison with value.
With branchesTRUE if the branch or any of its versions has an attribute of type attribute-type-name that satisfies the specified comparison with value.
With versionsTRUE if the version itself has an attribute of type attribute-type-name that satisfies the specified comparison with value.
attype (attribute-type-name)
With elementsTRUE if the element itself has an attribute of type attribute-type-name.
With branchesTRUE if the branch itself has an attribute of type attribute-type-name.
With versionsTRUE if the version itself has an attribute of type attribute-type-name.
attype_sub (attribute-type-name)
With elementsTRUE if the element or any of its branches or versions has an attribute of type attribute-type-name.
With branchesTRUE if the branch or any of its versions has an attribute of type attribute-type-name.
With versionsTRUE if the version itself has an attribute of type attribute-type-name.
brtype (branch-type-name)
With elementsTRUE if the element has a branch named branch-type-name.
With branchesTRUE if the branch is named branch-type-name.
With versionsTRUE if the version is on a branch named branch-type-name.
created_by (login-name)
In all cases, TRUE if the object was created by the user login-name (as shown by the describe command).

created_since (date-time)
In all cases, TRUE if the object was created since date-time. The date-time argument can have any of the following formats:

date.time | date | time |now where:

date :=day-of-week | long-date
time :=h[h]:m[m][:s[s]] [UTC [ [ + | - ]h[h][:m[m] ] ] ]
day-of-week :=today |yesterday |Sunday | ... |Saturday |Sun | ... |Sat
long-date :=d[d]month[[yy]yy]
month :=January |... |December |Jan |... |Dec

Specify the time in 24-hour format, relative to the local time zone. If you omit the time, the default value is 00:00:00. If you omit the date, the default is today. If you omit the century, year, or a specific date, the most recent one is used. Specify UTC if you want to resolve the time to the same moment in time regardless of time zone. Use the plus (+) or minus (-) operator to specify a positive or negative offset to the UTC time. If you specify UTC without hour or minute offsets, Greenwich Mean Time (GMT) is used. (Dates before January 1, 1970 Universal Coordinated Time (UTC) are invalid.)

eltype (element-type-name)
In all cases, TRUE if the element to which the object belongs is of type element-type-name.

hltype (hlink-type-name), hltype (hlink-type-name, ->), hltype (hlink-type-name ,<-)
In all cases, TRUE if the object is either end of a hyperlink (first form) named hlink-type-name, or is the from-end of a hyperlink (second form), or is the to-end of a hyperlink (third form)

lbtype (label-type-name)
In all cases, TRUE if the object itself is labeled label-type-name. (Because elements and branches cannot have labels, this primitive can be true only for versions.)

lbtype_sub (label-type-name)
With elementsTRUE if the element has a version that is labeled label-type-name.
With branchesTRUE if the branch has a version that is labeled label-type-name.
With versionsTRUE if the version itself is labeled label-type-name.
merge (from-location , to-location)
In all cases, TRUE if the element to which the object belongs has a merge hyperlink (default name: Merge) connecting the from-location and to-location. You can specify either or both locations with a branch pathname or a version selector. Specifying a branch produces TRUE if the merge hyperlink involves any version on that branch. The branch pathname must be complete (for example, /main/rel2_bugfix, not rel2_bugfix).

pool (pool-name)
In all cases, TRUE if the element to which the object belongs has a source pool or cleartext pool named pool-name.

trtype (trigger-type-name)
In all cases, TRUE if the element to which the object belongs has an attached or inherited trigger named trigger-type-name.

version (version-selector)
With elementsTRUE if the element has a version with the specified version-selector.
With branchesTRUE if the branch has a version with the specified version-selector.
With versionsTRUE if the version itself has the specified version-selector.

Note that in this context, version-selector cannot itself contain a query. For example, version(REL1) is valid, but version(lbtype(REL1)) is not.

COMPOUND QUERIES

Primitives can be combined into expressions with logical operators. An expression can take any of these forms, where query is a primitive or another expression:

query || queryLogical OR
query && queryLogical AND
! query Logical NOT
( query ) Grouping to override precedence

OPERATOR PRECEDENCE

The precedence and associativity of the operators for attribute comparisons and formation of logical expressions are the same as in the C programming language:

Highest precedence: ! Right associative
Lower precedence: <   <=   >   >= Left associative
Lower precedence: ==   != Left associative
Lower precedence: &&Left associative
Lowest precedence: || Left associative

EXAMPLES

The UNIX examples in this section are written for use in csh. If you use another shell, you may need to use different quoting and escaping conventions.

The Windows examples that include wildcards or quoting are written for use in cleartool interactive mode. If you use cleartool single-command mode, you may need to change the wildcards and quoting to make your command interpreter process the command appropriately.

In cleartool single-command mode, cmd-context represents the UNIX shell or Windows command interpreter prompt, followed by the cleartool command. In cleartool interactive mode, cmd-context represents the interactive cleartool prompt.

  • On a UNIX system, display all versions of test.c for which the attribute QAed has the value Yes.

    cat ‘cleartool describe –s –ver /main'{QAed==”Yes”}' test.c‘ 

  • Attach the label REL6 to the version of test.c that is already labeled REL5.

    UNIX:

    cleartool mklabel -ver '{lbtype(REL5)}' REL6 test.c 
    Created label "REL6" on "test.c" version "/main/4". 

    Windows:

    Z:\vob2\src> cleartool mklabel -ver "{lbtype(REL5)}" REL6 test.c
    Created label "REL6" on "test.c" version "\main\4".

  • Attach an attribute to the latest version of test.c created since yesterday at 1 P.M. by user asd. Note the use of backslashes (\) to escape quote characters (") required to specify a string argument to mkattr.

    UNIX:

    mkattr -ver '{created_since(yesterday.13:00)&&created_by(asd)}' QAed \"No\" test.c
    Created attribute "QAed" on "test.c@@/main/5".

    Windows:

    cleartool> mkattr -ver "{created_since(yesterday.13:00)&&created_by(asd)}" QAed ^ \"No\" test.c
    Created attribute "QAed" on "test.c@@\main\5".

  • List each branch named rel2_bugfix that occurs in an element to which a trigger named mail_all has been attached.

    UNIX:

    cleartool find . -branch 'brtype(rel2_bugfix)&&trtype(mail_all)' -print
    ./util.c@@/main/rel2_bugfix
     

    Windows:

    Z:\vob2\src> cleartool find . -branch "brtype(rel2_bugfix)&&trtype(mail_all)" -print
    .\util.c@@\main\rel2_bugfix

SPONSORED LINKS



 

ClearCase Links • ClearCase Books • ClearCase Commands Reference • ClearCase Forums • ClearCase News