Notice: the grml team is migrating from Mercurial to Git.
Please visit git.grml.org instead!
| author | Michael Gebetsroither <michael.geb@gmx.at> |
| Sat Mar 29 14:04:38 2008 +0100 (8 months ago) | |
| changeset 189 | 86b21ea39b2e |
| manifest | 86b21ea39b2e |
| parent 188 | b557ae7e33cd |
| child 190 | 7ecc67a45181 |
--- a/reposearch Sat Mar 29 13:06:39 2008 +0100+++ b/reposearch Sat Mar 29 14:04:38 2008 +0100@@ -32,9 +32,10 @@ def repofilter(dir, x):return os.path.isdir(os.path.join(dir, x))def gitbarefilter(dir, x):- if dir.endswith(x):- if len(os.path.basename(dir)) >4:- if os.path.exists(os.path.join(dir, 'config')):+ tmp = os.path.abspath(dir)+ if tmp.endswith(x):+ if len(os.path.basename(tmp)) >4:+ if os.path.exists(os.path.join(tmp, 'config')):return Truereturn False
--- a/tests/reposearch_tests.py Sat Mar 29 13:06:39 2008 +0100+++ b/tests/reposearch_tests.py Sat Mar 29 14:04:38 2008 +0100@@ -15,18 +15,18 @@ class Base(unittest.TestCase):old = op.abspath(os.curdir)dir = self.dirif append_dir != None:- op.join(dir, append_dir)- os.chdir(self.dir)+ dir = op.join(dir, append_dir)+ os.chdir(dir)try:tmp = f()finally:os.chdir(old)return tmp- def innerT(self, walkfun, testdir, repotype, filter_fun=None):+ def innerT(self, walkfun, testdir, repotype, filter_fun=None, append_dir=None):'''Test walkfun()/2 inside testdir on repotype'''filter_fun = filter_fun or rs.repo_types[repotype]should = self.data- curr = sorted(self.inner(lambda: list(walkfun(testdir, filter_fun))))+ curr = sorted(self.inner(lambda: list(walkfun(testdir, filter_fun)), append_dir))self.assertEqual(should, curr)def outerT(self, walkfun, testdir, repotype, filter_fun=None):'''Test walkfun()/2 from outside testdir on repotype'''@@ -88,6 +88,17 @@ class CompoundRec(Base):filter_fun = rs.create_filter('git gitbare bzr'.split())self.innerT(rs.walkrepos, 'compound', None, filter_fun)+class RepoInner(Base):+ data = ['.']+ def test_git_within_flat(self):+ self.innerT(rs.walkrepos_flat, '.', 'git', append_dir='repoinner/git')+ def test_git_within_rec(self):+ self.innerT(rs.walkrepos, '.', 'git', append_dir='repoinner/git')+ def test_gitbare_within_flat(self):+ self.innerT(rs.walkrepos_flat, '.', 'gitbare', append_dir='repoinner/git.git')+ def test_gitbare_within_rec(self):+ self.innerT(rs.walkrepos, '.', 'gitbare', append_dir='repoinner/git.git')+if __name__ == "__main__":unittest.main()