2008-11-21 07:41:15 +03:00
|
|
|
import test_util
|
|
|
|
|
2010-07-14 17:39:18 +04:00
|
|
|
import unittest
|
2008-11-21 07:41:15 +03:00
|
|
|
|
|
|
|
class TestFetchSymlinks(test_util.TestBase):
|
|
|
|
def _load_fixture_and_fetch(self, fixture_name, stupid):
|
|
|
|
return test_util.load_fixture_and_fetch(fixture_name, self.repo_path,
|
|
|
|
self.wc_path, stupid=stupid)
|
|
|
|
|
|
|
|
def test_symlinks(self, stupid=False):
|
|
|
|
repo = self._load_fixture_and_fetch('symlinks.svndump', stupid)
|
2010-11-09 15:05:16 +03:00
|
|
|
# Check symlinks throughout history
|
2008-11-21 07:41:15 +03:00
|
|
|
links = {
|
2008-12-10 20:03:19 +03:00
|
|
|
0: {
|
|
|
|
'linka': 'a',
|
2008-12-16 06:57:10 +03:00
|
|
|
'linka2': 'a',
|
2008-12-10 20:03:19 +03:00
|
|
|
'd/linka': 'a',
|
|
|
|
},
|
|
|
|
1: {
|
|
|
|
'linkaa': 'a',
|
2008-12-16 06:57:10 +03:00
|
|
|
'linka2': 'a',
|
2008-12-10 20:03:19 +03:00
|
|
|
'd2/linka': 'a',
|
|
|
|
},
|
|
|
|
2: {
|
|
|
|
'linkaa': 'b',
|
2008-12-16 06:57:10 +03:00
|
|
|
'linka2': 'a',
|
2008-12-10 20:03:19 +03:00
|
|
|
'd2/linka': 'b',
|
|
|
|
},
|
|
|
|
3: {
|
|
|
|
},
|
2010-11-09 15:05:16 +03:00
|
|
|
4: {
|
|
|
|
'linka3': 'a',
|
|
|
|
},
|
|
|
|
5: {
|
|
|
|
'linka3': 'a',
|
|
|
|
},
|
|
|
|
6: {
|
|
|
|
'linka3': 'a',
|
|
|
|
'linka4': 'link to this',
|
|
|
|
},
|
2008-11-21 07:41:15 +03:00
|
|
|
}
|
2011-10-12 11:35:25 +04:00
|
|
|
|
2008-12-10 20:03:19 +03:00
|
|
|
for rev in repo:
|
|
|
|
ctx = repo[rev]
|
|
|
|
for f in ctx.manifest():
|
|
|
|
self.assertEqual(f in links[rev], 'l' in ctx[f].flags())
|
|
|
|
if f in links[rev]:
|
|
|
|
self.assertEqual(links[rev][f], ctx[f].data())
|
|
|
|
for f in links[rev]:
|
|
|
|
self.assertTrue(f in ctx)
|
2008-11-21 07:41:15 +03:00
|
|
|
|
|
|
|
def test_symlinks_stupid(self):
|
|
|
|
self.test_symlinks(True)
|
|
|
|
|
|
|
|
def suite():
|
|
|
|
all = [unittest.TestLoader().loadTestsFromTestCase(TestFetchSymlinks),
|
|
|
|
]
|
|
|
|
return unittest.TestSuite(all)
|