It's all about the answers!

Ask a question

RTC SCM aliasId - String or Int?

Chris Graham (367714) | asked Dec 04 '15, 12:52 a.m.
When you use the SCM command line tool, to run "scm status" or similar, the output (non UUID or JASON) includes an aliasId.

Up until yesterday, I'd only ever seen numbers >1000.

When I parse the output, I treat it as an int.

Yesterday, I came across a case where the id was "0023". I treat it as an INT, so I used "23".

And quickly discovered that as far as asliasId's are concerned "23" != "0023".

So, is the aliasId an int or a String?

Accepted answer

permanent link
Shashikant Padur (4.2k27) | answered Dec 04 '15, 1:38 a.m.
You shouldn't use aliases when using the scm tool from a script as aliases are temporary and it could be reused, may roll over. The aliases start from 1000 and go up to 9999. I am not sure how you got 0023.

Use uuid's in your script. You can get the uuid of an item as follows: scm -u y <command> <command_args>

David Lafreniere selected this answer as the correct answer

Chris Graham commented Dec 05 '15, 5:12 a.m.

I'm well aware of that. I'm simply using the output of the scm commands, from the same workspace (so the aliases will not change), and they are not persisted or stored, they are simply used to allow SCM commands to be issued by the maven jazz scm provider.

1000-9999 - then what?

The value 0023 was seen in the wild, using 4.0.2.

And you did not answer the fundamental question, is it a string or an int?

The scm associate was used, and it needed "0023" and not "23" - which was not recognised as a valid value. So I'm thinking internally it is a string, or there is a bug in the way that the values are parsed.

Ideally, I'm trying to preserve backwards compatibility with V3 (and I'm not sure if -u was available then).

Chris Graham commented Dec 05 '15, 5:19 a.m.

Here is the (edited to protect the names of the guilty) actual output of a scm status command:

Workspace: (0017) "ReleaseWorkspace" <-> (9893) "MyStream"
  Component: (9894) "AComponent"
    Baseline: (0024) 561 "ABaseline..."

My guess is that it wraps over to 0000. It's an int, and you pretty print the values to supply leading zeroes.

Shashikant Padur commented Dec 06 '15, 11:28 p.m. | edited Dec 06 '15, 11:40 p.m.


As I understand after the value 9999 it should roll over and start from 1000 reusing aliases that were not used/accessed recently.
Alias is returned as a string value after supplying with leading zeroes.

Chris Graham commented Dec 06 '15, 11:51 p.m.

We just got the results back. It rolled over to 0000. That's not good.
I'd have guessed that your treating it as a string due to the "0023" != "23" comparison failure.

I'll put some logic in for some leading zero work.


Your answer

Register or to post your answer.