Pregunta

Let's say I have two files: File1 and File2

In the version tree diagram below the * indicates the version of my working copy selected by my config spec.

Version Trees:

File1 has development on Branch2 but is now merged to branch main

| main |
   |
  (0)----| Branch2 |
   |          |
   |         (0)
   |          |
  (1)*<------(1)     

File2 is on Branch2 with multiple revisions

| main |
   |
  (0)----| Branch2 |
              |
             (0)
              |
             (1)
              |
             (2)*

Config Spec:

#Pick up Branch2 LATEST unless it has an outgoing merge hyperlink type
element * {version(.../Branch2/LATEST)&&!hltype(Merge,->)}    
element * /main/LATEST

What I'd like to be able to do is find only the files that are on Branch2 that I'm currently looking at.

I've tried this:

cleartool find . -cview -type f -version "brtype(Branch2)" -print

It returns every version of every file that is on Branch2

.\File1@@\main\Branch2\0
.\File1@@\main\Branch2\1
.\File2@@\main\Branch2\0
.\File2@@\main\Branch2\1
.\File2@@\main\Branch2\2

I'd like only

.\File2@@\main\Branch2\2

What is the cleartool find command(s) that will return only File2, the working copy version as a results? I'd prefer a one line command versus a multiple step process.

To Clarify

I only want listed files that are on Branch2 and selected as my working copy according to my config spec. .\File2@@\main\Branch2\2 is on Branch2 and is selected as my working copy. .\File1@@\main\1 is selected as my working copy, which isn't on Branch2 and shouldn't be listed.

¿Fue útil?

Solución

It would be wrong to query for a specific version like "LATEST" for files in a branch, because there is no guaranty your config spec actually select the LATEST of a given branch.

The correct way is to cleartool find elements:

  • in the current view (cview)
  • which have a version in that branch (brtype)

That means:

cd /path/to/your/view/yourVob
cleartool find . -cview -type f -ele "brtype(Branch2)" -print

That would still give you File1, but that would give it as the version in /main only (not Branch2)

You can then filter out easily what you need:

cleartool find . -cview -type f -ele "brtype(Branch2)" -print | grep Branch2

It is still one command, and it doesn't assume you are selecting the LATEST of Branch2.
If you are selecting any version on Branch2, it will be in the result of that find.

Otros consejos

This will get you the latest version on the branch

cleartool find . -type f -ele "version(.../Branch2/LATEST)" -print
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top