- orig_repo = GitRepository.create(os.path.join(cls.workdir, name))
- orig_repo.commit_dir(TEST_DATA_DIR, 'Initial version', 'master',
- create_missing_branch=True)
- orig_repo.force_head('master', hard=True)
- # Make new commit
- cls.update_repository_file(orig_repo, 'foo.txt', 'new data\n')
- return orig_repo
+ repo_path = os.path.join(cls.workdir, name)
+ #shutil.copytree (TEST_DATA_DIR, orig_repo_path)
+ repo = GitRepository.create(repo_path)
+
+ # First, commit sources only and create branch 'sources'
+ sources = [src for src in os.listdir(TEST_DATA_DIR)
+ if not src in ['packaging', 'debian']]
+ repo.add_files(sources, work_tree=TEST_DATA_DIR)
+ repo.commit_staged('Initial version')
+ # Make one new commit
+ cls.update_repository_file(repo, 'foo.txt', 'new data\n')
+ repo.create_branch('source')
+
+ # Create branch with rpm packaging only
+ repo.add_files('packaging', work_tree=TEST_DATA_DIR)
+ repo.commit_staged('Add rpm packaging files')
+ repo.create_branch('rpm')
+
+ # Master has both debian and rpm packaging
+ repo.add_files('debian', work_tree=TEST_DATA_DIR)
+ repo.commit_staged('Add debian packaging files')
+
+ # Create branch with deb packaging only
+ repo.create_branch('deb', 'source')
+ repo.set_branch('deb')
+ repo.add_files('debian', work_tree=TEST_DATA_DIR)
+ repo.commit_staged('Add deb packaging files')
+
+ repo.set_branch('master')
+ repo.force_head('master', hard=True)
+ return repo