示例#1
0
 def test_clone_git_repository_http(self):
     """Test clone git repository over http."""
     with patch("yoda.repository.Git.clone") as patch_clone:
         clone(
             "https://git.project.org/foo/bar.git",
             "%s/bar" % self.sandbox.path)
         patch_clone.assert_called_once_with(
             "https://git.project.org/foo/bar.git")
示例#2
0
 def test_clone_git_repository_ssh(self):
     """Test clone git repository over ssh."""
     with patch("yoda.repository.Git.clone") as patch_clone:
         clone(
             "[email protected]:foo/bar",
             "%s/bar" % self.sandbox.path)
         patch_clone.assert_called_once_with(
             "[email protected]:foo/bar")
示例#3
0
 def test_clone_hg_repository(self):
     """Test clone hg repository."""
     with patch("yoda.repository.Hg.clone") as patch_clone:
         clone(
             "ssh://[email protected]/foo/bar",
             "%s/bar" % self.sandbox.path)
         patch_clone.assert_called_once_with(
             "ssh://[email protected]/foo/bar")
示例#4
0
 def test_clone_bzr_repository(self):
     """Test clone bzr repository."""
     with patch("yoda.repository.Bzr.clone") as patch_clone:
         clone(
             "bzr://project.org/foo/bar",
             "%s/bar" % self.sandbox.path)
         patch_clone.assert_called_once_with(
             "bzr://project.org/foo/bar")
示例#5
0
 def test_clone_svn_repository(self):
     """Test clone svn repository."""
     with patch("yoda.repository.Svn.clone") as patch_clone:
         clone(
             "svn://numergy/yoda",
             "%s/bar" % self.sandbox.path)
         patch_clone.assert_called_once_with(
             "svn://numergy/yoda")
示例#6
0
    def add(self, ws_name, repo_name, url, path):
        ws = self.config["workspaces"][ws_name]
        repo_path = ws["path"] + "/" + repo_name if path is None else path

        if ("repositories" not in ws):
            ws["repositories"] = {}

        if (repo_name in ws["repositories"]):
            raise ValueError("Repository %s already exists" % repo_name)

        if url is not None:
            clone(url, repo_path)

        if (os.path.exists(repo_path) is False):
            os.mkdir(repo_path)

        ws["repositories"][repo_name] = repo_path
        self.logger.info("Repository %s added" % repo_name)
示例#7
0
文件: workspace.py 项目: Numergy/yoda
    def add_repo(self, wname, rname, url=None, path=None):
        ws = self.config["workspaces"][wname]
        repo_path = ws["path"] + "/" + rname if path is None else path

        if ("repositories" not in ws):
            ws["repositories"] = {}

        if (rname in ws["repositories"]):
            raise ValueError("Repository %s already exists" % rname)

        result = None
        if url is not None:
            result = clone(url, repo_path)

        if result is not None and result.returncode != 0:
            raise RepositoryError("Can't clone this repository")

        if (os.path.exists(repo_path) is False):
            os.mkdir(repo_path)

        self.config["workspaces"][wname] = ws
        self.config["workspaces"][wname]["repositories"][rname] = repo_path
        self.config.write()