obs-service-tar_scm/svnfixtures.py
Adrian Schröter e7fbd5920f Accepting request 105040 from home:aspiers:branches:openSUSE:Tools
Mon Feb  13 15:52:19 GMT 2012 - aspiers@suse.com
Add test suite and fix two bugs it found:

  1. --subdir was not working
  2. --scm bzr was not working

FWIW it also works on SLE11 now.

I will issue a separate request for my enhancements to
tar_scm, since they are much more intrusive (but have
about 90% test coverage).

OBS-URL: https://build.opensuse.org/request/show/105040
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Tools/obs-service-tar_scm?expand=0&rev=32
2012-02-15 16:34:15 +00:00

45 lines
1.2 KiB
Python

#!/usr/bin/python
import os
from fixtures import Fixtures
from utils import mkfreshdir, quietrun, run_svn
class SvnFixtures(Fixtures):
def init(self):
self.wd_path = self.container_dir + '/wd'
self.create_repo()
self.checkout_repo()
self.added = { }
self.timestamps = { }
self.create_commits(2)
def run(self, cmd):
return run_svn(self.wd_path, cmd)
def create_repo(self):
quietrun('svnadmin create ' + self.repo_path)
print "created repo", self.repo_path
def checkout_repo(self):
mkfreshdir(self.wd_path)
quietrun('svn checkout %s %s' % (self.repo_url, self.wd_path))
self.wd = self.wd_path
def do_commit(self, newly_created):
for new in newly_created:
if not new in self.added:
self.run('add ' + new)
self.added[new] = True
self.run('commit -m%d' % self.next_commit_rev)
def get_metadata(self, formatstr):
return self.run('log -n1' % formatstr)[0]
def record_rev(self, rev_num):
self.revs[rev_num] = str(rev_num)
self.scmlogs.annotate("Recorded rev %d" % rev_num)