2018-01-03 22:51:20 +03:00
|
|
|
# no-check-code -- see T24862348
|
|
|
|
|
2013-08-27 03:40:31 +04:00
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
|
|
|
|
from mercurial import hg
|
2018-01-17 14:23:44 +03:00
|
|
|
import test_hgsubversion_util
|
2018-01-11 03:20:54 +03:00
|
|
|
from hgext.hgsubversion import svnwrap
|
2013-08-27 03:40:31 +04:00
|
|
|
|
|
|
|
|
|
|
|
def _do_case(self, name, stupid):
|
2018-01-17 14:23:44 +03:00
|
|
|
subdir = test_hgsubversion_util.subdir.get(name, '')
|
2013-08-27 03:40:31 +04:00
|
|
|
config = {
|
|
|
|
'hgsubversion.stupid': stupid and '1' or '0',
|
|
|
|
}
|
|
|
|
repo, repo_path = self.load_and_fetch(name,
|
|
|
|
subdir=subdir,
|
|
|
|
layout='auto',
|
|
|
|
config=config)
|
2018-01-17 14:23:44 +03:00
|
|
|
assert test_hgsubversion_util.repolen(self.repo) > 0, \
|
|
|
|
'Repo had no changes, maybe you need to add a subdir entry in test_hgsubversion_util?'
|
2013-08-27 03:40:31 +04:00
|
|
|
wc2_path = self.wc_path + '_custom'
|
|
|
|
checkout_path = repo_path
|
|
|
|
if subdir:
|
|
|
|
checkout_path += '/' + subdir
|
2018-01-17 14:23:44 +03:00
|
|
|
u = test_hgsubversion_util.testui(stupid=stupid, layout='custom')
|
|
|
|
for branch, path in test_hgsubversion_util.custom.get(name, {}).iteritems():
|
2013-08-27 03:40:31 +04:00
|
|
|
u.setconfig('hgsubversionbranch', branch, path)
|
2018-01-17 14:23:44 +03:00
|
|
|
test_hgsubversion_util.hgclone(u,
|
|
|
|
test_hgsubversion_util.fileurl(checkout_path),
|
2013-08-27 03:40:31 +04:00
|
|
|
wc2_path,
|
|
|
|
update=False)
|
2018-01-17 14:23:44 +03:00
|
|
|
self.repo2 = hg.repository(test_hgsubversion_util.testui(), wc2_path)
|
2013-08-27 03:40:31 +04:00
|
|
|
self.assertEqual(self.repo.heads(), self.repo2.heads())
|
|
|
|
|
|
|
|
|
|
|
|
def buildmethod(case, name, stupid):
|
|
|
|
m = lambda self: self._do_case(case, stupid)
|
|
|
|
m.__name__ = name
|
|
|
|
replay = stupid and 'stupid' or 'regular'
|
|
|
|
m.__doc__ = 'Test custom produces same as standard on %s. (%s)' % (case,
|
|
|
|
replay)
|
|
|
|
return m
|
|
|
|
|
|
|
|
attrs = {'_do_case': _do_case,
|
|
|
|
}
|
2018-01-17 14:23:44 +03:00
|
|
|
for case in test_hgsubversion_util.custom:
|
2013-08-27 03:40:31 +04:00
|
|
|
name = 'test_' + case[:-len('.svndump')].replace('-', '_')
|
|
|
|
attrs[name] = buildmethod(case, name, stupid=False)
|
2015-12-31 20:06:58 +03:00
|
|
|
if svnwrap.subversion_version < (1, 9, 0):
|
|
|
|
name += '_stupid'
|
|
|
|
attrs[name] = buildmethod(case, name, stupid=True)
|
2013-08-27 03:40:31 +04:00
|
|
|
|
2018-01-17 14:23:44 +03:00
|
|
|
CustomPullTests = type('CustomPullTests', (test_hgsubversion_util.TestBase,), attrs)
|
2018-01-17 14:23:44 +03:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
import silenttestrunner
|
|
|
|
silenttestrunner.main(__name__)
|
|
|
|
|