Esempio n. 1
0
def test_load() -> None:
    contents = """
repos:
  - src: foo
    url: [email protected]:foo.git
    branch: next

  - src: bar
    url: [email protected]:bar.git
    branch: master
    sha1: ad2b68539c78e749a372414165acdf2a1bb68203

  - src: master
    url: [email protected]:master.git
    tag: v0.1
    copy:
      - src: top.cmake
        dest: CMakeLists.txt
      - src: .clang-format
"""
    manifest = tsrc.Manifest()
    parsed = ruamel.yaml.safe_load(contents)
    manifest.apply_config(parsed)
    assert manifest.get_repos() == [
        tsrc.Repo(
            remotes=[
                tsrc.repo.Remote(name="origin", url="[email protected]:foo.git")
            ],
            src="foo",
            branch="next",
            sha1=None,
            tag=None,
        ),
        tsrc.Repo(
            remotes=[
                tsrc.repo.Remote(name="origin", url="[email protected]:bar.git")
            ],
            src="bar",
            branch="master",
            sha1="ad2b68539c78e749a372414165acdf2a1bb68203",
            tag=None,
        ),
        tsrc.Repo(
            remotes=[
                tsrc.repo.Remote(name="origin",
                                 url="[email protected]:master.git")
            ],
            src="master",
            branch="master",
            sha1=None,
            tag="v0.1",
        ),
    ]
    assert manifest.copyfiles == [
        tsrc.Copy("master", "top.cmake", "CMakeLists.txt"),
        tsrc.Copy("master", ".clang-format", ".clang-format"),
    ]
Esempio n. 2
0
def test_can_add_copies(workspace_path: Path, git_server: GitServer) -> None:
    git_server.add_repo("foo")
    git_server.manifest.set_file_copy("foo", "foo.txt", "top.txt")
    manifest = read_remote_manifest(workspace_path, git_server)
    assert manifest.file_system_operations == [
        tsrc.Copy("foo", "foo.txt", "top.txt")
    ]
Esempio n. 3
0
File: manifest.py Progetto: xzr/tsrc
 def _handle_copies(self, repo_config: Any) -> None:
     if "copy" not in repo_config:
         return
     to_cp = repo_config["copy"]
     for item in to_cp:
         src = item["file"]
         dest = item.get("dest", src)
         copy = tsrc.Copy(repo_config["dest"], src, dest)
         self.file_system_operations.append(copy)
Esempio n. 4
0
def test_git_server_can_add_copies(workspace_path: Path,
                                   git_server: GitServer) -> None:
    git_server.add_repo("foo")
    git_server.manifest.set_repo_file_copies("foo", [("foo.txt", "top.txt")])
    manifest = read_remote_manifest(workspace_path, git_server)
    assert manifest.copyfiles == [tsrc.Copy("foo", "foo.txt", "top.txt")]