#NEWLINE# def add_hg_segment( powerline ) : #NEWLINE# #INDENT# branch = os . popen ( 'hg branch 2> /dev/null' ) . read ( ) . rstrip ( ) #NEWLINE# if ( len ( branch ) == 0 ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# bg = Color . REPO_CLEAN_BG #NEWLINE# fg = Color . REPO_CLEAN_FG #NEWLINE# ( has_modified_files , has_untracked_files , has_missing_files ) = get_hg_status ( ) #NEWLINE# if ( has_modified_files or has_untracked_files or has_missing_files ) : #NEWLINE# #INDENT# bg = Color . REPO_DIRTY_BG #NEWLINE# fg = Color . REPO_DIRTY_FG #NEWLINE# extra = '' #NEWLINE# if has_untracked_files : #NEWLINE# #INDENT# extra += '+' #NEWLINE# #UNINDENT# if has_missing_files : #NEWLINE# #INDENT# extra += '!' #NEWLINE# #UNINDENT# branch += ( ( ' ' + extra ) if ( extra != '' ) else '' ) #NEWLINE# #UNINDENT# return powerline . append ( ( ' %s ' % branch ) , fg , bg )