How to obtain perforce change list number

Hi guys,

and I need to find the number of the selected change list. IDEA does it somehow (shows Perforce CLN), but because its Perforce plugin is not open source, I can not see how it is implemented.
I have an instance of LocalChangeListImpl and I need to obtain from it some of the perforce specific change list classes which contain Perforce CLN info.

There is older thread on this topic: https://devnet.jetbrains.com/message/5460240
However it is 3 years old, so I hope someone have better, cleaner solution for that.

Thanks in advance
Ivaylo

4 comments
Comment actions Permalink

You need to depend on Perforce plugin. Then there's PerforceNumberNameSynchronizer.getInstance(project) that can return various p4 changelist numbers by local change list names. You might need ConnectionKey for that, which you can get from connection that you get from PerforceConnectionManager methods.

But note that it's not a public API and is subject to change.

0
Comment actions Permalink

Thanks Peter, this is exactly what I was searching for.

Can you please just clarify why perforceConnectionManager.getAllConnections() returns a Collection instead of single result - as far as I see the IDE allows only one perforce connection (although this connectin can handle multiple directories)?

0
Comment actions Permalink

There might be several directories in the project, each under its own Perforce connection (which would be set up via P4CONFIG file and could have different connection settings).

0
Comment actions Permalink

OK I see. Thanks again.

0

Please sign in to leave a comment.