Getting a Date and description associated with a file revision - Java API Perforce -


I am trying to write a method that takes a file path and an amendment number as its argument The date is amended to relate. When I've added more than 51 revision numbers, the output is confused.

Input string [] filePaths = { "//file/x/y/strings/somefile.csv"}; P4Client.getDateAssociatedWithFileRevision (file path, 52);

Output - this should be just one line ...

  Rev number: 2 :: Mod Date: Wed Aug 24 23:48:42 BST 2005 Rev Number: 52 :: Mod Date: Wed 24 Aug 23:52:53 BST 2005 Rev Number: 51 :: Mod Date: Sat Aug 20 02:01:59 BST 2005   

getDateAssociatedWithFileRevision

  public date getDateAssociatedWithFileRevision (string [] filePath, int revisionNumber) {list & lt; IFileSpec & gt; FileList = null; Click the & lt; IFileSpec, from the list & lt; IFileRevisionData & gt; & Gt; FileRevisionData = Null; String currentfile = null; Date modified date = null; Try {string file = filespace [0] + "#" + revision number; CurrentFile = File; FileList = getIFileSpecList (file); // IFileSpec fileSpec: Get the list of files in path for fileList {if (file.toString () == null {System.out.println ("\" "+ currentFile +" \ "" + "does not exist is..."); break; } FileRevisionData = fileSpec.getRevisionHistory (0, true, false, true, false); Int i = 0; (List & lt; IFileRevisionData & gt; Revision Data: fileRevisionData.values ​​()) for {revisionDate = revisionData.get (0) .getDate (); Int revision = revisionData.get (0) .getRevision (); System.out.println ("Amendment Number:" + Amendment + "::" "Date Modified:" + Modification Date); Println (i); I ++; }}} Hold (exception e) {e.printStackTrace ();} return revision date; }   

GetIFileSpecList public list & lt; IFileSpec & gt; GetIFileSpecList {string file} {list & lt; IFileSpec & gt; FileList = null; {FileList = iServer.getDepotFiles (try fileSpecBuilder.makeFileSpecList (new string [] {file}), Incorrect); // Get the list of file (s) in Path} Grip (Exception e) {e.printStackTrace ();} Return file list; }

Edit

It has been detected that after the integration, the output is being messed up, There is a need to find the method now ..

This command line idea ("P4 file" They will get the information, will be parsed ") and affect the joints of the data for yourself. Then java-ijj

 % p4 -ztag files //guest/jeff_bowles/scripts/0228devbranch.html ... Depot.me //guest/jeff_bowles/scripts/0228devbranch.html ... Rev 2 ... changes 4421 ... edit action ... type ktext ... time 1093044566% p4 -ztag files //guest/jeff_bowles/scripts/0228devbranch.html#1 ... depotFile // guest / jeff_bowles / script / 0228devbranch.html ... Rev 1 ... Change 4420 ... add add ... type ktext ... time 1093042787    

Comments