return set(blobs)
@classmethod
- def _check_repo_state(cls, repo, current_branch, branches, files=None):
+ def _check_repo_state(cls, repo, current_branch, branches, files=None,
+ dirs=None):
"""Check that repository is clean and given branches exist"""
branch = repo.branch
eq_(branch, current_branch)
assert_msg = "Branches: expected %s, found %s" % (branches,
local_branches)
eq_(set(local_branches), set(branches), assert_msg)
- if files is not None:
+ if files is not None or dirs is not None:
# Get files of the working copy recursively
- local = set()
+ local_f = set()
+ local_d = set()
for dirpath, dirnames, filenames in os.walk(repo.path):
# Skip git dir(s)
if '.git' in dirnames:
dirnames.remove('.git')
for filename in filenames:
- local.add(os.path.relpath(os.path.join(dirpath, filename),
- repo.path))
+ local_f.add(os.path.relpath(os.path.join(dirpath, filename),
+ repo.path))
for dirname in dirnames:
- local.add(os.path.relpath(os.path.join(dirpath, dirname),
- repo.path) + '/')
- cls.check_files(files, local)
+ local_d.add(os.path.relpath(os.path.join(dirpath, dirname),
+ repo.path) + '/')
+ if files is not None:
+ cls.check_files(files, local_f)
+ if dirs is not None:
+ cls.check_files(dirs, local_d)
def _capture_log(self, capture=True):
""" Capture log"""
srpm = os.path.join(DATA_DIR, 'gbp-test-native-1.0-1.src.rpm')
eq_(mock_import(['--native', srpm]), 0)
# Check repository state
- files = {'.gbp.conf', 'Makefile', 'README', 'dummy.sh', 'packaging/',
+ files = {'.gbp.conf', 'Makefile', 'README', 'dummy.sh',
'packaging/gbp-test-native.spec'}
repo = GitRepository('gbp-test-native')
self._check_repo_state(repo, 'master', ['master'], files)
srpm]), 0)
# Check repository state
repo = GitRepository('gbp-test2')
- files = {'Makefile', 'README', 'dummy.sh', 'packaging/',
- 'packaging/bar.tar.gz', 'packaging/foo.txt',
- 'packaging/gbp-test2.spec', 'packaging/gbp-test2-alt.spec',
- 'packaging/my.patch', 'packaging/my2.patch',
- 'packaging/my3.patch'}
+ files = {'Makefile', 'README', 'dummy.sh', 'packaging/bar.tar.gz',
+ 'packaging/foo.txt', 'packaging/gbp-test2.spec',
+ 'packaging/gbp-test2-alt.spec', 'packaging/my.patch',
+ 'packaging/my2.patch', 'packaging/my3.patch'}
self._check_repo_state(repo, 'pack', ['pack', 'orig'], files)
eq_(len(repo.get_commits()), 2)
# Check packaging dir