[p4] How to use Perforce P4/PERL API to get filelog info?

Gross, Steve SGross at sjm.com
Tue Jan 26 12:12:45 PST 2010


Perldoc is one thing; but the online documentation really should clarify that the Integrations() function is indeed available.

--Steve

> -----Original Message-----
> From: David Foglesong [mailto:defoglesong at msn.com]
> Sent: Tuesday, January 26, 2010 2:12 PM
> To: Gross, Steve; jeff.n.grills at disney.com; perforce-user at perforce.com
> Subject: RE: [p4] How to use Perforce P4/PERL API to get filelog info?
> 
> 
> "perldoc P4" on my system (built for 2008.2) contains a pretty clear
> example of using RunFilelog that shows the presence of the
> Integrations() method:
> 
>        RunFilelog( $args ... )
>            Runs a "p4 filelog" with the supplied arguments, and returns
> the
>            results as an array of P4::DepotFile objects. Tagged output
> for "p4
>            filelog" is not easy to read, nor is it easy to handle
> programmati-
>            cally, so this wrapper converts it into an array of objects
> to make
>            it easier to work with. For example:
> 
>              foreach $file ( $p4->RunFilelog( "//depot/path/..." ) )
>              {
>                  printf( "%s\n", $file->DepotFile() );
>                  foreach $rev ( $file->Revisions() )
>                  {
>                      printf( "... #%d %s by %s@%s %s\n",
>                            $rev->Rev(),
>                            $rev->Action(),
>                            $rev->User(),
>                            $rev->Client(),
>                            $rev->Desc() );
> 
>                      foreach $integ ( $rev->Integrations() )
>                      {
>                            printf( "... ... %s %s#%d,%d\n",
>                                    $integ->How(),
>                                    $integ->File(),
>                                    $integ->SRev() + 1,
>                                    $integ->ERev()
>                                    );
>                      }
>                  }
>              }
> 
> "perldoc P4::DepotFile" and "perldoc P4::Integration" and "perldoc
> P4::Revision" will give you more details about those objects and the
> methods they support.
> 
> Incidentally, an easy way to look at a data structure is to use the
> Data::Dumper module. e.g.,
> 
> use Data::Dumper;
> # ... do P4 operations here to get your list of stuff ...
> print Dumper @ListOfStuff;
> 
> David Foglesong
> 

This communication, including any attachments, may contain information that is proprietary, privileged, confidential or legally exempt from disclosure.  If you are not a named addressee, you are hereby notified that you are not authorized to read, print, retain a copy of or disseminate any portion of this communication without the consent of the sender and that doing so may be unlawful.  If you have received this communication in error, please immediately notify the sender via return e-mail and delete it from your system.



More information about the perforce-user mailing list