sapling/eden/integration/hg/non_eden_operation_test.py
Adam Simpkins 9bfb48c921 update license headers in .py files
Summary:
Update the copyright & license headers in Python files to reflect the
relicensing to GPLv2

Reviewed By: wez

Differential Revision: D15487088

fbshipit-source-id: 9f2138dff41048d2c35f15e09a04ae5a9c9c80dd
2019-06-19 17:02:46 -07:00

49 lines
1.7 KiB
Python

#!/usr/bin/env python3
#
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2.
import os
from eden.integration.hg.lib.hg_extension_test_base import EdenHgTestCase, hg_test
from eden.integration.lib import hgrepo
@hg_test
class NonEdenOperationTest(EdenHgTestCase):
def populate_backing_repo(self, repo: hgrepo.HgRepository) -> None:
repo.write_file("hello.txt", "hola")
def test_hg_clone_non_eden_repo_within_eden_repo(self):
"""Regression test to ensure that running `hg` commands from an
Eden-backed Hg repo on a non-Eden-backed Hg repo work as expected."""
non_eden_hg_repo = os.path.join(self.tmp_dir, "non-eden-hg-repo")
os.mkdir(non_eden_hg_repo)
# Create the non-Eden Hg repo.
self.hg("init", cwd=non_eden_hg_repo)
first_file = os.path.join(non_eden_hg_repo, "first.txt")
with open(first_file, "w") as f:
f.write("First file in non-Eden-backed Hg repo.\n")
self.hg(
"commit",
"--config",
"ui.username=Kevin Flynn <lightcyclist@example.com>",
"-Am",
"first commit",
cwd=non_eden_hg_repo,
)
# Run `hg clone` from the Eden repo.
clone_of_non_eden_hg_repo = os.path.join(self.tmp_dir, "clone-target")
self.hg(
"clone", non_eden_hg_repo, clone_of_non_eden_hg_repo, cwd=self.repo.path
)
dest_first_file = os.path.join(clone_of_non_eden_hg_repo, "first.txt")
with open(dest_first_file, "r") as f:
contents = f.read()
self.assertEqual("First file in non-Eden-backed Hg repo.\n", contents)