Mercurial > hgsubversion
annotate tests/test_fetch_symlinks.py @ 791:05ee7d5351de
editor: simplify add_directory() a bit more
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Wed, 09 Mar 2011 22:07:17 +0100 |
parents | b3128fec5d54 |
children | e9af7eba88db |
rev | line source |
---|---|
97
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
1 import test_util |
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
2 |
643
d2ef7220a079
tests: import test_util as the first module in all relevant tests
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
145
diff
changeset
|
3 import unittest |
97
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 class TestFetchSymlinks(test_util.TestBase): |
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
6 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
|
7 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
|
8 self.wc_path, stupid=stupid) |
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
9 |
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
10 def test_symlinks(self, stupid=False): |
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
11 repo = self._load_fixture_and_fetch('symlinks.svndump', stupid) |
741
b3128fec5d54
editor: handle property changes to links.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
643
diff
changeset
|
12 # Check symlinks throughout history |
97
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
13 links = { |
126
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
14 0: { |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
15 'linka': 'a', |
145
b37c401b7f92
hg_delta_editor: reset properties of deleted entries
Patrick Mezard <pmezard@gmail.com>
parents:
126
diff
changeset
|
16 'linka2': 'a', |
126
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
17 'd/linka': 'a', |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
18 }, |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
19 1: { |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
20 'linkaa': 'a', |
145
b37c401b7f92
hg_delta_editor: reset properties of deleted entries
Patrick Mezard <pmezard@gmail.com>
parents:
126
diff
changeset
|
21 'linka2': 'a', |
126
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
22 'd2/linka': 'a', |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
23 }, |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
24 2: { |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
25 'linkaa': 'b', |
145
b37c401b7f92
hg_delta_editor: reset properties of deleted entries
Patrick Mezard <pmezard@gmail.com>
parents:
126
diff
changeset
|
26 'linka2': 'a', |
126
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
27 'd2/linka': 'b', |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
28 }, |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
29 3: { |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
30 }, |
741
b3128fec5d54
editor: handle property changes to links.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
643
diff
changeset
|
31 4: { |
b3128fec5d54
editor: handle property changes to links.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
643
diff
changeset
|
32 'linka3': 'a', |
b3128fec5d54
editor: handle property changes to links.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
643
diff
changeset
|
33 }, |
b3128fec5d54
editor: handle property changes to links.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
643
diff
changeset
|
34 5: { |
b3128fec5d54
editor: handle property changes to links.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
643
diff
changeset
|
35 'linka3': 'a', |
b3128fec5d54
editor: handle property changes to links.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
643
diff
changeset
|
36 }, |
b3128fec5d54
editor: handle property changes to links.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
643
diff
changeset
|
37 6: { |
b3128fec5d54
editor: handle property changes to links.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
643
diff
changeset
|
38 'linka3': 'a', |
b3128fec5d54
editor: handle property changes to links.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
643
diff
changeset
|
39 'linka4': 'link to this', |
b3128fec5d54
editor: handle property changes to links.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
643
diff
changeset
|
40 }, |
97
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
41 } |
126
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
42 |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
43 for rev in repo: |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
44 ctx = repo[rev] |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
45 for f in ctx.manifest(): |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
46 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
|
47 if f in links[rev]: |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
48 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
|
49 for f in links[rev]: |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
50 self.assertTrue(f in ctx) |
97
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
51 |
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
52 def test_symlinks_stupid(self): |
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
53 self.test_symlinks(True) |
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
54 |
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
55 def suite(): |
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
56 all = [unittest.TestLoader().loadTestsFromTestCase(TestFetchSymlinks), |
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
57 ] |
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
58 return unittest.TestSuite(all) |