view tests/test_fetch_truncated.py @ 1293:9e85feb93984

wrappers: improve push performance by reusing the existing metadata Push operation for n commits regenerated SVNMeta class 2*n+1 times (one time at beginning, n times in push() loop, 1 time per each of n pulls). This operation is very costly when the revision map is big. This commit reuses this metadata every time when there is no rebase made between svn commits which leads to 1 metadata rebuild in optimistic case and n+1 metadata rebuilds in pessimistic case (rebase after every commit). To achieve this I added extra parameter to pull command to pass metadata to it. All unit tests are passing for this change.
author Mateusz Kwapich <mitrandir@fb.com>
date Fri, 12 Dec 2014 16:17:11 -0800
parents 825fd4c0396c
children
line wrap: on
line source

import test_util

import unittest

from mercurial import commands
from mercurial import hg

class TestFetchTruncatedHistory(test_util.TestBase):
    stupid_mode_tests = True

    def test_truncated_history(self):
        # Test repository does not follow the usual layout
        repo_path = self.load_svndump('truncatedhistory.svndump')
        svn_url = test_util.fileurl(repo_path + '/project2')
        commands.clone(self.ui(), svn_url, self.wc_path, noupdate=True)
        repo = hg.repository(self.ui(), self.wc_path)

        # We are converting /project2/trunk coming from:
        #
        # Changed paths:
        #     D /project1
        #     A /project2/trunk (from /project1:2)
        #
        # Here a full fetch should be performed since we are starting
        # the conversion on an already filled branch.
        tip = repo['tip']
        files = tip.manifest().keys()
        files.sort()
        self.assertEqual(files, ['a', 'b'])
        self.assertEqual(repo['tip']['a'].data(), 'a\n')