Mercurial > hgsubversion
annotate tests/test_fetch_symlinks.py @ 430:2851b81c65ce
maps: make sure AuthorMaps don't overwrite themselves, fix overriding
Author maps for the Python repo got truncated because of the author map stupidly
writing upon itself. This patch implements a better and faster scenario, where
entries will only be written to the saved author map if they're not coming from that
file. They're also now streamed into the file directly, instead of having to re-open
the file on every entry, and formatting is preserved.
author | Dirkjan Ochtman <dirkjan@ochtman.nl> |
---|---|
date | Mon, 15 Jun 2009 16:09:27 +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) |