2018-01-03 22:51:20 +03:00
|
|
|
# no-check-code -- see T24862348
|
|
|
|
|
2019-05-21 19:06:46 +03:00
|
|
|
from __future__ import absolute_import
|
|
|
|
|
2013-08-27 03:40:31 +04:00
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
|
2018-01-17 14:23:44 +03:00
|
|
|
import test_hgsubversion_util
|
2019-01-30 03:25:33 +03:00
|
|
|
from edenscm.hgext.hgsubversion import svnwrap
|
|
|
|
from edenscm.mercurial import hg
|
2013-08-27 03:40:31 +04:00
|
|
|
|
|
|
|
|
|
|
|
def _do_case(self, name, stupid):
|
2018-05-30 12:16:33 +03:00
|
|
|
subdir = test_hgsubversion_util.subdir.get(name, "")
|
|
|
|
config = {"hgsubversion.stupid": stupid and "1" or "0"}
|
|
|
|
repo, repo_path = self.load_and_fetch(
|
|
|
|
name, subdir=subdir, layout="auto", config=config
|
|
|
|
)
|
|
|
|
assert (
|
|
|
|
test_hgsubversion_util.repolen(self.repo) > 0
|
2018-06-06 08:05:00 +03:00
|
|
|
), "Repo had no changes, maybe you need to add a subdir entry in test_hgsubversion_util?"
|
2018-05-30 12:16:33 +03:00
|
|
|
wc2_path = self.wc_path + "_custom"
|
2013-08-27 03:40:31 +04:00
|
|
|
checkout_path = repo_path
|
|
|
|
if subdir:
|
2018-05-30 12:16:33 +03:00
|
|
|
checkout_path += "/" + subdir
|
|
|
|
u = test_hgsubversion_util.testui(stupid=stupid, layout="custom")
|
2018-01-17 14:23:44 +03:00
|
|
|
for branch, path in test_hgsubversion_util.custom.get(name, {}).iteritems():
|
2018-05-30 12:16:33 +03:00
|
|
|
u.setconfig("hgsubversionbranch", branch, path)
|
|
|
|
test_hgsubversion_util.hgclone(
|
|
|
|
u, test_hgsubversion_util.fileurl(checkout_path), 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
|
2018-05-30 12:16:33 +03:00
|
|
|
replay = stupid and "stupid" or "regular"
|
|
|
|
m.__doc__ = "Test custom produces same as standard on %s. (%s)" % (case, replay)
|
2013-08-27 03:40:31 +04:00
|
|
|
return m
|
|
|
|
|
2018-05-30 12:16:33 +03:00
|
|
|
|
|
|
|
attrs = {"_do_case": _do_case}
|
2018-01-17 14:23:44 +03:00
|
|
|
for case in test_hgsubversion_util.custom:
|
2018-05-30 12:16:33 +03:00
|
|
|
name = "test_" + case[: -len(".svndump")].replace("-", "_")
|
2019-08-16 01:46:26 +03:00
|
|
|
if name != "test_rename_branch_parent_dir":
|
|
|
|
attrs[name] = buildmethod(case, name, stupid=False)
|
|
|
|
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-05-30 12:16:33 +03:00
|
|
|
CustomPullTests = type("CustomPullTests", (test_hgsubversion_util.TestBase,), attrs)
|
2018-01-17 14:23:44 +03:00
|
|
|
|
2018-05-30 12:16:33 +03:00
|
|
|
if __name__ == "__main__":
|
2018-01-17 14:23:44 +03:00
|
|
|
import silenttestrunner
|
|
|
|
|
2018-05-30 12:16:33 +03:00
|
|
|
silenttestrunner.main(__name__)
|