obs-service-tar_scm/bzrfixtures.py

31 lines
797 B
Python
Raw Normal View History

#!/usr/bin/python
import os
from fixtures import Fixtures
from utils import mkfreshdir, run_bzr
class BzrFixtures(Fixtures):
def init(self):
self.create_repo()
self.create_commits(2)
def run(self, cmd):
return run_bzr(self.repo_path, cmd)
def create_repo(self):
os.makedirs(self.repo_path)
os.chdir(self.repo_path)
self.run('init')
self.run('whoami "%s"' % self.name_and_email)
self.wd = self.repo_path
print "created repo", self.repo_path
def do_commit(self, newly_created):
self.run('add .')
self.run('commit -m%d' % self.next_commit_rev)
def record_rev(self, rev_num):
self.revs[rev_num] = str(rev_num)
self.scmlogs.annotate("Recorded rev %d" % rev_num)