mirror of
https://github.com/facebook/sapling.git
synced 2024-10-09 08:18:15 +03:00
d5c1e599b8
Summary: We've been shipping our RPMs with toml config support turned on for a while now. Remove support for the old config file format. Continue to ship the old format configurations. We'll remove those in a later diff. Reviewed By: strager Differential Revision: D10020958 fbshipit-source-id: 11c2ca3b5da086b142042496a2814699880c4f81
67 lines
2.0 KiB
Python
67 lines
2.0 KiB
Python
#!/usr/bin/env python3
|
|
#
|
|
# Copyright (c) 2016-present, Facebook, Inc.
|
|
# All rights reserved.
|
|
#
|
|
# This source code is licensed under the BSD-style license found in the
|
|
# LICENSE file in the root directory of this source tree. An additional grant
|
|
# of patent rights can be found in the PATENTS file in the same directory.
|
|
|
|
import os
|
|
from typing import List
|
|
|
|
from .lib import testcase
|
|
|
|
|
|
class RepoTest(testcase.EdenTestCase):
|
|
"""
|
|
Tests for the "eden repository" command.
|
|
|
|
Note that these tests do not use @testcase.eden_repo_test, since we don't
|
|
actually need to run separately with git and mercurial repositories. These
|
|
tests don't actually mount anything in eden at all.
|
|
"""
|
|
|
|
def test_list_repository(self) -> None:
|
|
self.assertEqual([], self._list_repos())
|
|
|
|
config = """\
|
|
["repository fbsource"]
|
|
path = "/data/users/carenthomas/fbsource"
|
|
type = "git"
|
|
|
|
["bindmounts fbsource"]
|
|
fbcode-buck-out = "fbcode/buck-out"
|
|
fbandroid-buck-out = "fbandroid/buck-out"
|
|
fbobjc-buck-out = "fbobjc/buck-out"
|
|
buck-out = "buck-out"
|
|
|
|
["repository git"]
|
|
path = "/home/carenthomas/src/git"
|
|
type = "git"
|
|
|
|
["repository hg-crew"]
|
|
url = "/data/users/carenthomas/facebook-hg-rpms/hg-crew"
|
|
type = "hg"
|
|
"""
|
|
home_config_file = os.path.join(self.home_dir, ".edenrc")
|
|
with open(home_config_file, "w") as f:
|
|
f.write(config)
|
|
|
|
expected = ["fbsource", "git", "hg-crew"]
|
|
self.assertEqual(expected, self._list_repos())
|
|
|
|
def test_add_multiple(self) -> None:
|
|
hg_repo = self.create_hg_repo("hg_repo")
|
|
git_repo = self.create_git_repo("git_repo")
|
|
|
|
self.eden.add_repository("hg1", hg_repo.path)
|
|
self.assertEqual(["hg1"], self._list_repos())
|
|
self.eden.add_repository("hg2", hg_repo.path)
|
|
self.assertEqual(["hg1", "hg2"], self._list_repos())
|
|
self.eden.add_repository("git1", git_repo.path)
|
|
self.assertEqual(["git1", "hg1", "hg2"], self._list_repos())
|
|
|
|
def _list_repos(self) -> List[str]:
|
|
return self.eden.repository_cmd().splitlines()
|