sapling/tests/test-hgsubversion-single-dir-clone.py
Jun Wu 66f2e5f45e branch: disable branchcache and drop all branches other than "default"
Summary:
This hardcodes several perftweaks configs that have been enabled for major FB
repos for months:

  [perftweaks]
  disablebranchcache = True
  disablebranchcache2 = True
  disableresolvingbranches = True
  disableupdatebranchcacheoncommit = True

Practically, this means the branchmap is now just `{'default': heads}`. (i.e.
there are no named branches other than `default`), and branchcache is removed
(i.e. `.hg/cache` does not exist without clindex or in-repo tags).

This diff only makes easy-to-verify logic changes by assuming the configs and
removing dead code. Things can be further cleaned up. They will be done by
upcoming changes.

Most test changes are due to the fact that `.hg/cache` is no longer created.

Reviewed By: singhsrb

Differential Revision: D14179858

fbshipit-source-id: 479f7427168eb1d9614a973e273a229e50f5620a
2019-02-22 21:02:41 -08:00

75 lines
2.5 KiB
Python

# no-check-code -- see T24862348
import shutil
import test_hgsubversion_util
from edenscm.hgext.hgsubversion import compathacks
class TestSingleDirClone(test_hgsubversion_util.TestBase):
stupid_mode_tests = True
def test_clone_single_dir_simple(self):
repo = self._load_fixture_and_fetch(
"branch_from_tag.svndump", layout="single", subdir=""
)
self.assertEqual(compathacks.branchset(repo), set(["default"]))
self.assertEqual(
sorted(repo["tip"].manifest().keys()),
[
"branches/branch_from_tag/alpha",
"branches/branch_from_tag/beta",
"tags/copied_tag/alpha",
"tags/copied_tag/beta",
"tags/tag_r3/alpha",
"tags/tag_r3/beta",
"trunk/alpha",
"trunk/beta",
],
)
def test_clone_subdir_is_file_prefix(self):
FIXTURE = "subdir_is_file_prefix.svndump"
repo = self._load_fixture_and_fetch(
FIXTURE, layout="single", subdir=test_hgsubversion_util.subdir[FIXTURE]
)
self.assertEqual(compathacks.branchset(repo), set(["default"]))
self.assertEqual(repo["tip"].manifest().keys(), ["flaf.txt"])
def test_externals_single(self):
repo = self._load_fixture_and_fetch("externals.svndump", layout="single")
for rev in repo:
assert ".hgsvnexternals" not in repo[rev].manifest()
return # TODO enable test when externals in single are fixed
expect = """[.]
-r2 ^/externals/project2@2 deps/project2
[subdir]
^/externals/project1 deps/project1
[subdir2]
^/externals/project1 deps/project1
"""
test = 2
self.assertEqual(self.repo[test][".hgsvnexternals"].data(), expect)
def test_externals_single_whole_repo(self):
# This is the test which demonstrates the brokenness of externals
return # TODO enable test when externals in single are fixed
repo = self._load_fixture_and_fetch(
"externals.svndump", layout="single", subdir=""
)
for rev in repo:
rc = repo[rev]
if ".hgsvnexternals" in rc:
extdata = rc[".hgsvnexternals"].data()
assert "[.]" not in extdata
print(extdata)
expect = "" # Not honestly sure what this should be...
test = 4
self.assertEqual(self.repo[test][".hgsvnexternals"].data(), expect)
if __name__ == "__main__":
import silenttestrunner
silenttestrunner.main(__name__)