Fixed bug in p4SyncMissingFiles.py. Also fixed bug in p4Helper when

running p4RemoveUnversioned.py.
This commit is contained in:
unknown 2015-05-13 10:45:04 -06:00
parent c32c0bfbd1
commit ea14f96d76
2 changed files with 36 additions and 27 deletions

View file

@ -85,7 +85,7 @@ def call_process( args ):
def try_call_process( args, path=None ):
try:
subprocess.check_output( args.split( ), shell=False, cwd=path )
subprocess.check_output( args.split( ), shell=False, cwd=path, stderr=subprocess.STDOUT )
return 0
except subprocess.CalledProcessError:
return 1
@ -204,7 +204,7 @@ class P4Workspace:
#print("\nChecking p4 info...")
result = get_p4_py_results('info')
if len(result) == 0 or b'userName' not in result[0].keys():
print("Can't find perforce info, is it even setup?")
print("Can't find perforce info, is it even setup? Possibly can't connect to server.")
sys.exit(1)
username = get_str_from_process_stdout(result[0][b'userName'])
client_host = get_str_from_process_stdout(result[0][b'clientHost'])
@ -297,19 +297,22 @@ class Console( threading.Thread ):
self.auto_flush_time = auto_flush_time * 1000 if auto_flush_time is not None else -1
self.shutting_down = False
def write( self, data ):
self.queue.put( ( Console.MSG.WRITE, threading.current_thread().ident, data ) )
def write( self, data, pid = None ):
pid = pid if pid is not None else threading.current_thread().ident
self.queue.put( ( Console.MSG.WRITE, pid, data ) )
def writeflush( self, data ):
pid = threading.current_thread().ident
def writeflush( self, data, pid = None ):
pid = pid if pid is not None else threading.current_thread().ident
self.queue.put( ( Console.MSG.WRITE, pid, data ) )
self.queue.put( ( Console.MSG.FLUSH, pid ) )
def flush( self ):
self.queue.put( ( Console.MSG.FLUSH, threading.current_thread().ident ) )
def flush( self, pid = None ):
pid = pid if pid is not None else threading.current_thread().ident
self.queue.put( ( Console.MSG.FLUSH, pid ) )
def clear( self ):
self.queue.put( ( Console.MSG.CLEAR, threading.current_thread().ident ) )
def clear( self, pid = None ):
pid = pid if pid is not None else threading.current_thread().ident
self.queue.put( ( Console.MSG.CLEAR, pid ) )
def __enter__( self ):
self.start( )
@ -342,10 +345,14 @@ class Console( threading.Thread ):
self.buffer_write_times[ pid ] = datetime.datetime.now( )
self.buffers[ pid ].append( s )
if self.auto_flush_num >= 0 and len( self.buffers[ pid ] ) >= self.auto_flush_num:
self.flush( pid )
elif self.auto_flush_time >= 0 and ( datetime.datetime.now( ) - self.buffer_write_times[ pid ] ).microseconds >= self.auto_flush_time:
self.flush( pid )
try:
if self.auto_flush_num >= 0 and len( self.buffers[ pid ] ) >= self.auto_flush_num:
self.flush( pid )
elif self.auto_flush_time >= 0 and ( datetime.datetime.now( ) - self.buffer_write_times[ pid ] ).microseconds >= self.auto_flush_time:
self.flush( pid )
except TypeError:
print('"' + pid + '"')
raise
# TODO: if buffer is not empty and we don't auto flush on write, sleep until a time then auto flush according to auto_flush_time
elif event == Console.MSG.FLUSH:
pid = data[ 1 ]