Jump to content


P4Java - getting folder's changes

p4java

  • Please log in to reply
2 replies to this topic

#1 eranb

eranb

    Advanced Member

  • Members
  • PipPipPip
  • 55 posts

Posted 17 February 2015 - 09:36 AM

Hi
I'm trying to get a list of folder's submitted changelist with no success.
It works for a single file but not for a folder.

here is my code (server object is initialized and I'm connected):
branch = "//xxx/yyy/zzz";  //With another '/' in the end I get an error for the next line
List<IFileSpec> dirs= server.getDirectories(FileSpecBuilder.makeFileSpecList(branch), false, false, false);
//in this point I got the folder's object in the list.

GetChangelistsOptions ops = new GetChangelistsOptions();
ops.setMaxMostRecent(10);
ops.setType(Type.SUBMITTED);
List<IChangelistSummary> changelists = server.getChangelists(dirs, ops);

Any idea what am I doing wrong?

Thanks

#2 eranb

eranb

    Advanced Member

  • Members
  • PipPipPip
  • 55 posts

Posted 17 February 2015 - 09:42 AM

Found the problem. Missing "/...".
But this way I get all files in this folder...

Another question,
Can I get the folder's latest change without getting all files in it?

Thanks

#3 ThatGuy

ThatGuy

    Advanced Member

  • Members
  • PipPipPip
  • 33 posts

Posted 22 February 2015 - 10:43 PM

Hi EranB,

You could do changes -m 1 to get the latest change only. Set the setMaxMostRecent property to 1.

GetChangelistsOptions ops = new GetChangelistsOptions();
ops.setMaxMostRecent(1)
Certified P4.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users