#NEWLINE# def diff_worktree( git_worktree , git_projects , branch , cmd = None ) : #NEWLINE# #INDENT# ' Run  `git <cmd> local_branch..remote_branch` for every project\n\n    ' #NEWLINE# if ( not cmd ) : #NEWLINE# #INDENT# cmd = [ 'log' ] #NEWLINE# #UNINDENT# remote_projects = git_worktree . get_projects_on_branch ( branch ) #NEWLINE# for git_project in git_projects : #NEWLINE# #INDENT# remote_project = remote_projects . get ( git_project . src ) #NEWLINE# if ( not remote_project ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# git = qisrc . git . Git ( git_project . path ) #NEWLINE# local_branch = git . get_current_branch ( ) #NEWLINE# if ( not local_branch ) : #NEWLINE# #INDENT# message = ( ui . brown , 'Not on a branch' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# remote_branch = remote_project . default_branch . name #NEWLINE# remote_ref = ( '%s/%s' % ( remote_project . default_remote . name , remote_branch ) ) #NEWLINE# if ( cmd [ 0 ] == 'diff' ) : #NEWLINE# #INDENT# full_cmd = ( cmd + [ remote_ref , local_branch ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# full_cmd = ( cmd + [ ( '%s...%s' % ( remote_ref , local_branch ) ) ] ) #NEWLINE# #UNINDENT# color = ui . config_color ( sys . stdout ) #NEWLINE# if color : #NEWLINE# #INDENT# full_cmd . append ( '--color=always' ) #NEWLINE# #UNINDENT# ( rc , out ) = git . call ( * full_cmd , raises = False ) #NEWLINE# if ( rc != 0 ) : #NEWLINE# #INDENT# message = ( ui . red , 'git' , ' ' . join ( full_cmd ) , '\n' , out ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if out : #NEWLINE# #INDENT# message = ( out , ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# ui . info ( ui . bold , git_project . src ) #NEWLINE# ui . info ( ui . bold , ( '-' * len ( git_project . src ) ) ) #NEWLINE# ui . info ( * message ) #NEWLINE# ui . info ( )