#NEWLINE# def apply_patch_for_empty_files( self , patch , p_num , revert = False ) : #NEWLINE# #INDENT# 'Return True if any empty files in the patch are applied.\n\n        If there are no empty files in the patch or if an error occurs while\n        applying the patch, we return False.\n        ' #NEWLINE# patched_empty_files = False #NEWLINE# added_files = re . findall ( ( '--- %s\\t%s\\n\\+\\+\\+ b/(\\S+)\\t[^\\r\\n\\t\\f]+\\n(?:[^@]|$)' % ( self . PRE_CREATION , re . escape ( self . PRE_CREATION_DATE ) ) ) , patch ) #NEWLINE# deleted_files = re . findall ( ( '--- a/(\\S+)\\t[^\\r\\n\\t\\f]+\\n\\+\\+\\+ %s\\t%s\\n(?:[^@]|$)' % ( self . PRE_CREATION , re . escape ( self . PRE_CREATION_DATE ) ) ) , patch ) #NEWLINE# if added_files : #NEWLINE# #INDENT# added_files = self . _strip_p_num_slashes ( added_files , int ( p_num ) ) #NEWLINE# make_empty_files ( added_files ) #NEWLINE# result = execute ( ( [ 'hg' , 'add' ] + added_files ) , ignore_errors = True , none_on_ignored_error = True ) #NEWLINE# if ( result is None ) : #NEWLINE# #INDENT# logging . error ( 'Unable to execute "hg add" on: %s' , ', ' . join ( added_files ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# patched_empty_files = True #NEWLINE# #UNINDENT# #UNINDENT# if deleted_files : #NEWLINE# #INDENT# deleted_files = self . _strip_p_num_slashes ( deleted_files , int ( p_num ) ) #NEWLINE# result = execute ( ( [ 'hg' , 'remove' ] + deleted_files ) , ignore_errors = True , none_on_ignored_error = True ) #NEWLINE# if ( result is None ) : #NEWLINE# #INDENT# logging . error ( 'Unable to execute "hg remove" on: %s' , ', ' . join ( deleted_files ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# patched_empty_files = True #NEWLINE# #UNINDENT# #UNINDENT# return patched_empty_files