comparison tests/test_fetch_symlinks.py @ 97:0d3a2a7cefa3

hg_delta_editor: fix symlink prefix confusion - SubversionRepo.get_file() strips the symlink prefix - Enforce that hg_delta_editor symlink data always contains the prefix. The alternative was seducing and more consistent with hg content but it makes the code more complicated since svn:special can be set before or after the content is set, and we need it in apply_textdelta() This issue fixes jQuery repository conversion at r3674.
author Patrick Mezard <pmezard@gmail.com>
date Thu, 20 Nov 2008 22:41:15 -0600
parents
children a3b717e4abf5
comparison
equal deleted inserted replaced
96:9b5e528f67f8 97:0d3a2a7cefa3
1 import os
2 import shutil
3 import sys
4 import tempfile
5 import unittest
6
7 from mercurial import hg
8 from mercurial import ui
9 from mercurial import node
10
11 import fetch_command
12 import test_util
13
14
15 class TestFetchSymlinks(test_util.TestBase):
16 def _load_fixture_and_fetch(self, fixture_name, stupid):
17 return test_util.load_fixture_and_fetch(fixture_name, self.repo_path,
18 self.wc_path, stupid=stupid)
19
20 def test_symlinks(self, stupid=False):
21 repo = self._load_fixture_and_fetch('symlinks.svndump', stupid)
22 # Check no symlink contains the 'link ' prefix
23 for rev in repo:
24 r = repo[rev]
25 for f in r.manifest():
26 if 'l' not in r[f].flags():
27 continue
28 self.assertFalse(r[f].data().startswith('link '))
29 # Check symlinks in tip
30 tip = repo['tip']
31 links = {
32 'linkaa': 'b',
33 'd2/linka': 'b',
34 }
35 for f in tip.manifest():
36 self.assertEqual(f in links, 'l' in tip[f].flags())
37 if f in links:
38 self.assertEqual(links[f], tip[f].data())
39
40 def test_symlinks_stupid(self):
41 self.test_symlinks(True)
42
43 def suite():
44 all = [unittest.TestLoader().loadTestsFromTestCase(TestFetchSymlinks),
45 ]
46 return unittest.TestSuite(all)