Mercurial > hgsubversion
view tests/test_unaffected_core.py @ 787:4bbc6bf947f5 1.2.1
replay: fetch full revision at most once per run (issue252)
Before this change, hgsubversion was fetching full revisions from the first
revision the project was created to the first revision containing converted
data. Unfortunately, some projects exhibits such spans longer than 500
revisions, during which hgsubversion was uselessly scanning the whole tree. The
fix is not technically perfect, we could record somewhere that while no data
was converted we scanned the project already, instead of scanning once at every
hgsubversion run until a revision is converted. But it should be good enough
unless someone runs hgsubversion once for every target revision.
One repository exhibiting this behaviour:
svn://svn.zankasoftware.com/zanka
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Sun, 13 Feb 2011 20:10:52 +0100 |
parents | 69c0e7c4faf9 |
children | f07bfd66db13 |
line wrap: on
line source
import test_util import os import unittest from mercurial import commands from mercurial import dispatch from mercurial import error from mercurial import hg from mercurial import node from mercurial import ui class TestMercurialCore(test_util.TestBase): ''' Test that the core Mercurial operations aren't broken by hgsubversion. ''' @test_util.requiresoption('updaterev') def test_update(self): ''' Test 'clone --updaterev' ''' ui = self.ui() dispatch._dispatch(ui, ['init', self.wc_path]) repo = self.repo repo.ui.setconfig('ui', 'username', 'anonymous') fpath = os.path.join(self.wc_path, 'it') f = file(fpath, 'w') f.write('C1') f.flush() commands.add(ui, repo) commands.commit(ui, repo, message="C1") f.write('C2') f.flush() commands.commit(ui, repo, message="C2") f.write('C3') f.flush() commands.commit(ui, repo, message="C3") self.assertEqual(len(repo), 3) updaterev = 1 dispatch._dispatch(ui, ['clone', self.wc_path, self.wc_path + '2', '--updaterev=%s' % updaterev]) repo2 = hg.repository(ui, self.wc_path + '2') self.assertEqual(str(repo[updaterev]), str(repo2['.'])) @test_util.requiresoption('branch') def test_branch(self): ''' Test 'clone --branch' ''' ui = self.ui() dispatch._dispatch(ui, ['init', self.wc_path]) repo = self.repo repo.ui.setconfig('ui', 'username', 'anonymous') fpath = os.path.join(self.wc_path, 'it') f = file(fpath, 'w') f.write('C1') f.flush() commands.add(ui, repo) commands.branch(ui, repo, label="B1") commands.commit(ui, repo, message="C1") f.write('C2') f.flush() commands.branch(ui, repo, label="default") commands.commit(ui, repo, message="C2") f.write('C3') f.flush() commands.branch(ui, repo, label="B2") commands.commit(ui, repo, message="C3") self.assertEqual(len(repo), 3) branch = 'B1' dispatch._dispatch(ui, ['clone', self.wc_path, self.wc_path + '2', '--branch', branch]) repo2 = hg.repository(ui, self.wc_path + '2') self.assertEqual(repo[branch].hex(), repo2['.'].hex()) def suite(): all = [unittest.TestLoader().loadTestsFromTestCase(TestMercurialCore)] return unittest.TestSuite(all)