'Add a list of items to a treewidget item.'

def _set_subtree(self, items, idx, staged=False, untracked=False, deleted_set=None):

    self.blockSignals(True)
    parent = self.topLevelItem(idx)
    hide = (not bool(items))
    parent.setHidden(hide)
    while (parent.takeChild(0) is not None):
        pass
    for item in items:
        deleted = ((deleted_set is not None) and (item in deleted_set))
        treeitem = qtutils.create_treeitem(item, staged=staged, deleted=deleted, untracked=untracked)
        parent.addChild(treeitem)
    self.expand_items(idx, items)
    self.blockSignals(False)
