'Iterate the contents of a tree and all subtrees.
Iteration is depth-first pre-order, as in e.g. os.walk.
:param tree_id: SHA1 of the tree.
:param include_trees: If True, include tree objects in the iteration.
:return: Iterator over TreeEntry namedtuples for all the objects in a
tree.'

def iter_tree_contents(self, tree_id, include_trees=False):

    for (entry, _) in walk_trees(self, tree_id, None):
        if ((not stat.S_ISDIR(entry.mode)) or include_trees):
            (yield entry)
