3

I'm new to CC and I'm coming from Git and Mercurial background, probably thats why ClearCase confused me so much. I've been assigned a task to migrate latest CC's revisions to Git. Problem is that I couldn't manage to checkout any branch other than main in CC.

I have a view that displays all VOB's /main/LATEST revision. I assume, main branch's latest revision.

element * CHECKEDOUT
element * /main/LATEST

Now I need to get the list of other branches in a particular VOB. To do that, I navigate from terminal in that folder and run

cleartool lstype -kind brtype -invob /%VOB_NAME%

and I can see the list of branches. Correct me if I'm wrong, but I assume, it displays only the branches relevant to VOB(%VOB_NAME%).

Now I need to checkout the branches. What is the standard way of doing this. I tried updating config spec with something like:

element * /%VOB_NAME%/%BRANCH_NAME%/LATEST but it doesn't seem to work.

Pretty sure I'm not doing it correctly. Also for migration purpose, I'll need to automate the steps to acquire branches and checkout the branches. I guess updating config spec to switch branch in a view takes some time and probably is an async operation, so is there a way to determine when view finishes updating?

Or maybe there's command line option to switch branch for a particular VOB in a view?

So in short, here's my questions I'm struggling with:

Than

  1. Am I acquiring VOB branches correctly?
  2. How can I checkout a particular branch?
  3. Is there a way to determine when checkout finishes?

thanks

UPDATE

ok I tried @VonC's recommendation so my config spec looks like this:

element * CHECKEDOUT
element * .../heine_1/LATEST
element * /main/LATEST

If I'm guessing correctly, one VOB containing branch named heine_1 should checkout that particular branch, the rest of VOBs will stay on main branch, but this is not the case. When I run cleartool ls inside that VOB, its still on main branch. All folders are postfixed with Rule: /main/LATEST. So I guess it didn't switch the branch.

Thanks

Davita
  • 8,928
  • 14
  • 67
  • 119
  • I'll add an answer later, but the right syntax is `element * .../mybranch LATEST` (note the three dots), followed by `element * /main/LATEST`. See more at http://stackoverflow.com/a/12140897/6309, or http://stackoverflow.com/a/12714528/6309. – VonC May 11 '17 at 11:30
  • Thanks @VonC. Would this apply to all VOBs under the view? What if I want to checkout different branch for a single particular VOB? – Davita May 11 '17 at 11:40
  • Yes, all mounted Vobs (in a dynamic view), or all vobs loaded in a snapshot view – VonC May 11 '17 at 11:41
  • Simply make sure yuor view only mount or load the vob you want. Again, I will post a more ciomplete answer in a few hours. – VonC May 11 '17 at 11:41
  • Problem is that I didn't create the view, IT gave me access to it and I have no idea what type it is. Is there a way to avoid modifying the view? And is there a way to determine which view type is it? Thanks again :) – Davita May 11 '17 at 11:42
  • See http://stackoverflow.com/a/2925378/6309. If your view has a local path, it is a snapshot one: a `cleartool catcs` will show loading rule. If it is mounted (through `/view` or `M:`), it is a dynamic view. – VonC May 11 '17 at 11:51
  • so it's a dynamic view. I'm accessing it through /view/my_username. Thanks again Von :) BTW, how do I update only one VOB branch? – Davita May 11 '17 at 11:57
  • By adding only a selection rule for that branch as mentioned above. See also http://stackoverflow.com/a/41930287/6309 and http://stackoverflow.com/a/3511249/6309 – VonC May 11 '17 at 11:58
  • @VonC, I have tried your recommendation and updated the question. Thanks – Davita May 11 '17 at 12:06
  • Seing /main/LATEST is expected: You will see the branch only for the folder/elements that have actually been checked out/checked-in in the new branch. – VonC May 11 '17 at 12:10
  • @VonC I tried on several branches in several VOBs but couldn't find a single file/folder checked out from a branch other than main. Is there an easy way of checking which file/folders has been checked out from a particular branch? Sorry to annoy you so much :) – Davita May 11 '17 at 12:24
  • I answered that one in http://stackoverflow.com/a/2786120/6309 – VonC May 11 '17 at 12:25
  • Thanks, very useful command, but I'm still unable to find a single file from other branch. The search doesn't print anything for branch br_22 (which is specified in config spec), but it prints all files/folders if I specify to search for main branch. I'm really confused :( – Davita May 11 '17 at 12:43
  • In your screenshot https://ibb.co/dc1mRQ, you seem to be missing the last selection rule `element * /main/LATEST`. Can you try again your find query with a config spec including this rule? – VonC May 12 '17 at 07:12

1 Answers1

-1

There are a few questions in the original question and the comments.

Addressing the configspec issue first...

The syntax of an element rule is: element {path} {version rule} {optional clauses}

If you need a VOB-specific rule, you can do something like this: element \myvob\... ...\myvobbranch\LATEST element \myvob\... \main\LATEST -mkbranch myvobbranch

The "..." in the path means "this location and everything underneath it." The "..." in the "version rule" means that the branch name is at the end, so this would match /main/myvobbranch/LATEST, /main/br1/myvobbranch/LATEST, etc.

If you're working on a branch, you generally want new files or work to appear on the branch you are working in, and the second line makes that happen.

Everything in a configspec is case sensitive, so be aware that "LATEST" is not "latest."

Since the view was created for you, I'm reasonably certain that it is a dynamic view. If it is mapped to a drive, it's definitely dynamic. If you need to know for sure, you can CD into the "working area" of your view and run "cleartool lsview -pro -full -cview" and look at the "attributes" line. The line for a dynamic view will look like this:

Properties: dynamic readwrite shareable_dos

On the direct questions:

  1. Yes, you are acquiring the branch list correctly.
  2. By default the checkout is done using the version selected by the view, you can use cleartool checkout -branch {full branch path} {file name} to check out the latest on a branch, or cleartool checkout -version {version id} {file name} to check out a version other than the latest on a branch. I would not recommend either as a normal practice. The -branch will cause checkins to go to the element's parent branch. The -version would require add a requirement to perform a merge to get the checkin to complete, which would also go to the version's parent branch.
  3. Checkout is finished when the command finishes.

A big "new user gotcha" is that directories are also versioned objects. If you're adding files to source control, you need to remember to check the directory in so that they are visible by others with similarly configured views. The ClearCase GUIs have this behavior as a default if you started the process with the directory NOT checked out, but not if you explicitly checked out the directory beforehand.

Brian Cowan
  • 1,048
  • 6
  • 7
  • Hi Brian. Thanks for the reply. I tried what you suggested but same result, no files/folders has been checkedout from desired branch. See screenshot here: https://ibb.co/dc1mRQ – Davita May 11 '17 at 14:57
  • The configspec you used won't work for checkouts in that VOB. The "-mkbranch" needs to be "-mkbranch br_22". Checkouts that don't specify a branch will fail because the mkbranch rule will fail. The find command you listed may not get you what you're looking for. You may want to try 'cleartool find -all -type f -element "brtype(%x)" -print' instead. Using the current working directory tends to limit you to finding what is already visible. -all can also run faster... – Brian Cowan May 12 '17 at 19:36