From 826ab04197db4eab6eba4115d40a62bf1c75f205 Mon Sep 17 00:00:00 2001 From: Markus Lehtonen Date: Thu, 26 Jun 2014 10:05:01 +0300 Subject: [PATCH] ComponentTestBase: add ls_tree() method Signed-off-by: Markus Lehtonen --- tests/component/__init__.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/component/__init__.py b/tests/component/__init__.py index 6eb74fc..b509c3b 100644 --- a/tests/component/__init__.py +++ b/tests/component/__init__.py @@ -137,6 +137,13 @@ class ComponentTestBase(object): (list(extra), list(missing)) assert not extra and not missing, assert_msg + @staticmethod + def ls_tree(repo, treeish): + """List contents (blobs) in a git treeish""" + objs = repo.list_tree(treeish, True) + blobs = [obj[3] for obj in objs if obj[1] == 'blob'] + return set(blobs) + @classmethod def _check_repo_state(cls, repo, current_branch, branches, files=None): """Check that repository is clean and given branches exist""" -- 2.7.4