view tests/test_fetch_symlinks.py @ 120:f508c1fa19a5

hg_delta_editor: do not assume branches are copied from trunk by default Here is what happen in jquery repository: - kelvin-dev branch is created in r1617 with an empty directory for the datePicker plugin - commits are done - datePicker plugin is merged in trunk Before the fix, the converter assumed the initial empty commit had for parent some other commit of trunk, therefore adding all its files, which was wrong. And we ended with 'alignDemo.html' in converted trunk@5946 while it was not in the source revision.
author Patrick Mezard <pmezard@gmail.com>
date Sat, 29 Nov 2008 11:25:01 -0600
parents a3b717e4abf5
children 24a64fb0e74b
line wrap: on
line source

import unittest

import test_util


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)
        # Check no symlink contains the 'link ' prefix
        for rev in repo:
            r = repo[rev]
            for f in r.manifest():
                if 'l' not in r[f].flags():
                    continue
                self.assertFalse(r[f].data().startswith('link '))
        # Check symlinks in tip
        tip = repo['tip']
        links = {
            'linkaa': 'b',
            'd2/linka': 'b',
            }
        for f in tip.manifest():
            self.assertEqual(f in links, 'l' in tip[f].flags())
            if f in links:
                self.assertEqual(links[f], tip[f].data())

    def test_symlinks_stupid(self):
        self.test_symlinks(True)

def suite():
    all = [unittest.TestLoader().loadTestsFromTestCase(TestFetchSymlinks),
          ]
    return unittest.TestSuite(all)