def worktree_state(head=u'HEAD', update_index=False, display_untracked=True, paths=None):
 if update_index:
  git.update_index(refresh=True)
 (staged, unmerged, staged_deleted, staged_submods) = diff_index(head, paths=paths)
 (modified, unstaged_deleted, modified_submods) = diff_worktree(paths)
 untracked = ((display_untracked and untracked_files(paths=paths)) or [])
 if unmerged:
  unmerged_set = set(unmerged)
  modified = [path for path in modified if (path not in unmerged_set)]
 upstream_changed = diff_upstream(head)
 staged.sort()
 modified.sort()
 unmerged.sort()
 untracked.sort()
 upstream_changed.sort()
 return {u'staged': staged, u'modified': modified, u'unmerged': unmerged, u'untracked': untracked, u'upstream_changed': upstream_changed, u'staged_deleted': staged_deleted, u'unstaged_deleted': unstaged_deleted, u'submodules': (staged_submods | modified_submods)}

def worktree_state ( head = u'HEAD' , update_index = False , display_untracked = True , paths = None ) : if update_index : git . update_index ( refresh = True ) ( staged , unmerged , staged_deleted , staged_submods ) = diff_index ( head , paths = paths ) ( modified , unstaged_deleted , modified_submods ) = diff_worktree ( paths ) untracked = ( ( display_untracked and untracked_files ( paths = paths ) ) or [ ] ) if unmerged : unmerged_set = set ( unmerged ) modified = [ path for path in modified if ( path not in unmerged_set ) ] upstream_changed = diff_upstream ( head ) staged . sort ( ) modified . sort ( ) unmerged . sort ( ) untracked . sort ( ) upstream_changed . sort ( ) return { u'staged' : staged , u'modified' : modified , u'unmerged' : unmerged , u'untracked' : untracked , u'upstream_changed' : upstream_changed , u'staged_deleted' : staged_deleted , u'unstaged_deleted' : unstaged_deleted , u'submodules' : ( staged_submods | modified_submods ) }
return a dict of files in various states of being :rtype: dict .