[p4] P4.NET running print command
Shawn Hladky
p4shawn at gmail.com
Sun Mar 25 17:07:42 PST 2007
P4.Net version 0.9 does not support 'print' to an in-memory stream. As
Patrick said, the work-around is to use the -o flag and send it to a
temporary file.
Alternatively, I have already coded this functionality for v1.0. So, if
you're OK with using an experimental version, you can upgrade and take
advantage of these new methods (P4Connection object):
PrintText: returns a string of the file contents.
PrintStream: writes file contents to an initialized writable Stream object.
PrintStreamEvents: Raises an event for each file, prompting the consumer to
provide a Stream for each file printed.
How stable is v1.0? Well, it passes all the unit tests :-) The new methods
are not yet documented, and I need to do more negative testing. I doubt
I'll change the interface. The code for v1.0 is in the public depot:
//shawnh_public_lt/guest/shawn_hladky/P4.Net/main/
On 3/24/07, Chris Stoy <chrisstoy at gmail.com> wrote:
>
> I would really like to do it without having to write the contents to a
> file. In PyPerforce, you can just execute the "print" command and the
> contents of the file would come back in the results object. I was hoping
> I
> could do the same thing with P4.Net in C#. My goal is to read the data
> out
> of Perforce and then add it to a MySQL database for display on a webpage.
>
> Chris.
>
>
>
>
> On 3/24/07, Patrick Bennett <patrick.bennett at inin.com> wrote:
> >
> > You should be using p4 print -q -o (filename) (depot file)
> > This will put the content of the depot file into the filename specified
> > by -o.
> > Without the -o, p4 print displays the contents to stdout.
> >
> > Chris Stoy wrote:
> > > Hey all,
> > >
> > > Maybe this is a dumb question, but how to I get the contents of a file
> > in
> > > the depot using P4.NET? Normally, using "p4 print" returns the file
> > > contents, but none of the results I get back from P4.NET are giving me
> > > that. All I get are tagged descriptions of the file, but not the
> > contents.
> > > Am I missing something?
> > >
> > > Here is the code I'm using (in C#):
> > >
> > >
> > > P4Connection p4c = new P4Connection();
> > > p4c.Port = "****";
> > > p4c.User = "****";
> > > p4c.Password = "*****";
> > > p4c.Connect();
> > > P4RecordSet result = p4c.Run("print",
> > "//depot-Art/image.jpg");
> > > p4c.Disconnect();
> > >
> > > I can't find anywhere in the P4RecordSet where the file contents are
> > > stored. Any ideas?
> > >
> > > Thanks,
> > >
> > > Chris.
> > > _______________________________________________
> > > perforce-user mailing list - perforce-user at perforce.com
> > > http://maillist.perforce.com/mailman/listinfo/perforce-user
> > >
> > >
> >
> >
> > --
> >
> > *Patrick Bennett* | Software Engineer
> > phone & fax +1.317.715.8302 | patrick.bennett at inin.com
> >
> > *Interactive Intelligence Inc.*
> > Deliberately Innovative
> > www.inin.com <http://www.inin.com/>
> >
> >
> >
> _______________________________________________
> perforce-user mailing list - perforce-user at perforce.com
> http://maillist.perforce.com/mailman/listinfo/perforce-user
>
More information about the perforce-user
mailing list