mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 07:17:55 +03:00
3250fd3aa2
Summary:
Previously it was planned to have a config the Rust for all commands. However, this is rather messy since some of our test infrastructure depends on having some commands (i.e. `hg status`) falling back to Python since they are still not entirely implemented in Rust.
This also fixes a mistake committed in D36638023 (4681a8096b
) where the config used for fallback was `migration.force-rust` instead of the correct `commands.force-rust`.
Reviewed By: DurhamG
Differential Revision: D36870536
fbshipit-source-id: d5b7933c2f4ade57be7e7a2ceb628796a8a39aad
51 lines
1.5 KiB
Python
51 lines
1.5 KiB
Python
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
#
|
|
# This software may be used and distributed according to the terms of the
|
|
# GNU General Public License version 2.
|
|
|
|
# pyre-strict
|
|
|
|
from eden.testlib.base import BaseTest, hgtest
|
|
from eden.testlib.repo import Repo
|
|
from eden.testlib.util import new_dir
|
|
from eden.testlib.workingcopy import WorkingCopy
|
|
|
|
|
|
class TestBasicClone(BaseTest):
|
|
def setUp(self) -> None:
|
|
super().setUp()
|
|
self.config.add("commands", "force-rust", "clone")
|
|
|
|
@hgtest
|
|
def test_repo_specific_config(self, repo: Repo, _: WorkingCopy) -> None:
|
|
config_dir = new_dir()
|
|
config_dir.joinpath(f"{repo.name}.rc").write_text("[foo]\nbar=baz\n")
|
|
|
|
self.config.add("clone", "repo-specific-config-dir", str(config_dir))
|
|
|
|
cloned_repo = self.server.clone()
|
|
|
|
self.assertEqual(
|
|
cloned_repo.hg.config("foo.bar").stdout.strip(),
|
|
"baz",
|
|
)
|
|
|
|
@hgtest
|
|
def test_dirstate_mtime_race(self, repo: Repo, wc: WorkingCopy) -> None:
|
|
wc.file(path="foo", content="foo")
|
|
commit1 = wc.commit()
|
|
|
|
wc.hg.push(rev=commit1.hash, to="master", create=True)
|
|
|
|
other_wc = WorkingCopy(repo, new_dir())
|
|
other_wc.hg.clone(repo.url, other_wc.root)
|
|
|
|
# Try to update our file in the same second the checkout finished.
|
|
other_wc["foo"].write("bar")
|
|
|
|
# Make sure we pick up "foo" as modified.
|
|
self.assertEqual(
|
|
other_wc.status().modified,
|
|
["foo"],
|
|
)
|