Posted 07 July 2014 - 01:32 PM
I want to use a super user to submit any changelist (from any user)
I know that using CLI, I can run P4 login UserName without password and than submit.
How can I do it with Java API?
Thanks in advance,
Posted 08 July 2014 - 11:58 AM
I'm getting a shelved changelist Id and I need to submit it.
The changelist was created by any user in the organization...
I want that after the submission, the same changelist will be submitted and the owner will remain the original user.
Currently I managed to get this flow to work:
1) Change changelist owner to the super-user.
2) Submit the shelved files.
The problems are:
1) The original changelist is deleted (the super user submit the files in a different changelist = different ID)
2) I can't get (by script) the new changelist ID (I need it for changing the owner to the original user from the original changelist)
my questions are:
1) Why is the changelist change number when submitting it? Is there a way to prevent it from happening?
2) Is there a better way to do what I try to do?
Thanks in advance
Posted 09 July 2014 - 12:35 AM
void login(IUser user, StringBuffer ticket, LoginOptions opts) throws P4JavaException
// Connect as the super user (super) IOptionsServer server = ServerFactory.getOptionsServer("p4java://localhost:1666", null); server.connect(); server.setUserName("super"); server.login("Password"); // Impersonate the other user (test) IUser otherUser = server.getUser("test"); server.login(otherUser,null,null) ; // gets ticket, no password needed server.setUserName("test");
An example of using this would be to update a user's changelist description:
// Update the description for 'test' users changelist IChangelist myPendingChange = server.getChangelist(246186); myPendingChange.setDescription("This is the new description text."); myPendingChange.update();
To answer your other questions about changelist numbers changing upon submit, see the following:
Posted 09 July 2014 - 11:19 AM
Any idea if I can get "Original Changelist" using JAVA API? (is there an implementation for p4 change -o -O changeNum described in the link above)
I prefer not to run server.execStreamCmd(...) and parse output.
I couldn't see any variable for this value in the Changelist implementation.
Posted 09 July 2014 - 05:13 PM
ChangelistOptions setOriginalChangelist(boolean originalChangelist)
The field summary mentions:
Options: -s, -f, -u, -O
I am not sure where you were looking but you definitely want to use the Java API manual (http://www.perforce....p4java-javadoc/) for reference as these answers are there.
Also tagged with one or more of these keywords: submit, p4java
[P4java] com.perforce.p4java.exception.AccessException: Perforce password (P4PASSWD) invalid or unset.
com.perforce.p4java.exception.ConnectionException: Unexpected exception in ClientSystemFileCommands.openFile
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users