[p4python] Possible to show sync output as it's happening, instead of returning it?

John Burk jburk at radical.ca
Thu Dec 22 17:13:44 PST 2005


No problem.

This brings up a different question.  I originally wrote some routines
to handle "Can't clobber writable file...." ( it's a long story of an
inherited system... )

========================================================
try:
    print p4c.run_sync( filePaths )
except p4.P4Error, e:
    if e.startswith("Can't clobber writable file"):
        fileName = e.split()[4] + revSpec
        print 'forcibly syncing writable file ' + fileName
        p4c.run_sync( '-f', fileName )

=========================================================

If I've got 10 files that are out of date and need to be sync'd, and the
5th file is writable and throws an exception, I'm guessing that that
last 5 files don't get sync'd.  Is that correct?

If so, oops.
 
John Burk |  Radical Entertainment | 604.601.6970 | jburk at radical.ca

 


> -----Original Message-----
> From: Robert Cowham [mailto:robert at vaccaperna.co.uk]
> Sent: Thursday, December 22, 2005 3:37 PM
> To: John Burk; p4python at perforce.com
> Subject: RE: [p4python] Possible to show sync output as it's
happening,instead of returning it?
> 
> How keen are you to dive into the depths of the code?!
> 
> You could customise p4.py and override method:
> 
> class P4ClientHandler:
>     def OutputInfo(self, data, level):
>         "Parse the given data, adding it to self data."
>         for line in string.split(data, '\n'):
>             self.output.append(line)
> 
> And just print it instead of saving it...
> 
> Robert
> 
> > -----Original Message-----
> > From: p4python-bounces at perforce.com
> > [mailto:p4python-bounces at perforce.com] On Behalf Of John Burk
> > Sent: 22 December 2005 21:04
> > To: p4python at perforce.com
> > Subject: [p4python] Possible to show sync output as it's
> > happening,instead of returning it?
> >
> > Quite a few of the scripts that end users run involve a sync
> > performed like so:
> >
> >    print p4c.run_sync( filePath )
> >
> > I have users who don't sync for quite a while and the depot
> > is ~huge~ (sound for a video game, >2GB), and when they do,
> > are fairly disconcerted when they don't see any output for
> > several minutes; run_sync doesn't return anything until
> > _after_ the sync is finished, which can be up to 15 minutes.
> >
> > They think something's hung, and usually kill and re-start
> > the process.  I could add a 'please wait', but I'm never sure
> > how patient they're going to be...
> >
> > Is there any way to get the p4.run() method to print to
> > stdout as it's running, instead of collecting all the output
> > and returning it?
> >
> > John Burk |  Radical Entertainment | 604.601.6970 | jburk at radical.ca
> >
> >
> >
> > _______________________________________________
> > p4python mailing list
> > p4python at maillist.perforce.com
> > http://maillist.perforce.com/mailman/listinfo/p4python
> >
> >
> 





More information about the p4python mailing list