コード例 #1
0
ファイル: test_models.py プロジェクト: beck/weblate
    def setUp(self):
        # Path where to clone remote repo for tests
        self.git_base_repo_path = os.path.join(
            settings.DATA_DIR,
            'test-base-repo.git'
        )
        # Repository on which tests will be performed
        self.git_repo_path = os.path.join(
            settings.DATA_DIR,
            'test-repo.git'
        )

        # Path where to clone remote repo for tests
        self.hg_base_repo_path = os.path.join(
            settings.DATA_DIR,
            'test-base-repo.hg'
        )
        # Repository on which tests will be performed
        self.hg_repo_path = os.path.join(
            settings.DATA_DIR,
            'test-repo.hg'
        )

        # Clone repo for testing
        if not os.path.exists(self.git_base_repo_path):
            GitRepository.clone(
                GIT_URL,
                self.git_base_repo_path,
                bare=True
            )

        # Remove possibly existing directory
        if os.path.exists(self.git_repo_path):
            shutil.rmtree(self.git_repo_path)

        # Create repository copy for the test
        shutil.copytree(self.git_base_repo_path, self.git_repo_path)

        # Clone repo for testing
        if not os.path.exists(self.hg_base_repo_path):
            HgRepository.clone(
                HG_URL,
                self.hg_base_repo_path,
                bare=True
            )

        # Remove possibly existing directory
        if os.path.exists(self.hg_repo_path):
            shutil.rmtree(self.hg_repo_path)

        # Create repository copy for the test
        shutil.copytree(self.hg_base_repo_path, self.hg_repo_path)

        # Remove possibly existing project directory
        test_repo_path = os.path.join(settings.DATA_DIR, 'vcs', 'test')
        if os.path.exists(test_repo_path):
            shutil.rmtree(test_repo_path)
コード例 #2
0
    def setUp(self):
        # Path where to clone remote repo for tests
        self.git_base_repo_path = os.path.join(settings.DATA_DIR,
                                               'test-base-repo.git')
        # Repository on which tests will be performed
        self.git_repo_path = os.path.join(settings.DATA_DIR, 'test-repo.git')

        # Path where to clone remote repo for tests
        self.hg_base_repo_path = os.path.join(settings.DATA_DIR,
                                              'test-base-repo.hg')
        # Repository on which tests will be performed
        self.hg_repo_path = os.path.join(settings.DATA_DIR, 'test-repo.hg')

        # Clone repo for testing
        if not os.path.exists(self.git_base_repo_path):
            print('Cloning Git test repository to {0}...'.format(
                self.git_base_repo_path))
            GitRepository.clone(GIT_URL, self.git_base_repo_path, bare=True)

        # Remove possibly existing directory
        if os.path.exists(self.git_repo_path):
            shutil.rmtree(self.git_repo_path)

        # Create repository copy for the test
        shutil.copytree(self.git_base_repo_path, self.git_repo_path)

        if HgRepository.is_supported():
            # Clone repo for testing
            if not os.path.exists(self.hg_base_repo_path):
                print('Cloning Mercurial test repository to {0}...'.format(
                    self.hg_base_repo_path))
                HgRepository.clone(HG_URL, self.hg_base_repo_path, bare=True)

            # Remove possibly existing directory
            if os.path.exists(self.hg_repo_path):
                shutil.rmtree(self.hg_repo_path)

            # Create repository copy for the test
            shutil.copytree(self.hg_base_repo_path, self.hg_repo_path)

        # Remove possibly existing project directory
        test_repo_path = os.path.join(settings.DATA_DIR, 'vcs', 'test')
        if os.path.exists(test_repo_path):
            shutil.rmtree(test_repo_path)

        # Remove indexes
        clean_indexes()
コード例 #3
0
ファイル: test_models.py プロジェクト: blockgiven/weblate
    def setUp(self):
        if 'test-repos' in settings.GIT_ROOT:
            test_dir = os.path.join(settings.GIT_ROOT, 'test')
            if os.path.exists(test_dir):
                shutil.rmtree(test_dir)

        # Path where to clone remote repo for tests
        self.git_base_repo_path = os.path.join(settings.GIT_ROOT,
                                               'test-base-repo.git')
        # Repository on which tests will be performed
        self.git_repo_path = os.path.join(settings.GIT_ROOT, 'test-repo.git')

        # Path where to clone remote repo for tests
        self.hg_base_repo_path = os.path.join(settings.GIT_ROOT,
                                              'test-base-repo.hg')
        # Repository on which tests will be performed
        self.hg_repo_path = os.path.join(settings.GIT_ROOT, 'test-repo.hg')

        # Clone repo for testing
        if not os.path.exists(self.git_base_repo_path):
            GitRepository.clone(GIT_URL, self.git_base_repo_path, bare=True)

        # Remove possibly existing directory
        if os.path.exists(self.git_repo_path):
            shutil.rmtree(self.git_repo_path)

        # Create repository copy for the test
        shutil.copytree(self.git_base_repo_path, self.git_repo_path)

        # Clone repo for testing
        if not os.path.exists(self.hg_base_repo_path):
            HgRepository.clone(HG_URL, self.hg_base_repo_path, bare=True)

        # Remove possibly existing directory
        if os.path.exists(self.hg_repo_path):
            shutil.rmtree(self.hg_repo_path)

        # Create repository copy for the test
        shutil.copytree(self.hg_base_repo_path, self.hg_repo_path)

        # Remove possibly existing project directory
        test_repo_path = os.path.join(settings.GIT_ROOT, 'test')
        if os.path.exists(test_repo_path):
            shutil.rmtree(test_repo_path)
コード例 #4
0
ファイル: test_models.py プロジェクト: josben77/weblate
    def setUp(self):
        # Path where to clone remote repo for tests
        self.git_base_repo_path = os.path.join(settings.DATA_DIR, "test-base-repo.git")
        # Repository on which tests will be performed
        self.git_repo_path = os.path.join(settings.DATA_DIR, "test-repo.git")

        # Path where to clone remote repo for tests
        self.hg_base_repo_path = os.path.join(settings.DATA_DIR, "test-base-repo.hg")
        # Repository on which tests will be performed
        self.hg_repo_path = os.path.join(settings.DATA_DIR, "test-repo.hg")

        # Clone repo for testing
        if not os.path.exists(self.git_base_repo_path):
            print("Cloning Git test repository to {0}...".format(self.git_base_repo_path))
            GitRepository.clone(GIT_URL, self.git_base_repo_path, bare=True)

        # Remove possibly existing directory
        if os.path.exists(self.git_repo_path):
            shutil.rmtree(self.git_repo_path)

        # Create repository copy for the test
        shutil.copytree(self.git_base_repo_path, self.git_repo_path)

        # Clone repo for testing
        if not os.path.exists(self.hg_base_repo_path):
            print("Cloning Mercurial test repository to {0}...".format(self.hg_base_repo_path))
            HgRepository.clone(HG_URL, self.hg_base_repo_path, bare=True)

        # Remove possibly existing directory
        if os.path.exists(self.hg_repo_path):
            shutil.rmtree(self.hg_repo_path)

        # Create repository copy for the test
        shutil.copytree(self.hg_base_repo_path, self.hg_repo_path)

        # Remove possibly existing project directory
        test_repo_path = os.path.join(settings.DATA_DIR, "vcs", "test")
        if os.path.exists(test_repo_path):
            shutil.rmtree(test_repo_path)

        # Remove indexes
        clean_indexes()
コード例 #5
0
    def checkout_tmp(self, project, repo, branch):
        '''
        Checkouts project to temporary location.
        '''
        # Create temporary working dir
        workdir = tempfile.mkdtemp(dir=project.get_path())
        os.chmod(workdir, 0o755)

        # Initialize git repository
        self.logger.info('Cloning git repository...')
        gitrepo = GitRepository.clone(repo, workdir)
        self.logger.info('Updating working copy in git repository...')
        gitrepo.configure_branch(branch)

        return workdir
コード例 #6
0
ファイル: import_project.py プロジェクト: aplanas/weblate
    def checkout_tmp(self, project, repo, branch):
        '''
        Checkouts project to temporary location.
        '''
        # Create temporary working dir
        workdir = tempfile.mkdtemp(dir=project.get_path())
        os.chmod(workdir, 0o755)

        # Initialize git repository
        self.logger.info('Cloning git repository...')
        gitrepo = GitRepository.clone(repo, workdir)
        self.logger.info('Updating working copy in git repository...')
        gitrepo.configure_branch(branch)

        return workdir
コード例 #7
0
ファイル: test_models.py プロジェクト: Cervator/weblate
    def setUp(self):
        if 'test-repos' in settings.GIT_ROOT:
            test_dir = os.path.join(settings.GIT_ROOT, 'test')
            if os.path.exists(test_dir):
                shutil.rmtree(test_dir)

        # Path where to clone remote repo for tests
        self.base_repo_path = os.path.join(
            settings.GIT_ROOT,
            'test-base-repo.git'
        )
        # Repository on which tests will be performed
        self.repo_path = os.path.join(
            settings.GIT_ROOT,
            'test-repo.git'
        )

        # Clone repo for testing
        if not os.path.exists(self.base_repo_path):
            GitRepository.clone(
                GIT_URL,
                self.base_repo_path,
                bare=True
            )

        # Remove possibly existing directory
        if os.path.exists(self.repo_path):
            shutil.rmtree(self.repo_path)

        # Create repository copy for the test
        shutil.copytree(self.base_repo_path, self.repo_path)

        # Remove possibly existing project directory
        test_repo_path = os.path.join(settings.GIT_ROOT, 'test')
        if os.path.exists(test_repo_path):
            shutil.rmtree(test_repo_path)
コード例 #8
0
ファイル: test_vcs.py プロジェクト: andyHa/weblate
 def test_revision(self):
     repo = GitRepository.clone(self.repo_path, self._tempdir)
     self.assertEquals(
         repo.last_revision,
         repo.last_remote_revision
     )
コード例 #9
0
ファイル: test_vcs.py プロジェクト: andyHa/weblate
 def test_push(self):
     repo = GitRepository.clone(self.repo_path, self._tempdir)
     repo.push('master')
コード例 #10
0
 def test_needs_commit(self):
     repo = GitRepository.clone(self.repo_path, self._tempdir)
     self.assertFalse(repo.needs_commit())
コード例 #11
0
 def test_status(self):
     repo = GitRepository.clone(self.repo_path, self._tempdir)
     status = repo.status()
     self.assertTrue(
         "Your branch is up-to-date with 'origin/master'." in status)
コード例 #12
0
 def test_rebase(self):
     repo = GitRepository.clone(self.repo_path, self._tempdir)
     repo.rebase('master')
コード例 #13
0
 def test_push(self):
     repo = GitRepository.clone(self.repo_path, self._tempdir)
     repo.push('master')
コード例 #14
0
 def test_update_remote(self):
     repo = GitRepository.clone(self.repo_path, self._tempdir)
     repo.update_remote()
コード例 #15
0
 def test_revision(self):
     repo = GitRepository.clone(self.repo_path, self._tempdir)
     self.assertEquals(repo.last_revision, repo.last_remote_revision)
コード例 #16
0
 def test_clone(self):
     GitRepository.clone(self.repo_path, self._tempdir)
コード例 #17
0
ファイル: test_vcs.py プロジェクト: andyHa/weblate
 def test_update_remote(self):
     repo = GitRepository.clone(self.repo_path, self._tempdir)
     repo.update_remote()
コード例 #18
0
ファイル: test_vcs.py プロジェクト: andyHa/weblate
 def test_clone(self):
     GitRepository.clone(self.repo_path, self._tempdir)
コード例 #19
0
ファイル: test_vcs.py プロジェクト: JDGrimes/weblate
 def setUp(self):
     super(VCSGitTest, self).setUp()
     self._tempdir = tempfile.mkdtemp()
     self.repo = GitRepository.clone(self.repo_path, self._tempdir)
コード例 #20
0
ファイル: test_vcs.py プロジェクト: andyHa/weblate
 def test_rebase(self):
     repo = GitRepository.clone(self.repo_path, self._tempdir)
     repo.rebase('master')
コード例 #21
0
ファイル: test_vcs.py プロジェクト: andyHa/weblate
 def test_needs_commit(self):
     repo = GitRepository.clone(self.repo_path, self._tempdir)
     self.assertFalse(repo.needs_commit())
コード例 #22
0
ファイル: test_vcs.py プロジェクト: andyHa/weblate
 def test_status(self):
     repo = GitRepository.clone(self.repo_path, self._tempdir)
     status = repo.status()
     self.assertTrue(
         "Your branch is up-to-date with 'origin/master'." in status
     )