Mercurial > hgsubversion
annotate tests/test_fetch_symlinks.py @ 330:5f8f2fd4fd54
hg_delta_editor: simplify repository instantiation.
author | Dan Villiom Podlaski Christiansen <danchr@gmail.com> |
---|---|
date | Sat, 09 May 2009 14:46:12 +0200 |
parents | b37c401b7f92 |
children | d2ef7220a079 |
rev | line source |
---|---|
97
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
1 import unittest |
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
2 |
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
3 import test_util |
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
4 |
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
5 |
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
6 class TestFetchSymlinks(test_util.TestBase): |
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
7 def _load_fixture_and_fetch(self, fixture_name, stupid): |
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
8 return test_util.load_fixture_and_fetch(fixture_name, self.repo_path, |
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
9 self.wc_path, stupid=stupid) |
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
10 |
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
11 def test_symlinks(self, stupid=False): |
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
12 repo = self._load_fixture_and_fetch('symlinks.svndump', stupid) |
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
13 # Check no symlink contains the 'link ' prefix |
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
14 for rev in repo: |
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
15 r = repo[rev] |
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
16 for f in r.manifest(): |
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
17 if 'l' not in r[f].flags(): |
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
18 continue |
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
19 self.assertFalse(r[f].data().startswith('link ')) |
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
20 # Check symlinks in tip |
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
21 links = { |
126
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
22 0: { |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
23 'linka': 'a', |
145
b37c401b7f92
hg_delta_editor: reset properties of deleted entries
Patrick Mezard <pmezard@gmail.com>
parents:
126
diff
changeset
|
24 'linka2': 'a', |
126
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
25 'd/linka': 'a', |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
26 }, |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
27 1: { |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
28 'linkaa': 'a', |
145
b37c401b7f92
hg_delta_editor: reset properties of deleted entries
Patrick Mezard <pmezard@gmail.com>
parents:
126
diff
changeset
|
29 'linka2': 'a', |
126
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
30 'd2/linka': 'a', |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
31 }, |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
32 2: { |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
33 'linkaa': 'b', |
145
b37c401b7f92
hg_delta_editor: reset properties of deleted entries
Patrick Mezard <pmezard@gmail.com>
parents:
126
diff
changeset
|
34 'linka2': 'a', |
126
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
35 'd2/linka': 'b', |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
36 }, |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
37 3: { |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
38 }, |
97
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
39 } |
126
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
40 |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
41 for rev in repo: |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
42 ctx = repo[rev] |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
43 for f in ctx.manifest(): |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
44 self.assertEqual(f in links[rev], 'l' in ctx[f].flags()) |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
45 if f in links[rev]: |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
46 self.assertEqual(links[rev][f], ctx[f].data()) |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
47 for f in links[rev]: |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
48 self.assertTrue(f in ctx) |
97
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
49 |
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
50 def test_symlinks_stupid(self): |
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
51 self.test_symlinks(True) |
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
52 |
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
53 def suite(): |
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
54 all = [unittest.TestLoader().loadTestsFromTestCase(TestFetchSymlinks), |
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
55 ] |
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
56 return unittest.TestSuite(all) |